« get me outta code hell

dotfiles - Miscellaneous configuration files of my personal use
about summary refs log tree commit diff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/Sublime Text 4/Packages/User/HSMusic Editing.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
index 74880a2..4fa3663 100644
--- a/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
+++ b/apps/Sublime Text 4/Packages/User/HSMusic Editing.py
@@ -60,18 +60,11 @@ class _CursorAdaptiveCommand(sublime_plugin.TextCommand):
 
     real_regions = list()
     for (region, direction, delta, backoff) in new_regions:
-      if direction == 'collapse-left':
-        if region.a < region.b:
-          point = self.__align_point_after_insertions(region.a, 'right')
-        else:
-          point = self.__align_point_after_insertions(region.b, 'right')
-        real_regions.append(point)
-      elif direction == 'collapse-right':
-        if region.a < region.b:
-          point = self.__align_point_after_insertions(region.a, 'left')
-        else:
-          point = self.__align_point_after_insertions(region.b, 'left')
-        real_regions.append(point)
+      if direction in ['collapse-left', 'collapse-right']:
+        point = _normalize_region(region).a
+        align_direction = ('right' if direction == 'collapse-left' else 'left')
+        aligned_point = self.__align_point_after_insertions(point, align_direction)
+        real_regions.append(aligned_point)
       elif direction in ['left', 'right']:
         start = region.a
         end = region.b + delta