comparison 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
comparison
equal deleted inserted replaced
16100:1c8969addd04 16101:5c5d211bd5a8
138 call assert_equal('Test2: text wit a (here some more text [und undo])', getline(line('$') - 1)) 138 call assert_equal('Test2: text wit a (here some more text [und undo])', getline(line('$') - 1))
139 set nomodified 139 set nomodified
140 imapclear 140 imapclear
141 endfunc 141 endfunc
142 142
143 func Test_map_cursor_ctrl_gU()
144 " <c-g>U<cursor> works only within a single line
145 nnoremap c<* *Ncgn<C-r>"<C-G>U<S-Left>
146 call setline(1, ['foo', 'foobar', '', 'foo'])
147 call cursor(1,2)
148 call feedkeys("c<*PREFIX\<esc>.", 'xt')
149 call assert_equal(['PREFIXfoo', 'foobar', '', 'PREFIXfoo'], getline(1,'$'))
150 " break undo manually
151 set ul=1000
152 exe ":norm! uu"
153 call assert_equal(['foo', 'foobar', '', 'foo'], getline(1,'$'))
154
155 " Test that it does not work if the cursor moves to the previous line
156 " 2 times <S-Left> move to the previous line
157 nnoremap c<* *Ncgn<C-r>"<C-G>U<S-Left><C-G>U<S-Left>
158 call setline(1, ['', ' foo', 'foobar', '', 'foo'])
159 call cursor(2,3)
160 call feedkeys("c<*PREFIX\<esc>.", 'xt')
161 call assert_equal(['PREFIXPREFIX', ' foo', 'foobar', '', 'foo'], getline(1,'$'))
162 nmapclear
163 endfunc
164
165
143 " This isn't actually testing a mapping, but similar use of CTRL-G U as above. 166 " This isn't actually testing a mapping, but similar use of CTRL-G U as above.
144 func Test_break_undo() 167 func Test_break_undo()
145 :set whichwrap=<,>,[,] 168 set whichwrap=<,>,[,]
146 call feedkeys("G4o2k", "xt") 169 call feedkeys("G4o2k", "xt")
147 exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>." 170 exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>."
148 call assert_equal('new line here', getline(line('$') - 3)) 171 call assert_equal('new line here', getline(line('$') - 3))
149 call assert_equal('Test3: text with a (parenthesis here', getline(line('$') - 2)) 172 call assert_equal('Test3: text with a (parenthesis here', getline(line('$') - 2))
150 call assert_equal('new line here', getline(line('$') - 1)) 173 call assert_equal('new line here', getline(line('$') - 1))