Skip to content

Commit

Permalink
Properly restore tracker on caret movement
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeche committed Oct 11, 2020
1 parent f6cd174 commit 88e2d99
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/abbreviation.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,12 @@ def handle_change(editor: sublime.View, pos: int) -> AbbreviationTracker:

def handle_selection_change(editor: sublime.View, pos: int) -> AbbreviationTracker:
"Handle selection (caret) change in given editor instance"
last_pos = _last_pos.get(editor.id(), -1)
set_last_pos(editor, pos)

# Do not restore tracker if selection wasn’t changed.
# Otherwise, it will restore just expanded tracker in some cases,
# like `#ddd` (e.g. abbreviation is the same as result)
tracker = get_tracker(editor) or (last_pos != pos and restore_tracker(editor, pos))
tracker = get_tracker(editor) or restore_tracker(editor, pos)
if tracker:
tracker.last_pos = pos
return tracker
Expand Down

0 comments on commit 88e2d99

Please sign in to comment.