Skip to content

Commit

Permalink
Hotfix for #23
Browse files Browse the repository at this point in the history
- Remove insert-nums reference
- Fix call/history entry
- Fix Command Palette entries
- Ensure compatibility for older history entries
  • Loading branch information
duydao committed Nov 18, 2014
1 parent 52e826f commit a8b553d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[{
"caption": "Text Pastry: From 0 To X",
"command": "insert_nums",
"args": {"current": "0", "step": "1", "padding": "1"}
"command": "text_pastry_range",
"args": {"start": 0, "step": 1, "padding": 1}
}, {
"caption": "Text Pastry: From 1 To X",
"command": "insert_nums",
"args": {"current": "1", "step": "1", "padding": "1"}
"command": "text_pastry_range",
"args": {"start": 1, "step": 1, "padding": 1}
}, {
"caption": "Text Pastry: Range",
"command": "text_pastry_show_command_line",
Expand Down
20 changes: 11 additions & 9 deletions text_pastry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sublime_plugin
import re
import operator
import datetime
import time
import uuid
import subprocess
Expand Down Expand Up @@ -562,10 +563,11 @@ def on_done(self, index):
command = item.command
text = item.text
separator = item.separator
# insert nums for history compatibility
if command == "insert_nums":
sublime.status_message("insert_nums: " + text)
(current, step, padding) = map(str, text.split(" "))
self.window.run_command(command, {"current": current, "step": step, "padding": padding})
sublime.status_message("text_pastry_range: " + text)
(start, step, padding) = map(str, text.split(" "))
self.window.run_command("text_pastry_range", {"start": start, "step": step, "padding": padding})
elif command == "text_pastry_insert_text":
self.window.run_command(command, {"text": text, "separator": separator})
else:
Expand Down Expand Up @@ -597,11 +599,11 @@ def on_done(self, index):
else:
sublime.message_dialog("No Clipboard Data available")
elif item.command == "\\i":
self.history_manager.append(data={"command": "insert_nums", "args": {"current": "1", "step": "1", "padding": "1"}}, label=item.label)
self.window.run_command("insert_nums", {"current": "1", "step": "1", "padding": "1"})
self.history_manager.append(data={"command": "text_pastry_range", "args": {"start": 1, "step": 1, "padding": 1}}, label=item.label)
self.window.run_command("text_pastry_range", {"start": 1, "step": 1, "padding": 1})
elif item.command == "\\i0":
self.history_manager.append(data={"command": "insert_nums", "args": {"current": "0", "step": "1", "padding": "1"}}, label=item.label)
self.window.run_command("insert_nums", {"current": "0", "step": "1", "padding": "1"})
self.history_manager.append(data={"command": "text_pastry_range", "args": {"start": 0, "step": 1, "padding": 1}}, label=item.label)
self.window.run_command("text_pastry_range", {"start": 0, "step": 1, "padding": 1})
elif item.command.lower() == "uuid":
self.history_manager.append(data={"command": "text_pastry_uuid", "args": {"uppercase": False}}, label=item.label)
self.window.run_command("text_pastry_uuid", {"uppercase": False})
Expand Down Expand Up @@ -709,8 +711,8 @@ def run(self):
if text and command:
sublime.status_message("Running last command")
if command == "insert_nums":
(current, step, padding) = map(str, text.split(" "))
self.window.active_view().run_command(command, {"current": current, "step": step, "padding": padding})
(start, step, padding) = map(str, text.split(" "))
self.window.active_view().run_command("text_pastry_range", {"start": start, "step": step, "padding": padding})
elif command == "text_pastry_insert_text":
self.window.active_view().run_command(command, {"text": text, "separator": separator})
else:
Expand Down

0 comments on commit a8b553d

Please sign in to comment.