Mercurial > vim
diff src/testdir/test_mapping.vim @ 16101:5c5d211bd5a8 v8.1.1055
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
commit https://github.com/vim/vim/commit/75bf3d22f42684beecd977f3185e98045b5c33d9
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 26 22:46:05 2019 +0100
patch 8.1.1055: CTRL-G U in Insert mode doesn't work for shift-Left
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 26 Mar 2019 23:00:06 +0100 |
parents | cb501b3c9fb5 |
children | fb7cf38a1c7a |
line wrap: on
line diff
--- 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))