Skip to content

Commit

Permalink
Fix: let command palette trigger on_post_window_command
Browse files Browse the repository at this point in the history
  • Loading branch information
randy3k committed Mar 21, 2018
1 parent 89137af commit a891b30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Default.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"caption": "Preferences: GitSavvy Key Bindings",
"command": "edit_settings",
"command": "gs_edit_settings",
"args": {
"base_file": "${packages}/GitSavvy/Default (${platform}).sublime-keymap"
}
Expand Down
12 changes: 11 additions & 1 deletion common/global_events.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sublime
from sublime_plugin import EventListener
from sublime_plugin import EventListener, WindowCommand

from . import util

Expand Down Expand Up @@ -51,3 +51,13 @@ def on_post_window_command(self, window, command, args):
w.focus_group(0)
w.run_command("open_file", {"file": "${packages}/GitSavvy/Default.sublime-keymap"})
w.focus_group(1)


class GsEditSettingsCommand(WindowCommand):
"""
For some reasons, the command palette doesn't trigger `on_post_window_command` for
dev version of Sublime Text. The command palette would call `gs_edit_settings` and
subsequently trigger `on_post_window_command`.
"""
def run(self, **kwargs):
self.window.run_command("edit_settings", kwargs)

0 comments on commit a891b30

Please sign in to comment.