aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-02 22:22:17 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-02 22:22:17 +1200
commit6c33c4a66e682b0ae9d209b91bfb4aab6d45ec67 (patch)
treeec7754c58bedfae650fedbd455e6bdaaaca7b974
parentCorrect a version number comparison (diff)
downloadvim-insert-cancel-6c33c4a66e682b0ae9d209b91bfb4aab6d45ec67.tar.gz
vim-insert-cancel-6c33c4a66e682b0ae9d209b91bfb4aab6d45ec67.zip
Check '[ and '] marks as well for insert
This is in the right direction for fixing the bug, but it's still not quite right--it only works if there was a comment leader added.
-rw-r--r--plugin/insert_cancel.vim7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugin/insert_cancel.vim b/plugin/insert_cancel.vim
index da4e3ad..33735ae 100644
--- a/plugin/insert_cancel.vim
+++ b/plugin/insert_cancel.vim
@@ -28,7 +28,12 @@ endif
" Try to figure out whether we made a change to undo, undo it if so
function! s:InsertCancel()
- if &modified && b:changedtick > s:changedtick
+ if !&modified
+ return
+ endif
+ if s:changedtick > 0 && b:changedtick > s:changedtick
+ \ || line("'[") != line("']")
+ \ || col("'[") != col("']")
silent undo
endif
endfunction