" Tests for diff modefunc Test_diff_fold_sync()enew!let l = range(50)call setline(1, l)diffthislet winone = win_getid()newlet l[25] = 'diff'call setline(1, l)diffthislet wintwo = win_getid()" line 15 is inside the closed foldcall assert_equal(19, foldclosedend(10))call win_gotoid(winone)call assert_equal(19, foldclosedend(10))" open the foldnormal zvcall assert_equal(-1, foldclosedend(10))" fold in other window must have opened toocall win_gotoid(wintwo)call assert_equal(-1, foldclosedend(10))" cursor position is in syncnormal 23Gcall win_gotoid(winone)call assert_equal(23, getcurpos()[1])windo diffoffclose!set nomodifiedendfuncfunc Test_vert_split()" Disable the title to avoid xterm keeping the wrong one.set notitle noiconnewlet l = ['1 aa', '2 bb', '3 cc', '4 dd', '5 ee']call setline(1, l)w! Xtestnormal dd$putnormal kkrXoxxxw! Xtest2file Nopnormal ggoyyyjjjozzzzset foldmethod=marker foldcolumn=4call 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 Xtestvert diffsplit Xtest2call 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 = &fdmlet diff_fdc = &fdc" repeat entering diff mode here to see if this saves the wrong settingsdiffthis" jump to second window for a moment to have filler line appear at start of" first windowwincmd wnormal ggwincmd pnormal ggcall assert_equal(2, winline())normal jcall assert_equal(4, winline())normal jcall assert_equal(5, winline())normal jcall assert_equal(6, winline())normal jcall assert_equal(8, winline())normal jcall assert_equal(9, winline())wincmd wnormal ggcall assert_equal(1, winline())normal jcall assert_equal(2, winline())normal jcall assert_equal(4, winline())normal jcall assert_equal(5, winline())normal jcall assert_equal(8, winline())wincmd wnormal ggcall assert_equal(2, winline())normal jcall assert_equal(3, winline())normal jcall assert_equal(4, winline())normal jcall assert_equal(5, winline())normal jcall assert_equal(6, winline())normal jcall assert_equal(7, winline())normal jcall assert_equal(8, winline())" Test diffoffdiffoff!1wincmd 2let &diff = 1let &fdm = diff_fdmlet &fdc = diff_fdc4wincmd wdiffoff!1wincmd wcall 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 wcall 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 wcall 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)call delete('Xtest')call delete('Xtest2')windo bw!endfuncfunc Test_filler_lines()" Test that diffing shows correct filler linesenew!put =range(4,10)1d _vnewput =range(1,10)1d _windo diffthiswincmd hcall assert_equal(1, line('w0'))unlet! diff_fdm diff_fdcwindo diffoffbwipe!enew!endfuncfunc Test_diffget_diffput()enew!let l = range(50)call setline(1, l)call assert_fails('diffget', 'E99:')diffthiscall assert_fails('diffget', 'E100:')newlet l[10] = 'one'let l[20] = 'two'let l[30] = 'three'let l[40] = 'four'call setline(1, l)diffthiscall assert_equal('one', getline(11))11diffgetcall assert_equal('10', getline(11))21diffputwincmd wcall assert_equal('two', getline(21))normal 31Gdocall assert_equal('three', getline(31))call assert_equal('40', getline(41))normal 41Gdpwincmd wcall assert_equal('40', getline(41))newdiffthiscall assert_fails('diffget', 'E101:')windo diffoffbwipe!bwipe!enew!endfuncfunc Test_diffoff()enew!call setline(1, ['Two', 'Three'])let normattr = screenattr(1, 1)diffthisbotright vert newcall setline(1, ['One', '', 'Two', 'Three'])diffthisredrawdiffoff!redrawcall assert_equal(normattr, screenattr(1, 1))bwipe!bwipe!endfuncfunc Test_setting_cursor()new Xtest1put =range(1,90)wqnew Xtest2put =range(1,100)wqtabe Xtest2$diffsp Xtest1tabclosecall delete('Xtest1')call delete('Xtest2')endfunc
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。