To: vim_dev@googlegroups.com Subject: Patch 7.4.2123 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2123 Problem: No new style test for diff mode. Solution: Add a test. Check that folds are in sync. Files: src/Makefile, src/testdir/test_diffmode.vim, src/testdir/Make_all.mak, src/testdir/test47.in, src/testdir/test47.ok *** ../vim-7.4.2122/src/Makefile 2016-07-29 18:13:29.132175672 +0200 --- src/Makefile 2016-07-30 16:13:00.860268878 +0200 *************** *** 2042,2048 **** test11 test12 test13 test14 test15 test16 test17 test18 test19 \ test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ test30 test31 test32 test33 test34 test36 test37 test38 test39 \ ! test40 test41 test42 test43 test44 test45 test46 test47 test48 test49 \ test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \ test60 test62 test63 test64 test65 test66 test67 test68 test69 \ test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \ --- 2042,2048 ---- test11 test12 test13 test14 test15 test16 test17 test18 test19 \ test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ test30 test31 test32 test33 test34 test36 test37 test38 test39 \ ! test40 test41 test42 test43 test44 test45 test46 test48 test49 \ test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \ test60 test62 test63 test64 test65 test66 test67 test68 test69 \ test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \ *************** *** 2064,2069 **** --- 2064,2070 ---- test_cscope \ test_cursor_func \ test_delete \ + test_diffmode \ test_digraph \ test_ex_undo \ test_execute_func \ *** ../vim-7.4.2122/src/testdir/test_diffmode.vim 2016-07-30 16:15:41.826727869 +0200 --- src/testdir/test_diffmode.vim 2016-07-30 16:11:56.780882692 +0200 *************** *** 0 **** --- 1,165 ---- + " Tests for diff mode + + func Test_diff_fold_sync() + enew! + let l = range(50) + call setline(1, l) + diffthis + let winone = win_getid() + new + let l[25] = 'diff' + call setline(1, l) + diffthis + let wintwo = win_getid() + " line 15 is inside the closed fold + call assert_equal(19, foldclosedend(10)) + call win_gotoid(winone) + call assert_equal(19, foldclosedend(10)) + " open the fold + normal zv + call assert_equal(-1, foldclosedend(10)) + " fold in other window must have opened too + call win_gotoid(wintwo) + call assert_equal(-1, foldclosedend(10)) + + " cursor position is in sync + normal 23G + call win_gotoid(winone) + call assert_equal(23, getcurpos()[1]) + + windo diffoff + close! + set nomodified + endfunc + + func Test_vert_split() + " Disable the title to avoid xterm keeping the wrong one. + set notitle noicon + new + let l = ['1 aa', '2 bb', '3 cc', '4 dd', '5 ee'] + call setline(1, l) + w! Xtest + normal dd + $ + put + normal kkrXoxxx + w! Xtest2 + file Nop + normal ggoyyyjjjozzzz + set foldmethod=marker foldcolumn=4 + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + vert diffsplit Xtest + vert diffsplit Xtest2 + call assert_equal(1, &diff) + call assert_equal('diff', &foldmethod) + call assert_equal(2, &foldcolumn) + call assert_equal(1, &scrollbind) + call assert_equal(1, &cursorbind) + call assert_equal(0, &wrap) + + let diff_fdm = &fdm + let diff_fdc = &fdc + " repeat entering diff mode here to see if this saves the wrong settings + diffthis + " jump to second window for a moment to have filler line appear at start of + " first window + wincmd w + normal gg + wincmd p + normal gg + call assert_equal(2, winline()) + normal j + call assert_equal(4, winline()) + normal j + call assert_equal(5, winline()) + normal j + call assert_equal(6, winline()) + normal j + call assert_equal(8, winline()) + normal j + call assert_equal(9, winline()) + + wincmd w + normal gg + call assert_equal(1, winline()) + normal j + call assert_equal(2, winline()) + normal j + call assert_equal(4, winline()) + normal j + call assert_equal(5, winline()) + normal j + call assert_equal(8, winline()) + + wincmd w + normal gg + call assert_equal(2, winline()) + normal j + call assert_equal(3, winline()) + normal j + call assert_equal(4, winline()) + normal j + call assert_equal(5, winline()) + normal j + call assert_equal(6, winline()) + normal j + call assert_equal(7, winline()) + normal j + call assert_equal(8, winline()) + + " Test diffoff + diffoff! + 1wincmd 2 + let &diff = 1 + let &fdm = diff_fdm + let &fdc = diff_fdc + 4wincmd w + diffoff! + 1wincmd w + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + wincmd w + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + wincmd w + call assert_equal(0, &diff) + call assert_equal('marker', &foldmethod) + call assert_equal(4, &foldcolumn) + call assert_equal(0, &scrollbind) + call assert_equal(0, &cursorbind) + call assert_equal(1, &wrap) + + windo bw! + endfunc + + func Test_filler_lines() + " Test that diffing shows correct filler lines + enew! + put =range(4,10) + 1d _ + vnew + put =range(1,10) + 1d _ + windo diffthis + wincmd h + call assert_equal(1, line('w0')) + unlet! diff_fdm diff_fdc + + windo bw! + endfunc *** ../vim-7.4.2122/src/testdir/Make_all.mak 2016-07-29 18:13:29.136175634 +0200 --- src/testdir/Make_all.mak 2016-07-30 15:22:22.149043091 +0200 *************** *** 43,49 **** test44.out \ test45.out \ test46.out \ - test47.out \ test48.out \ test51.out \ test53.out \ --- 43,48 ---- *************** *** 168,173 **** --- 167,173 ---- test_channel.res \ test_cmdline.res \ test_cscope.res \ + test_diffmode.res \ test_digraph.res \ test_farsi.res \ test_gn.res \ *** ../vim-7.4.2122/src/testdir/test47.in 2015-07-28 14:42:41.177971415 +0200 --- src/testdir/test47.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,103 **** - Tests for vertical splits and filler lines in diff mode - - Also tests restoration of saved options by :diffoff. - - STARTTEST - :so small.vim - :" Disable the title to avoid xterm keeping the wrong one. - :set notitle noicon - /^1 - yG:new - pkdd:w! Xtest - ddGpkkrXoxxx:w! Xtest2 - :file Nop - ggoyyyjjjozzzz - :set foldmethod=marker foldcolumn=4 - :redir => nodiffsettings - :silent! :set diff? fdm? fdc? scb? crb? wrap? - :redir END - :vert diffsplit Xtest - :vert diffsplit Xtest2 - :redir => diffsettings - :silent! :set diff? fdm? fdc? scb? crb? wrap? - :redir END - :let diff_fdm = &fdm - :let diff_fdc = &fdc - :" repeat entering diff mode here to see if this saves the wrong settings - :diffthis - :" jump to second window for a moment to have filler line appear at start of - :" first window - ggpgg:let one = winline() - j:let one = one . "-" . winline() - j:let one = one . "-" . winline() - j:let one = one . "-" . winline() - j:let one = one . "-" . winline() - j:let one = one . "-" . winline() - gg:let two = winline() - j:let two = two . "-" . winline() - j:let two = two . "-" . winline() - j:let two = two . "-" . winline() - j:let two = two . "-" . winline() - gg:let three = winline() - j:let three = three . "-" . winline() - j:let three = three . "-" . winline() - j:let three = three . "-" . winline() - j:let three = three . "-" . winline() - j:let three = three . "-" . winline() - j:let three = three . "-" . winline() - :call append("$", one) - :call append("$", two) - :call append("$", three) - :$-2,$w! test.out - :" - :" Test diffoff - :diffoff! - 1 - :let &diff = 1 - :let &fdm = diff_fdm - :let &fdc = diff_fdc - 4 - :diffoff! - :$put =nodiffsettings - :$put =diffsettings - 1 - :redir => nd1 - :silent! :set diff? fdm? fdc? scb? crb? wrap? - :redir END -  - :redir => nd2 - :silent! :set diff? fdm? fdc? scb? crb? wrap? - :redir END -  - :redir => nd3 - :silent! :set diff? fdm? fdc? scb? crb? wrap? - :redir END -  - :$put =nd1 - :$put =nd2 - :$put =nd3 - :$-39,$w >> test.out - :" - :" Test that diffing shows correct filler lines - :windo :bw! - :enew - :put =range(4,10) - :1d _ - :vnew - :put =range(1,10) - :1d _ - :windo :diffthis - :wincmd h - :let w0=line('w0') - :enew - :put =w0 - :.w >> test.out - :unlet! one two three nodiffsettings diffsettings diff_fdm diff_fdc nd1 nd2 nd3 w0 - :qa! - ENDTEST - - 1 aa - 2 bb - 3 cc - 4 dd - 5 ee --- 0 ---- *** ../vim-7.4.2122/src/testdir/test47.ok 2015-07-04 15:05:08.606736259 +0200 --- src/testdir/test47.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,44 **** - 2-4-5-6-8-9 - 1-2-4-5-8 - 2-3-4-5-6-7-8 - - - nodiff - foldmethod=marker - foldcolumn=4 - noscrollbind - nocursorbind - wrap - - - diff - foldmethod=diff - foldcolumn=2 - scrollbind - cursorbind - nowrap - - - nodiff - foldmethod=marker - foldcolumn=4 - noscrollbind - nocursorbind - wrap - - - nodiff - foldmethod=marker - foldcolumn=4 - noscrollbind - nocursorbind - wrap - - - nodiff - foldmethod=marker - foldcolumn=4 - noscrollbind - nocursorbind - wrap - 1 --- 0 ---- *** ../vim-7.4.2122/src/version.c 2016-07-30 14:12:19.475812375 +0200 --- src/version.c 2016-07-30 16:13:30.495985067 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2123, /**/ -- Zen Microsystems: we're the om in .commmmmmmmm /// 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 ///