Skip to content
Browse files

Handles auto-insertions better

  • Loading branch information...
1 parent 5b1f7d4 commit 56beb6309a8b3cc98dc80aca97ed81083c576caa @agibsonsw committed
Showing with 8 additions and 2 deletions.
  1. +8 −2 AndyEdits.py
View
10 AndyEdits.py
@@ -293,12 +293,17 @@ def on_modified(self, view):
same_line, _ = view.rowcol(currA - 1)
if cview['curr_line'] == same_line:
currA -= 1
+ cview['to_eol'] = (currB == view.line(sel).end())
cview['lastx'], cview['lasty'] = (currA, currB)
elif cview['curr_line'] == cview['prev_line']:
# still on the same line
cview['lastx'] = min(currA, cview['lastx'])
- # don't go beyond end of current line..
- cview['lasty'] = max(currB, min(cview['lasty'] + 1, view.line(sel).end()))
+ if cview['to_eol']:
+ cview['lasty'] = view.line(sel).end()
+ else:
+ # don't go beyond end of current line..
+ cview['lasty'] = max(currB, min(cview['lasty'] + 1, \
+ view.line(sel).end()))
else:
# moving to a different line
cview['prev_line'] = cview['curr_line']
@@ -307,6 +312,7 @@ def on_modified(self, view):
same_line, _ = view.rowcol(currA - 1)
if cview['curr_line'] == same_line:
currA -= 1
+ cview['to_eol'] = (currB == view.line(sel).end())
cview['lastx'], cview['lasty'] = (currA, currB)
_ = adjustEdits(view)
if cview['lastx'] < cview['lasty']:

0 comments on commit 56beb63

Please sign in to comment.
Something went wrong with that request. Please try again.