Skip to content

Commit 061a980

Browse files
committed
Improve selecting left form when in between #10 #42
1 parent 0d73cc2 commit 061a980

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

package.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,10 @@ def expand_until(view, point, scopes):
359359
return sublime.Region(begin, end)
360360

361361
def topmost_form(view, point):
362-
# move left if point is in whitespace and the rest of the line is also whitespace
363-
line = view.line(point)
364-
rest_of_line = view.substr(sublime.Region(point, line.b))
365-
if rest_of_line.isspace() or not rest_of_line:
366-
while point-1 > line.a and view.substr(point-1).isspace():
367-
point -= 1
362+
# move left to first non-space
363+
if point >= view.size() or view.substr(sublime.Region(point, point + 1)).isspace():
364+
while point > 0 and view.substr(sublime.Region(point - 1, point)).isspace():
365+
point = point - 1
368366

369367
region = expand_until(view, point, {'source.clojure '})
370368
if region \

0 commit comments

Comments
 (0)