diff options
Diffstat (limited to 'apps/Sublime Text 4/Packages/User')
-rw-r--r-- | apps/Sublime Text 4/Packages/User/HSMusic Editing.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py index bde61b0..89fa031 100644 --- a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py +++ b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py @@ -43,7 +43,11 @@ class _CursorAdaptiveCommand(sublime_plugin.TextCommand): actions = list() for region in self.view.sel(): action = self.handle_region(region) - actions.append((region, *(action or self.handle_region_fallback))) + if action: + actions.append((region, *(action or self.handle_region_fallback))) + + if not actions: + return self.no_action_fallback(edit) new_regions = list() for (region, action, *args) in actions: @@ -90,6 +94,9 @@ class _CursorAdaptiveCommand(sublime_plugin.TextCommand): def handle_region(self, region): pass + def no_action_fallback(self, edit): + pass + def perform_keep(self, edit, region): return (region, 'right', 0, 0) @@ -224,3 +231,6 @@ class SpaceInWikiTagCommand(_CursorAdaptiveCommand): return ('move', 1) else: return ('insert', 'right', '|', 0) + + def no_action_fallback(self, edit): + self.view.run_command('insert', {'characters': ' '}) |