To: vim_dev@googlegroups.com Subject: Patch 8.2.3204 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3204 Problem: Display garbled when 'cursorline' is set and lines wrap. (Gabriel Dupras) Solution: Avoid inserting lines twice. Files: src/drawscreen.c, src/testdir/test_cursorline.vim, src/testdir/dumps/Test_cursorline_redraw_1.dump, src/testdir/dumps/Test_cursorline_redraw_2.dump *** ../vim-8.2.3203/src/drawscreen.c 2021-07-09 15:53:57.220856706 +0200 --- src/drawscreen.c 2021-07-22 21:28:02.430027292 +0200 *************** *** 2249,2257 **** // up or down to minimize redrawing. // Don't do this when the change continues until the end. // Don't scroll when dollar_vcol >= 0, keep the "$". if (lnum == mod_top && mod_bot != MAXLNUM ! && !(dollar_vcol >= 0 && mod_bot == mod_top + 1)) { int old_rows = 0; int new_rows = 0; --- 2249,2259 ---- // up or down to minimize redrawing. // Don't do this when the change continues until the end. // Don't scroll when dollar_vcol >= 0, keep the "$". + // Don't scroll when redrawing the top, scrolled already above. if (lnum == mod_top && mod_bot != MAXLNUM ! && !(dollar_vcol >= 0 && mod_bot == mod_top + 1) ! && row >= top_end) { int old_rows = 0; int new_rows = 0; *** ../vim-8.2.3203/src/testdir/test_cursorline.vim 2020-08-12 18:50:31.875655822 +0200 --- src/testdir/test_cursorline.vim 2021-07-22 19:31:48.558376419 +0200 *************** *** 110,115 **** --- 110,116 ---- func Test_cursorline_screenline() CheckScreendump CheckOption cursorlineopt + let filename='Xcursorline' let lines = [] *************** *** 197,200 **** --- 198,249 ---- 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 *** ../vim-8.2.3203/src/testdir/dumps/Test_cursorline_redraw_1.dump 2021-07-22 21:32:12.873463755 +0200 --- src/testdir/dumps/Test_cursorline_redraw_1.dump 2021-07-22 21:30:21.849714819 +0200 *************** *** 0 **** --- 1,20 ---- + | +0&#ffffff0@23|o|n|e| |b|y| |o|n|e| |t|o| |a|v + |o|i|d| |p|r|o|b|l|e|m|s|.| @26 + @24|A|l|s|o| |s|e@1| |||:|s|e|t|-|a + |r|g|s||| |a|b|o|v|e|.| @28 + @40 + |T|h|e| |{|o|p|t|i|o|n|}| |a|r|g|u|m|e|n|t|s| |t|o| |"|:|s|e|t|"| |m|a|y| |b|e| + |r|e|p|e|a|t|e|d|.| @1|F|o|r| |e|x|a|m|p|l|e|:| |>| @14 + @8|:|s|e|t| |a|i| |n|o|s|i| |s|w|=|3| |t|s|=|3| @9 + |I|f| |y|o|u| |m|a|k|e| |a|n| |e|r@1|o|r| |i|n| |o|n|e| |o|f| |t|h|e| |a|r|g|u|m + |e|n|t|s|,| |a|n| |e|r@1|o|r| |m|e|s@1|a|g|e| |w|i|l@1| |b|e| |g|i|v|e|n| @3 + |a|n|d| |t|h|e| |f|o|l@1|o|w|i|n|g| |a|r|g|u|m|e|n|t|s| |w|i|l@1| |b|e| |i|g|n|o + |r|e|d|.| @35 + @40 + @40 + @16|*|:|s|e|t|-|v|e|r|b|o|s|e|*| @9 + >W+8&&|h|e|n| |'|v|e|r|b|o|s|e|'| |i|s| |n|o|n|-|z|e|r|o|,| |d|i|s|p|l|a|y|i|n|g| |a + |n| |o|p|t|i|o|n| |v|a|l|u|e| |w|i|l@1| |a|l|s|o| |t|e|l@1| |w|h|e|r|e| |i|t| @1 + |w+0&&|a|s| |l|a|s|t| |s|e|t|.| @1|E|x|a|m|p|l|e|:| |>| @14 + @8|:|v|e|r|b|o|s|e| |s|e|t| |s|h|i|f|t|w|i|d|t|h| |c|i|n|d|e|n|t|? + |<| |2@1|L|,| |9|4|2|B| @10|1|2|,|1| @9|2|0|%| *** ../vim-8.2.3203/src/testdir/dumps/Test_cursorline_redraw_2.dump 2021-07-22 21:32:12.877463744 +0200 --- src/testdir/dumps/Test_cursorline_redraw_2.dump 2021-07-22 21:30:23.005712215 +0200 *************** *** 0 **** --- 1,20 ---- + | +0&#ffffff0@39 + |T|h|e| |{|o|p|t|i|o|n|}| |a|r|g|u|m|e|n|t|s| |t|o| |"|:|s|e|t|"| |m|a|y| |b|e| + |r|e|p|e|a|t|e|d|.| @1|F|o|r| |e|x|a|m|p|l|e|:| |>| @14 + | +8&&@7>:|s|e|t| |a|i| |n|o|s|i| |s|w|=|3| |t|s|=|3| @9 + |I+0&&|f| |y|o|u| |m|a|k|e| |a|n| |e|r@1|o|r| |i|n| |o|n|e| |o|f| |t|h|e| |a|r|g|u|m + |e|n|t|s|,| |a|n| |e|r@1|o|r| |m|e|s@1|a|g|e| |w|i|l@1| |b|e| |g|i|v|e|n| @3 + |a|n|d| |t|h|e| |f|o|l@1|o|w|i|n|g| |a|r|g|u|m|e|n|t|s| |w|i|l@1| |b|e| |i|g|n|o + |r|e|d|.| @35 + @40 + @40 + @16|*|:|s|e|t|-|v|e|r|b|o|s|e|*| @9 + |W|h|e|n| |'|v|e|r|b|o|s|e|'| |i|s| |n|o|n|-|z|e|r|o|,| |d|i|s|p|l|a|y|i|n|g| |a + |n| |o|p|t|i|o|n| |v|a|l|u|e| |w|i|l@1| |a|l|s|o| |t|e|l@1| |w|h|e|r|e| |i|t| @1 + |w|a|s| |l|a|s|t| |s|e|t|.| @1|E|x|a|m|p|l|e|:| |>| @14 + @8|:|v|e|r|b|o|s|e| |s|e|t| |s|h|i|f|t|w|i|d|t|h| |c|i|n|d|e|n|t|? + |<| @1|s|h|i|f|t|w|i|d|t|h|=|4| |~| @22 + @10|L|a|s|t| |s|e|t| |f|r|o|m| |m|o|d|e|l|i|n|e| |l|i|n|e| |1| + |~| @38 + @2|c|i|n|d|e|n|t| |~| @28 + @22|7|,|2|-|9| @8|4@1|%| *** ../vim-8.2.3203/src/version.c 2021-07-22 19:11:05.340650359 +0200 --- src/version.c 2021-07-22 19:30:21.654516866 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3204, /**/ -- Your mouse has moved. Windows must be restarted for the change to take effect. Reboot now? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///