To: vim_dev@googlegroups.com Subject: Patch 9.0.1626 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1626 Problem: Visual area not shown when using 'showbreak' and start of line is not visible. (Jaehwang Jung) Solution: Adjust "fromcol" for the space taken by 'showbreak'. (closes #12514) Files: src/drawline.c, src/testdir/test_highlight.vim, src/testdir/dumps/Test_visual_sbr_1.dump *** ../vim-9.0.1625/src/drawline.c 2023-06-04 18:46:25.158494677 +0100 --- src/drawline.c 2023-06-10 19:39:17.117383542 +0100 *************** *** 569,574 **** --- 569,579 ---- if (wp->w_skipcol == 0 || wlv->startrow != 0 || !wp->w_p_wrap) wlv->need_showbreak = FALSE; wlv->vcol_sbr = wlv->vcol + MB_CHARLEN(sbr); + + // Correct start of highlighted area for 'showbreak'. + if (wlv->fromcol >= wlv->vcol && wlv->fromcol < wlv->vcol_sbr) + wlv->fromcol = wlv->vcol_sbr; + // Correct end of highlighted area for 'showbreak', // required when 'linebreak' is also set. if (wlv->tocol == wlv->vcol) *************** *** 829,835 **** if (wp->w_p_nu && wp->w_p_rnu) // Do not overwrite the line number, change "123 text" to ! // "123>>>xt". while (skip < wp->w_width && VIM_ISDIGIT(ScreenLines[off])) { ++off; --- 834,840 ---- if (wp->w_p_nu && wp->w_p_rnu) // Do not overwrite the line number, change "123 text" to ! // "123<<w_width && VIM_ISDIGIT(ScreenLines[off])) { ++off; *** ../vim-9.0.1625/src/testdir/test_highlight.vim 2023-03-04 19:57:28.342671183 +0000 --- src/testdir/test_highlight.vim 2023-06-10 19:35:52.218212318 +0100 *************** *** 753,758 **** --- 753,778 ---- call StopVimInTerminal(buf) endfunc + func Test_visual_sbr() + CheckScreendump + + " check Visual highlight when 'showbreak' is set + let lines =<< trim END + set showbreak=> + call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.') + exe "normal! z1\" + END + call writefile(lines, 'Xtest_visual_sbr', 'D') + let buf = RunVimInTerminal('-S Xtest_visual_sbr', {'rows': 6,'columns': 60}) + + call term_sendkeys(buf, "v$") + call VerifyScreenDump(buf, 'Test_visual_sbr_1', {}) + + " clean up + call term_sendkeys(buf, "\") + call StopVimInTerminal(buf) + endfunc + " This test must come before the Test_cursorline test, as it appears this " defines the Normal highlighting group anyway. func Test_1_highlight_Normalgroup_exists() *** ../vim-9.0.1625/src/testdir/dumps/Test_visual_sbr_1.dump 2023-06-10 19:39:56.713239842 +0100 --- src/testdir/dumps/Test_visual_sbr_1.dump 2023-06-10 19:37:27.509807290 +0100 *************** *** 0 **** --- 1,6 ---- + |>+0#4040ff13#ffffff0| +0#0000000#e0e0e08|k|a|s|d| |g|u|b|e|r|g|r|e|n|,| |n|o| |s|e|a| |t|a|k|i|m|a|t|a| |s|a|n|c|t|u|s| |e|s|t| |L|o|r|e|m| |i|p|s|u|m| |d|o|l|o|r| |s|i|t| |a|m|e|t|.> +0&#ffffff0@1 + @75 + @75 + @75 + @75 + |-+2&&@1| |V|I|S|U|A|L| |-@1| +0&&@34|2|9|6| @6|1|,|2|9|6|-|2|9@1| @4|A|l@1| *** ../vim-9.0.1625/src/version.c 2023-06-10 19:00:08.457416167 +0100 --- src/version.c 2023-06-10 19:31:29.191571628 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1626, /**/ -- We are the Borg of GNU GPL. We will assimilate your source code. Resistance is futile. /// 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 ///