diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-01-23 17:07:24 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-23 17:08:04 -0400 |
commit | 0b1581b73bff34d2b7b1360003d9dbc4ae41565b (patch) | |
tree | 88622605ad97bc637cccd79161d732556ac8c144 /apps/Sublime Text 4/Packages/User/HSMusic Editing.py | |
parent | 2844af3a0468fbef1d6322474119b5bc92a97243 (diff) |
st4: hsmusic: fix space handling outside of tags
Diffstat (limited to 'apps/Sublime Text 4/Packages/User/HSMusic Editing.py')
-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': ' '}) |