To: vim_dev@googlegroups.com Subject: Patch 8.1.2421 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2421 Problem: Test88 is old style. Solution: Turn into a new style test. (Yegappan Lakshmanan, closes #5347) Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, src/testdir/test88.in, src/testdir/test88.ok, src/testdir/test_conceal.vim, src/testdir/test_python2.vim src/testdir/test_python3.vim *** ../vim-8.1.2420/src/Makefile 2019-12-06 22:17:37.472828728 +0100 --- src/Makefile 2019-12-11 20:07:24.667567501 +0100 *************** *** 2257,2263 **** test52 test59 \ test64 test69 \ test70 test72 \ ! test86 test87 test88 \ test95 test99: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) --- 2257,2263 ---- test52 test59 \ test64 test69 \ test70 test72 \ ! test86 test87 \ test95 test99: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) *** ../vim-8.1.2420/src/testdir/Make_all.mak 2019-12-06 20:43:22.833354093 +0100 --- src/testdir/Make_all.mak 2019-12-11 20:07:24.671567487 +0100 *************** *** 18,24 **** test64.out \ test69.out \ test70.out \ - test88.out \ test95.out \ test99.out \ test_eval.out --- 18,23 ---- *** ../vim-8.1.2420/src/testdir/Make_vms.mms 2019-12-06 20:43:22.833354093 +0100 --- src/testdir/Make_vms.mms 2019-12-11 20:07:24.671567487 +0100 *************** *** 76,82 **** SCRIPT = test1.out \ test42.out test44.out test49.out \ test64.out test69.out \ ! test72.out test77a.out test88.out \ test95.out test99.out \ test_eval.out --- 76,82 ---- SCRIPT = test1.out \ test42.out test44.out test49.out \ test64.out test69.out \ ! test72.out test77a.out \ test95.out test99.out \ test_eval.out *** ../vim-8.1.2420/src/testdir/test88.in 2015-02-17 17:17:40.000000000 +0100 --- src/testdir/test88.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,99 **** - vim: set ft=vim - - Tests for correct display (cursor column position) with +conceal and - tabulators. - - STARTTEST - :so small.vim - :if !has('conceal') - e! test.ok - wq! test.out - :endif - :" Conceal settings. - :set conceallevel=2 - :set concealcursor=nc - :syntax match test /|/ conceal - :" Save current cursor position. Only works in mode, can't be used - :" with :normal because it moves the cursor to the command line. Thanks to ZyX - :" for the idea to use an mapping. - :let positions = [] - :nnoremap GG ":let positions += ['".screenrow().":".screencol()."']\n" - :" Start test. - /^start: - :normal ztj - GGk - :" We should end up in the same column when running these commands on the two - :" lines. - :normal ft - GGk - :normal $ - GGk - :normal 0j - GGk - :normal ft - GGk - :normal $ - GGk - :normal 0j0j - GGk - :" Same for next test block. - :normal ft - GGk - :normal $ - GGk - :normal 0j - GGk - :normal ft - GGk - :normal $ - GGk - :normal 0j0j - GGk - :" And check W with multiple tabs and conceals in a line. - :normal W - GGk - :normal W - GGk - :normal W - GGk - :normal $ - GGk - :normal 0j - GGk - :normal W - GGk - :normal W - GGk - :normal W - GGk - :normal $ - GGk - :set lbr - :normal $ - GGk - :set list listchars=tab:>- - :normal 0 - GGk - :normal W - GGk - :normal W - GGk - :normal W - GGk - :normal $ - GGk - :" Display result. - :call append('$', 'end:') - :call append('$', positions) - :/^end/,$wq! test.out - ENDTEST - - start: - .concealed. text - |concealed| text - - .concealed. text - |concealed| text - - .a. .b. .c. .d. - |a| |b| |c| |d| --- 0 ---- *** ../vim-8.1.2420/src/testdir/test88.ok 2015-02-17 17:17:40.000000000 +0100 --- src/testdir/test88.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,29 **** - end: - 2:1 - 2:17 - 2:20 - 3:1 - 3:17 - 3:20 - 5:8 - 5:25 - 5:28 - 6:8 - 6:25 - 6:28 - 8:1 - 8:9 - 8:17 - 8:25 - 8:27 - 9:1 - 9:9 - 9:17 - 9:25 - 9:26 - 9:26 - 9:1 - 9:9 - 9:17 - 9:25 - 9:26 --- 0 ---- *** ../vim-8.1.2420/src/testdir/test_conceal.vim 2019-09-14 21:55:29.850096848 +0200 --- src/testdir/test_conceal.vim 2019-12-11 20:07:24.671567487 +0100 *************** *** 1,5 **** " Tests for 'conceal'. - " Also see test88.in (should be converted to a test function here). source check.vim CheckFeature conceal --- 1,4 ---- *************** *** 155,157 **** --- 154,257 ---- call StopVimInTerminal(buf) call delete('XTest_conceal_resize') endfunc + + " Tests for correct display (cursor column position) with +conceal and + " tabulators. Need to run this test in a separate Vim instance. Otherwise the + " screen is not updated (lazy redraw) and the cursor position is wrong. + func Test_conceal_cursor_pos() + let code =<< trim [CODE] + :let l = ['start:', '.concealed. text', "|concealed|\ttext"] + :let l += ['', "\t.concealed.\ttext", "\t|concealed|\ttext", ''] + :let l += [".a.\t.b.\t.c.\t.d.", "|a|\t|b|\t|c|\t|d|"] + :call append(0, l) + :call cursor(1, 1) + :" Conceal settings. + :set conceallevel=2 + :set concealcursor=nc + :syntax match test /|/ conceal + :" Save current cursor position. Only works in mode, can't be used + :" with :normal because it moves the cursor to the command line. Thanks + :" to ZyX for the idea to use an mapping. + :let curpos = [] + :nnoremap GG ":let curpos += ['".screenrow().":".screencol()."']\n" + :normal ztj + GGk + :" We should end up in the same column when running these commands on the + :" two lines. + :normal ft + GGk + :normal $ + GGk + :normal 0j + GGk + :normal ft + GGk + :normal $ + GGk + :normal 0j0j + GGk + :" Same for next test block. + :normal ft + GGk + :normal $ + GGk + :normal 0j + GGk + :normal ft + GGk + :normal $ + GGk + :normal 0j0j + GGk + :" And check W with multiple tabs and conceals in a line. + :normal W + GGk + :normal W + GGk + :normal W + GGk + :normal $ + GGk + :normal 0j + GGk + :normal W + GGk + :normal W + GGk + :normal W + GGk + :normal $ + GGk + :set lbr + :normal $ + GGk + :set list listchars=tab:>- + :normal 0 + GGk + :normal W + GGk + :normal W + GGk + :normal W + GGk + :normal $ + GGk + :call writefile(curpos, 'Xconceal_curpos.out') + :q! + + [CODE] + call writefile(code, 'XTest_conceal_curpos') + + if RunVim([], [], '-s XTest_conceal_curpos') + call assert_equal([ + \ '2:1', '2:17', '2:20', '3:1', '3:17', '3:20', '5:8', '5:25', + \ '5:28', '6:8', '6:25', '6:28', '8:1', '8:9', '8:17', '8:25', + \ '8:27', '9:1', '9:9', '9:17', '9:25', '9:26', '9:26', '9:1', + \ '9:9', '9:17', '9:25', '9:26'], readfile('Xconceal_curpos.out')) + endif + + call delete('Xconceal_curpos.out') + call delete('XTest_conceal_curpos') + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.1.2420/src/testdir/test_python2.vim 2019-09-04 20:05:54.750532206 +0200 --- src/testdir/test_python2.vim 2019-12-11 20:10:03.951019324 +0100 *************** *** 1,5 **** " Test for python 2 commands. ! " TODO: move tests from test87.in here. source check.vim CheckFeature python --- 1,5 ---- " Test for python 2 commands. ! " TODO: move tests from test86.in here. source check.vim CheckFeature python *** ../vim-8.1.2420/src/testdir/test_python3.vim 2019-09-04 20:05:54.750532206 +0200 --- src/testdir/test_python3.vim 2019-12-11 20:10:33.134918791 +0100 *************** *** 1,5 **** " Test for python 3 commands. ! " TODO: move tests from test88.in here. source check.vim CheckFeature python3 --- 1,5 ---- " Test for python 3 commands. ! " TODO: move tests from test87.in here. source check.vim CheckFeature python3 *** ../vim-8.1.2420/src/version.c 2019-12-11 19:34:50.413898722 +0100 --- src/version.c 2019-12-11 20:08:50.679271617 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 2421, /**/ -- Vi is clearly superior to emacs, since "vi" has only two characters (and two keystrokes), while "emacs" has five. (Randy C. Ford) /// 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 ///