« get me outta code hell

st4: hsmusic: jump to next chunk of text w/ enter - dotfiles - Miscellaneous configuration files of my personal use
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-02-27 13:42:52 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-02-27 13:43:23 -0400
commit5bcc422503db1547f6e9b8dbcdc039b36e532c55 (patch)
tree88b0ee765eb7a5712309b2ea27a025a72c03aa59
parent2745f4008b20d7c1b858b22296a91bbb144ba41e (diff)
st4: hsmusic: jump to next chunk of text w/ enter
-rw-r--r--apps/Sublime Text 4/Packages/User/HSMusic Editing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
index 22e7db7..232ecd3 100644
--- a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
+++ b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
@@ -247,6 +247,14 @@ class ExitWikiTagCommand(_CursorAdaptiveCommand):
     if rest_of_tag:
       return ('collapse_move', len(rest_of_tag))
 
+    region = _normalize_region(region)
+    to_start = sublime.Region(self.view.line(region).a, region.a)
+    to_end = sublime.Region(region.a, self.view.line(region).b)
+    if to_start.a != to_start.b and to_end.a != to_end.b:
+      match = re.search('.*?([).,:;!?][).,:;!?"\']*|\\s(?=[(\'"])|[\'"](?=\\s|$)|$)', self.view.substr(to_end))
+      if match:
+        return ('collapse_move', len(match.group(0)))
+
   def no_action_fallback(self, edit):
     self.view.run_command('insert', {'characters': '\n'})