summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_mapping.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-26 22:46:05 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-26 22:46:05 +0100
commit75bf3d22f42684beecd977f3185e98045b5c33d9 (patch)
treea0e1bdbd10736d4ee13b26d34a88cfd2c8becbcc /src/testdir/test_mapping.vim
parent6fb5c97242a151e67bd5c72736f187ef71c44e24 (diff)
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Leftv8.1.1055
Problem: CTRL-G U in Insert mode doesn't work to avoid splitting the undo sequence for shift-left and shift-right. Solution: Also check dont_sync_undo for shifted cursor keys. (Christian Brabandt)
Diffstat (limited to 'src/testdir/test_mapping.vim')
-rw-r--r--src/testdir/test_mapping.vim25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim
index c454fc01cc..61a1edd4ad 100644
--- a/src/testdir/test_mapping.vim
+++ b/src/testdir/test_mapping.vim
@@ -140,9 +140,32 @@ func Test_map_cursor()
imapclear
endfunc
+func Test_map_cursor_ctrl_gU()
+ " <c-g>U<cursor> works only within a single line
+ nnoremap c<* *Ncgn<C-r>"<C-G>U<S-Left>
+ call setline(1, ['foo', 'foobar', '', 'foo'])
+ call cursor(1,2)
+ call feedkeys("c<*PREFIX\<esc>.", 'xt')
+ call assert_equal(['PREFIXfoo', 'foobar', '', 'PREFIXfoo'], getline(1,'$'))
+ " break undo manually
+ set ul=1000
+ exe ":norm! uu"
+ call assert_equal(['foo', 'foobar', '', 'foo'], getline(1,'$'))
+
+ " Test that it does not work if the cursor moves to the previous line
+ " 2 times <S-Left> move to the previous line
+ nnoremap c<* *Ncgn<C-r>"<C-G>U<S-Left><C-G>U<S-Left>
+ call setline(1, ['', ' foo', 'foobar', '', 'foo'])
+ call cursor(2,3)
+ call feedkeys("c<*PREFIX\<esc>.", 'xt')
+ call assert_equal(['PREFIXPREFIX', ' foo', 'foobar', '', 'foo'], getline(1,'$'))
+ nmapclear
+endfunc
+
+
" This isn't actually testing a mapping, but similar use of CTRL-G U as above.
func Test_break_undo()
- :set whichwrap=<,>,[,]
+ set whichwrap=<,>,[,]
call feedkeys("G4o2k", "xt")
exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>."
call assert_equal('new line here', getline(line('$') - 3))