To: vim_dev@googlegroups.com Subject: Patch 8.1.2390 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2390 Problem: Test94 is old style, fix 7.4.441 not tested. Solution: Turn test94 into a new style test. Add tests for the fix in patch 7.4.441. (Yegappan Lakshmanan, closes #5316) Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, src/testdir/test94.in, src/testdir/test94.ok, src/testdir/test_cmdline.vim, src/testdir/test_visual.vim *** ../vim-8.1.2389/src/Makefile 2019-12-03 22:59:16.806149358 +0100 --- src/Makefile 2019-12-05 18:12:17.275273969 +0100 *************** *** 2257,2263 **** test64 test69 \ test70 test72 \ test86 test87 test88 \ ! test94 test95 test99: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) # Run individual NEW style test. --- 2259,2265 ---- test64 test69 \ test70 test72 \ test86 test87 test88 \ ! test95 test99: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) # Run individual NEW style test. *** ../vim-8.1.2389/src/testdir/Make_all.mak 2019-12-03 22:59:16.806149358 +0100 --- src/testdir/Make_all.mak 2019-12-05 18:12:17.275273969 +0100 *************** *** 20,26 **** test69.out \ test70.out \ test88.out \ - test94.out \ test95.out \ test99.out \ test_eval.out --- 20,25 ---- *** ../vim-8.1.2389/src/testdir/Make_vms.mms 2019-12-03 22:59:16.806149358 +0100 --- src/testdir/Make_vms.mms 2019-12-05 18:12:17.275273969 +0100 *************** *** 78,84 **** test42.out test44.out test49.out \ test64.out test69.out \ test72.out test77a.out test88.out \ ! test94.out test95.out test99.out \ test_eval.out # Known problems: --- 78,84 ---- test42.out test44.out test49.out \ test64.out test69.out \ test72.out test77a.out test88.out \ ! test95.out test99.out \ test_eval.out # Known problems: *** ../vim-8.1.2389/src/testdir/test94.in 2017-03-08 22:48:59.000000000 +0100 --- src/testdir/test94.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,257 **** - Test for Visual mode and operators - - Tests for the two kinds of operations: Those executed with Visual mode - followed by an operator and those executed via Operator-pending mode. Also - part of the test are mappings, counts, and repetition with the . command. - - Test cases: - - Visual modes (v V CTRL-V) followed by an operator; count; repeating - - Visual mode maps; count; repeating - - Simple - - With an Ex command (custom text object) - - Operator-pending mode maps - - Simple - - With Ex command moving the cursor - - With Ex command and Visual selection (custom text object) - - Patch 7.3.879: Properly abort Ex command in Operator-pending mode - - STARTTEST - :so small.vim - :set belloff=all - :set enc=utf-8 nocp viminfo+=nviminfo - : - :" User functions - :function MoveToCap() - : call search('\u', 'W') - :endfunction - :function SelectInCaps() - : let [line1, col1] = searchpos('\u', 'bcnW') - : let [line2, col2] = searchpos('.\u', 'nW') - : call setpos("'<", [0, line1, col1, 0]) - : call setpos("'>", [0, line2, col2, 0]) - : normal! gv - :endfunction - : - :" Visual modes followed by operator - /^apple - lvld.l3vd.: - /^line 1 - Vcnewlinej.j2Vd.: - /^xxxx - jlc l.l2c----l.: - : - :" Visual mode maps (movement and text object) - :vnoremap W /\u/s-1 - :vnoremap iW :call SelectInCaps() - /^Kiwi - vWcNol.fD2vd.: - /^Jambu - llviWc-l.l2vdl.: - : - :" Operator-pending mode maps (movement and text object) - :onoremap W /\u/ - :onoremap W :call MoveToCap() - :onoremap iW :call SelectInCaps() - /^Pineapple - cW-l.l2.l.: - /^Juniper - g?\WfD.: - /^Lemon - yiWPlciWNewfr.: - : - :" Patch 7.3.879: Properly abort Operator-pending mode for "dv:" etc. - /^zzzz - dV: dv: :set noma | let v:errmsg = '' - d: :set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed' - dv:dV::set noma | let v:errmsg = '' - d::set ma | put = v:errmsg =~# '^E21' ? 'failed' : 'ok' - : - :$put ='' - :$put ='characterwise visual mode: replace last line' - :$put ='a' - :let @" = 'x' - :let v:errmsg = '' - v$p - :$put ='---' - :$put ='v:errmsg='.v:errmsg - : - :$put ='' - :$put ='characterwise visual mode: delete middle line' - :$put ='a' - :$put ='b' - :$put ='c' - kkv$d - :$put ='---' - : - :$put ='' - :$put ='characterwise visual mode: delete middle two line' - :$put ='a' - :$put ='b' - :$put ='c' - kkvj$d - :$put ='---' - : - :$put ='' - :$put ='characterwise visual mode: delete last line' - :$put ='a' - :$put ='b' - :$put ='c' - v$d - :$put ='---' - : - :$put ='' - :$put ='characterwise visual mode: delete last two line' - :$put ='a' - :$put ='b' - :$put ='c' - kvj$d - :$put ='---' - : - :" Select mode maps - :snoremap End> - :snoremap Down> - :snoremap Del> - : - :$put ='' - :$put ='characterwise select mode: delete middle line' - :$put ='a' - :$put ='b' - :$put ='c' - kkgh - :$put ='---' - : - :$put ='' - :$put ='characterwise select mode: delete middle two line' - :$put ='a' - :$put ='b' - :$put ='c' - kkgh - :$put ='---' - : - :$put ='' - :$put ='characterwise select mode: delete last line' - :$put ='a' - :$put ='b' - :$put ='c' - gh - :$put ='---' - : - :$put ='' - :$put ='characterwise select mode: delete last two line' - :$put ='a' - :$put ='b' - :$put ='c' - kgh - :$put ='---' - : - :$put ='' - :$put ='linewise select mode: delete middle line' - :$put ='a' - :$put ='b' - :$put ='c' - kkgH - :$put ='---' - : - :$put ='' - :$put ='linewise select mode: delete middle two line' - :$put ='a' - :$put ='b' - :$put ='c' - kkgH - :$put ='---' - : - :$put ='' - :$put ='linewise select mode: delete last line' - :$put ='a' - :$put ='b' - :$put ='c' - gH - :$put ='---' - : - :$put ='' - :$put ='linewise select mode: delete last two line' - :$put ='a' - :$put ='b' - :$put ='c' - kgH - :$put ='---' - : - :$put ='' - :$put ='v_p: replace last character with line register at middle line' - :$put ='aaa' - :$put ='bbb' - :$put ='ccc' - :-2yank - k$vp - :$put ='---' - : - :$put ='' - :$put ='v_p: replace last character with line register at middle line selecting newline' - :$put ='aaa' - :$put ='bbb' - :$put ='ccc' - :-2yank - k$v$p - :$put ='---' - : - :$put ='' - :$put ='v_p: replace last character with line register at last line' - :$put ='aaa' - :$put ='bbb' - :$put ='ccc' - :-2yank - $vp - :$put ='---' - : - :$put ='' - :$put ='v_p: replace last character with line register at last line selecting newline' - :$put ='aaa' - :$put ='bbb' - :$put ='ccc' - :-2yank - $v$p - :$put ='---' - : - :$put ='' - :$put ='gv in exclusive select mode after operation' - :$put ='zzz ' - :$put ='äà ' - :set selection=exclusive - kv3lyjv3lpgvcxxx - :$put ='---' - : - :$put ='' - :$put ='gv in exclusive select mode without operation' - :$put ='zzz ' - :set selection=exclusive - 0v3lgvcxxx - :$put ='---' - :/^start:/+2,$w! test.out - :q! - ENDTEST - - start: - - apple banana cherry - - line 1 line 1 - line 2 line 2 - line 3 line 3 - line 4 line 4 - line 5 line 5 - line 6 line 6 - - xxxxxxxxxxxxx - xxxxxxxxxxxxx - xxxxxxxxxxxxx - xxxxxxxxxxxxx - - KiwiRaspberryDateWatermelonPeach - JambuRambutanBananaTangerineMango - - PineappleQuinceLoganberryOrangeGrapefruitKiwiZ - JuniperDurianZ - LemonNectarineZ - - zzzz - zzzz --- 0 ---- *** ../vim-8.1.2389/src/testdir/test94.ok 2015-11-19 19:59:32.000000000 +0100 --- src/testdir/test94.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,123 **** - a y - - newline - newline - - --------x - --------x - xxxx--------x - xxxx--------x - - NoNoberryach - --ago - - ----Z - WhavcreQhevnaZ - LemonNewNewZ - - zzz - ok - ok - - characterwise visual mode: replace last line - x - --- - v:errmsg= - - characterwise visual mode: delete middle line - b - c - --- - - characterwise visual mode: delete middle two line - c - --- - - characterwise visual mode: delete last line - a - b - - --- - - characterwise visual mode: delete last two line - a - - --- - - characterwise select mode: delete middle line - b - c - --- - - characterwise select mode: delete middle two line - c - --- - - characterwise select mode: delete last line - a - b - - --- - - characterwise select mode: delete last two line - a - - --- - - linewise select mode: delete middle line - b - c - --- - - linewise select mode: delete middle two line - c - --- - - linewise select mode: delete last line - a - b - --- - - linewise select mode: delete last two line - a - --- - - v_p: replace last character with line register at middle line - aaa - bb - aaa - - ccc - --- - - v_p: replace last character with line register at middle line selecting newline - aaa - bb - aaa - ccc - --- - - v_p: replace last character with line register at last line - aaa - bbb - cc - aaa - - --- - - v_p: replace last character with line register at last line selecting newline - aaa - bbb - cc - aaa - - --- - - gv in exclusive select mode after operation - zzz - xxx - --- - - gv in exclusive select mode without operation - xxx - --- --- 0 ---- *** ../vim-8.1.2389/src/testdir/test_cmdline.vim 2019-12-04 15:11:02.713868713 +0100 --- src/testdir/test_cmdline.vim 2019-12-05 18:12:17.275273969 +0100 *************** *** 848,850 **** --- 848,873 ---- " This should not generate E488 call feedkeys("q:\", 'x') endfunc + + " Tests for the issues fixed in 7.4.441. + " When 'cedit' is set to Ctrl-C, opening the command window hangs Vim + func Test_cmdwin_cedit() + exe "set cedit=\" + normal! : + call assert_equal(1, winnr('$')) + + let g:cmd_wintype = '' + func CmdWinType() + let g:cmd_wintype = getcmdwintype() + return '' + endfunc + + call feedkeys("\a\=CmdWinType()\\") + echo input('') + call assert_equal('@', g:cmd_wintype) + + set cedit&vim + delfunc CmdWinType + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.1.2389/src/testdir/test_visual.vim 2019-12-01 18:16:14.553582042 +0100 --- src/testdir/test_visual.vim 2019-12-05 18:12:17.275273969 +0100 *************** *** 442,445 **** --- 442,743 ---- enew! endfunc + " Visual modes (v V CTRL-V) followed by an operator; count; repeating + func Test_visual_mode_op() + new + call append(0, '') + + call setline(1, 'apple banana cherry') + call cursor(1, 1) + normal lvld.l3vd. + call assert_equal('a y', getline(1)) + + call setline(1, ['line 1 line 1', 'line 2 line 2', 'line 3 line 3', + \ 'line 4 line 4', 'line 5 line 5', 'line 6 line 6']) + call cursor(1, 1) + exe "normal Vcnewline\j.j2Vd." + call assert_equal(['newline', 'newline'], getline(1, '$')) + + call deletebufline('', 1, '$') + call setline(1, ['xxxxxxxxxxxxx', 'xxxxxxxxxxxxx', 'xxxxxxxxxxxxx', + \ 'xxxxxxxxxxxxx']) + exe "normal \jlc \l.l2\c----\l." + call assert_equal([' --------x', + \ ' --------x', + \ 'xxxx--------x', + \ 'xxxx--------x'], getline(1, '$')) + + bwipe! + endfunc + + " Visual mode maps (movement and text object) + " Visual mode maps; count; repeating + " - Simple + " - With an Ex command (custom text object) + func Test_visual_mode_maps() + new + call append(0, '') + + func SelectInCaps() + let [line1, col1] = searchpos('\u', 'bcnW') + let [line2, col2] = searchpos('.\u', 'nW') + call setpos("'<", [0, line1, col1, 0]) + call setpos("'>", [0, line2, col2, 0]) + normal! gv + endfunction + + vnoremap W /\u/s-1 + vnoremap iW :call SelectInCaps() + + call setline(1, 'KiwiRaspberryDateWatermelonPeach') + call cursor(1, 1) + exe "normal vWcNo\l.fD2vd." + call assert_equal('NoNoberryach', getline(1)) + + call setline(1, 'JambuRambutanBananaTangerineMango') + call cursor(1, 1) + exe "normal llviWc-\l.l2vdl." + call assert_equal('--ago', getline(1)) + + vunmap W + vunmap iW + bwipe! + delfunc SelectInCaps + endfunc + + " Operator-pending mode maps (movement and text object) + " - Simple + " - With Ex command moving the cursor + " - With Ex command and Visual selection (custom text object) + func Test_visual_oper_pending_mode_maps() + new + call append(0, '') + + func MoveToCap() + call search('\u', 'W') + endfunction + + func SelectInCaps() + let [line1, col1] = searchpos('\u', 'bcnW') + let [line2, col2] = searchpos('.\u', 'nW') + call setpos("'<", [0, line1, col1, 0]) + call setpos("'>", [0, line2, col2, 0]) + normal! gv + endfunction + + onoremap W /\u/ + onoremap W :call MoveToCap() + onoremap iW :call SelectInCaps() + + call setline(1, 'PineappleQuinceLoganberryOrangeGrapefruitKiwiZ') + call cursor(1, 1) + exe "normal cW-\l.l2.l." + call assert_equal('----Z', getline(1)) + + call setline(1, 'JuniperDurianZ') + call cursor(1, 1) + exe "normal g?\WfD." + call assert_equal('WhavcreQhevnaZ', getline(1)) + + call setline(1, 'LemonNectarineZ') + call cursor(1, 1) + exe "normal yiWPlciWNew\fr." + call assert_equal('LemonNewNewZ', getline(1)) + + ounmap W + ounmap W + ounmap iW + bwipe! + delfunc MoveToCap + delfunc SelectInCaps + endfunc + + " Patch 7.3.879: Properly abort Operator-pending mode for "dv:" etc. + func Test_op_pend_mode_abort() + new + call append(0, '') + + call setline(1, ['zzzz', 'zzzz']) + call cursor(1, 1) + + exe "normal dV:\dv:\" + call assert_equal(['zzz'], getline(1, 2)) + set nomodifiable + call assert_fails('exe "normal d:\"', 'E21:') + set modifiable + call feedkeys("dv:\dV:\", 'xt') + call assert_equal(['zzz'], getline(1, 2)) + set nomodifiable + let v:errmsg = '' + call feedkeys("d:\", 'xt') + call assert_true(v:errmsg !~# '^E21:') + set modifiable + + bwipe! + endfunc + + func Test_characterwise_visual_mode() + new + + " characterwise visual mode: replace last line + $put ='a' + let @" = 'x' + normal v$p + call assert_equal('x', getline('$')) + + " characterwise visual mode: delete middle line + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + normal G + normal kkv$d + call assert_equal(['', 'b', 'c'], getline(1, '$')) + + " characterwise visual mode: delete middle two lines + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + normal Gkkvj$d + call assert_equal(['', 'c'], getline(1, '$')) + + " characterwise visual mode: delete last line + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + normal Gv$d + call assert_equal(['', 'a', 'b', ''], getline(1, '$')) + + " characterwise visual mode: delete last two lines + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + normal Gkvj$d + call assert_equal(['', 'a', ''], getline(1, '$')) + + bwipe! + endfunc + + func Test_characterwise_select_mode() + new + + " Select mode maps + snoremap End> + snoremap Down> + snoremap Del> + + " characterwise select mode: delete middle line + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + exe "normal Gkkgh\\" + call assert_equal(['', 'b', 'c'], getline(1, '$')) + + " characterwise select mode: delete middle two lines + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + exe "normal Gkkgh\\\" + call assert_equal(['', 'c'], getline(1, '$')) + + " characterwise select mode: delete last line + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + exe "normal Ggh\\" + call assert_equal(['', 'a', 'b', ''], getline(1, '$')) + + " characterwise select mode: delete last two lines + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + exe "normal Gkgh\\\" + call assert_equal(['', 'a', ''], getline(1, '$')) + + sunmap End> + sunmap Down> + sunmap Del> + bwipe! + endfunc + + func Test_linewise_select_mode() + new + + " linewise select mode: delete middle line + call append('$', ['a', 'b', 'c']) + exe "normal GkkgH\" + call assert_equal(['', 'b', 'c'], getline(1, '$')) + + + " linewise select mode: delete middle two lines + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + exe "normal GkkgH\\" + call assert_equal(['', 'c'], getline(1, '$')) + + " linewise select mode: delete last line + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + exe "normal GgH\" + call assert_equal(['', 'a', 'b'], getline(1, '$')) + + " linewise select mode: delete last two lines + call deletebufline('', 1, '$') + call append('$', ['a', 'b', 'c']) + exe "normal GkgH\\" + call assert_equal(['', 'a'], getline(1, '$')) + + bwipe! + endfunc + + func Test_visual_mode_put() + new + + " v_p: replace last character with line register at middle line + call append('$', ['aaa', 'bbb', 'ccc']) + normal G + -2yank + normal k$vp + call assert_equal(['', 'aaa', 'bb', 'aaa', '', 'ccc'], getline(1, '$')) + + " v_p: replace last character with line register at middle line selecting + " newline + call deletebufline('', 1, '$') + call append('$', ['aaa', 'bbb', 'ccc']) + normal G + -2yank + normal k$v$p + call assert_equal(['', 'aaa', 'bb', 'aaa', 'ccc'], getline(1, '$')) + + " v_p: replace last character with line register at last line + call deletebufline('', 1, '$') + call append('$', ['aaa', 'bbb', 'ccc']) + normal G + -2yank + normal $vp + call assert_equal(['', 'aaa', 'bbb', 'cc', 'aaa', ''], getline(1, '$')) + + " v_p: replace last character with line register at last line selecting + " newline + call deletebufline('', 1, '$') + call append('$', ['aaa', 'bbb', 'ccc']) + normal G + -2yank + normal $v$p + call assert_equal(['', 'aaa', 'bbb', 'cc', 'aaa', ''], getline(1, '$')) + + bwipe! + endfunc + + func Test_select_mode_gv() + new + + " gv in exclusive select mode after operation + call append('$', ['zzz ', 'äà ']) + set selection=exclusive + normal Gkv3lyjv3lpgvcxxx + call assert_equal(['', 'zzz ', 'xxx '], getline(1, '$')) + + " gv in exclusive select mode without operation + call deletebufline('', 1, '$') + call append('$', 'zzz ') + set selection=exclusive + exe "normal G0v3l\gvcxxx" + call assert_equal(['', 'xxx '], getline(1, '$')) + + set selection&vim + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.1.2389/src/version.c 2019-12-04 22:16:47.588118837 +0100 --- src/version.c 2019-12-05 18:14:15.242759587 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 2390, /**/ -- hundred-and-one symptoms of being an internet addict: 192. Your boss asks you to "go fer" coffee and you come up with 235 FTP sites. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///