summaryrefslogtreecommitdiff
path: root/src/testdir/test_listener.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-08 15:27:21 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-08 15:27:21 +0200
commit4544bd2f247425c9dd743c76618dd70f53c72538 (patch)
tree9940de2ec12998f428a1d4fdb048c610f66895a9 /src/testdir/test_listener.vim
parentfca068b977b1dc07b269e8c3e0ff7aa638357eff (diff)
downloadvim-git-4544bd2f247425c9dd743c76618dd70f53c72538.tar.gz
patch 8.1.2008: error for invalid range when using listener and undov8.1.2008
Problem: Error for invalid range when using listener and undo. (Paul Jolly) Solution: Do not change the cursor before the lines are restored. (closes #4908)
Diffstat (limited to 'src/testdir/test_listener.vim')
-rw-r--r--src/testdir/test_listener.vim24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim
index 3aadeaa96..8c265be2d 100644
--- a/src/testdir/test_listener.vim
+++ b/src/testdir/test_listener.vim
@@ -234,7 +234,7 @@ func Test_listener_garbage_collect()
new
let id = listener_add(function('MyListener', [{}]), bufnr(''))
call test_garbagecollect_now()
- " must not crach caused by invalid memory access
+ " must not crash caused by invalid memory access
normal ia
call assert_true(v:true)
@@ -268,3 +268,25 @@ func Test_listener_caches_buffer_line()
iunmap <CR>
set nocindent
endfunc
+
+" Verify the fix for issue #4908
+func Test_listener_undo_line_number()
+ function DoIt()
+ " NOP
+ endfunction
+ function EchoChanges(bufnr, start, end, added, changes)
+ call DoIt()
+ endfunction
+
+ new
+ let lid = listener_add("EchoChanges")
+ call setline(1, ['a', 'b', 'c'])
+ set undolevels& " start new undo block
+ call feedkeys("ggcG\<Esc>", 'xt')
+ undo
+
+ bwipe!
+ delfunc DoIt
+ delfunc EchoChanges
+ call listener_remove(lid)
+endfunc