From 1666fe9dfe08201c92271b7a59fb2f96a20eb8db Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 30 Jul 2021 10:49:42 +0800 Subject: vim-patch:8.1.2029: cannot control 'cursorline' highlighting well Problem: Cannot control 'cursorline' highlighting well. Solution: Add "screenline". (Christian Brabandt, closes vim/vim#4933) https://github.com/vim/vim/commit/017ba07fa2cdc578245618717229444fd50c470d --- src/nvim/testdir/test_cursorline.vim | 94 +++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cursorline.vim b/src/nvim/testdir/test_cursorline.vim index 46fbd0cd64..49df94f906 100644 --- a/src/nvim/testdir/test_cursorline.vim +++ b/src/nvim/testdir/test_cursorline.vim @@ -1,7 +1,7 @@ " Test for cursorline and cursorlineopt -" -source view_util.vim + source check.vim +source screendump.vim function! s:screen_attr(lnum) abort return map(range(1, 8), 'screenattr(a:lnum, v:val)') @@ -106,3 +106,93 @@ func Test_cursorline_highlight2() exe 'hi' save_hi endtry endfunc + +func Test_cursorline_screenline() + CheckScreendump + CheckOption cursorlineopt + let filename='Xcursorline' + let lines = [] + + let file_content =<< trim END + 1 foooooooo ar eins‍zwei drei vier fünf sechs sieben acht un zehn elf zwöfl dreizehn v ierzehn fünfzehn + 2 foooooooo bar eins zwei drei vier fünf sechs sieben + 3 foooooooo bar eins zwei drei vier fünf sechs sieben + 4 foooooooo bar eins zwei drei vier fünf sechs sieben + END + let lines1 =<< trim END1 + set nocp + set display=lastline + set cursorlineopt=screenline cursorline nu wrap sbr=> + hi CursorLineNr ctermfg=blue + 25vsp + END1 + let lines2 =<< trim END2 + call cursor(1,1) + END2 + call extend(lines, lines1) + call extend(lines, ["call append(0, ".. string(file_content).. ')']) + call extend(lines, lines2) + call writefile(lines, filename) + " basic test + let buf = RunVimInTerminal('-S '. filename, #{rows: 20}) + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_1', {}) + call term_sendkeys(buf, "fagj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_2', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_3', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_4', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_5', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_6', {}) + " test with set list and cursorlineopt containing number + call term_sendkeys(buf, "gg0") + call term_sendkeys(buf, ":set list cursorlineopt+=number listchars=space:-\") + call VerifyScreenDump(buf, 'Test_'. filename. '_7', {}) + call term_sendkeys(buf, "fagj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_8', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_9', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_10', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_11', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_12', {}) + if exists("+foldcolumn") && exists("+signcolumn") && exists("+breakindent") + " test with set foldcolumn signcoloumn and breakindent + call term_sendkeys(buf, "gg0") + call term_sendkeys(buf, ":set breakindent foldcolumn=2 signcolumn=yes\") + call VerifyScreenDump(buf, 'Test_'. filename. '_13', {}) + call term_sendkeys(buf, "fagj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_14', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_15', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_16', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_17', {}) + call term_sendkeys(buf, "gj") + call term_wait(buf) + call VerifyScreenDump(buf, 'Test_'. filename. '_18', {}) + endif + + call StopVimInTerminal(buf) + call delete(filename) +endfunc -- cgit From 56b437a6c7a050921653a0d9e091777682db31ea Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 1 Aug 2021 07:09:51 +0800 Subject: vim-patch:8.1.2117: CursorLine highlight used while 'cursorline' is off Problem: CursorLine highlight used while 'cursorline' is off. Solution: Check 'cursorline' is set. (cloes vim/vim#5017) https://github.com/vim/vim/commit/49474ca12236776bb56aeb9d39bd6592e28157c7 --- src/nvim/testdir/test_cursorline.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cursorline.vim b/src/nvim/testdir/test_cursorline.vim index 49df94f906..d4a03afd38 100644 --- a/src/nvim/testdir/test_cursorline.vim +++ b/src/nvim/testdir/test_cursorline.vim @@ -52,7 +52,7 @@ func Test_cursorline_highlight1() setl nocursorline relativenumber redraw let attr31 = s:screen_attr(1) - call assert_equal(attr21[0:3], attr31[0:3]) + call assert_equal(attr22[0:3], attr31[0:3]) call assert_equal(attr11[4:7], attr31[4:7]) call s:close_windows() -- cgit From c24daf5a1013c629f82ba8d4a4de885d7986d982 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 2 Aug 2021 05:29:58 +0800 Subject: vim-patch:8.2.3204: display garbled when 'cursorline' is set and lines wrap Problem: Display garbled when 'cursorline' is set and lines wrap. (Gabriel Dupras) Solution: Avoid inserting lines twice. https://github.com/vim/vim/commit/c9e7e344ed390d2a22afb88001b6aa80832d2541 --- src/nvim/testdir/test_cursorline.vim | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_cursorline.vim b/src/nvim/testdir/test_cursorline.vim index d4a03afd38..4a0f2665fe 100644 --- a/src/nvim/testdir/test_cursorline.vim +++ b/src/nvim/testdir/test_cursorline.vim @@ -110,6 +110,7 @@ endfunc func Test_cursorline_screenline() CheckScreendump CheckOption cursorlineopt + let filename='Xcursorline' let lines = [] @@ -196,3 +197,53 @@ func Test_cursorline_screenline() call StopVimInTerminal(buf) call delete(filename) endfunc + +func Test_cursorline_redraw() + CheckScreendump + CheckOption cursorlineopt + + let textlines =<< END + When the option is a list of flags, {value} must be + exactly as they appear in the option. Remove flags + one by one to avoid problems. + Also see |:set-args| above. + +The {option} arguments to ":set" may be repeated. For example: > + :set ai nosi sw=3 ts=3 +If you make an error in one of the arguments, an error message will be given +and the following arguments will be ignored. + + *:set-verbose* +When 'verbose' is non-zero, displaying an option value will also tell where it +was last set. Example: > + :verbose set shiftwidth cindent? +< shiftwidth=4 ~ + Last set from modeline line 1 ~ + cindent ~ + Last set from /usr/local/share/vim/vim60/ftplugin/c.vim line 30 ~ +This is only done when specific option values are requested, not for ":verbose +set all" or ":verbose set" without an argument. +When the option was set by hand there is no "Last set" message. +When the option was set while executing a function, user command or +END + call writefile(textlines, 'Xtextfile') + + let script =<< trim END + set cursorline scrolloff=2 + normal 12G + END + call writefile(script, 'Xscript') + + let buf = RunVimInTerminal('-S Xscript Xtextfile', #{rows: 20, cols: 40}) + call VerifyScreenDump(buf, 'Test_cursorline_redraw_1', {}) + call term_sendkeys(buf, "zt") + call TermWait(buf) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_cursorline_redraw_2', {}) + + call StopVimInTerminal(buf) + call delete('Xscript') + call delete('Xtextfile') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit