To: vim_dev@googlegroups.com Subject: Patch 9.0.1048 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1048 Problem: With "screenline" in 'culopt' cursorline highlight is wrong. Solution: Apply the priority logic also when "screenline is in 'culopt'. (closes #11696) Files: src/drawline.c, src/testdir/test_quickfix.vim, src/testdir/test_signs.vim, src/testdir/dumps/Test_quickfix_cwindow_3.dump, src/testdir/dumps/Test_quickfix_cwindow_4.dump *** ../vim-9.0.1047/src/drawline.c 2022-12-06 14:17:32.178527467 +0000 --- src/drawline.c 2022-12-12 13:16:08.474222084 +0000 *************** *** 985,990 **** --- 985,1020 ---- wlv->char_attr = wlv->win_attr; } + #ifdef FEAT_SYN_HL + static void + apply_cursorline_highlight( + winlinevars_T *wlv, + int sign_present UNUSED) + { + wlv->cul_attr = HL_ATTR(HLF_CUL); + # ifdef FEAT_SIGNS + // Combine the 'cursorline' and sign highlighting, depending on + // the sign priority. + if (sign_present && wlv->sattr.sat_linehl > 0) + { + if (wlv->sattr.sat_priority >= 100) + wlv->line_attr = hl_combine_attr(wlv->cul_attr, wlv->line_attr); + else + wlv->line_attr = hl_combine_attr(wlv->line_attr, wlv->cul_attr); + } + else + # endif + # if defined(FEAT_QUICKFIX) + // let the line attribute overrule 'cursorline', otherwise + // it disappears when both have background set; + // 'cursorline' can use underline or bold to make it show + wlv->line_attr = hl_combine_attr(wlv->cul_attr, wlv->line_attr); + # else + wlv->line_attr = wlv->cul_attr; + # endif + } + #endif + /* * Display line "lnum" of window 'wp' on the screen. * Start at row "startrow", stop when "endrow" is reached. *************** *** 1728,1762 **** wlv.cul_screenline = (wp->w_p_wrap && (wp->w_p_culopt_flags & CULOPT_SCRLINE)); ! // Only set wlv.line_attr here when "screenline" is not present in ! // 'cursorlineopt'. Otherwise it's done later. if (!wlv.cul_screenline) ! { ! wlv.cul_attr = HL_ATTR(HLF_CUL); ! # ifdef FEAT_SIGNS ! // Combine the 'cursorline' and sign highlighting, depending on ! // the sign priority. ! if (sign_present && wlv.sattr.sat_linehl > 0) ! { ! if (wlv.sattr.sat_priority >= 100) ! wlv.line_attr = hl_combine_attr( ! wlv.cul_attr, wlv.line_attr); ! else ! wlv.line_attr = hl_combine_attr( ! wlv.line_attr, wlv.cul_attr); ! } ! else ! # endif ! # if defined(FEAT_QUICKFIX) ! // let the line attribute overrule 'cursorline', otherwise ! // it disappears when both have background set; ! // 'cursorline' can use underline or bold to make it show ! wlv.line_attr = hl_combine_attr( ! wlv.cul_attr, wlv.line_attr); ! # else ! wlv.line_attr = wlv.cul_attr; ! # endif ! } else { line_attr_save = wlv.line_attr; --- 1758,1767 ---- wlv.cul_screenline = (wp->w_p_wrap && (wp->w_p_culopt_flags & CULOPT_SCRLINE)); ! // Only apply CursorLine highlight here when "screenline" is not ! // present in 'cursorlineopt'. Otherwise it's done later. if (!wlv.cul_screenline) ! apply_cursorline_highlight(&wlv, sign_present); else { line_attr_save = wlv.line_attr; *************** *** 1850,1857 **** && wlv.vcol >= left_curline_col && wlv.vcol < right_curline_col) { ! wlv.cul_attr = HL_ATTR(HLF_CUL); ! wlv.line_attr = wlv.cul_attr; } #endif --- 1855,1861 ---- && wlv.vcol >= left_curline_col && wlv.vcol < right_curline_col) { ! apply_cursorline_highlight(&wlv, sign_present); } #endif *** ../vim-9.0.1047/src/testdir/test_quickfix.vim 2022-12-02 15:58:34.614705476 +0000 --- src/testdir/test_quickfix.vim 2022-12-12 13:16:08.474222084 +0000 *************** *** 3120,3125 **** --- 3120,3130 ---- call VerifyScreenDump(buf, 'Test_quickfix_cwindow_2', {}) call term_sendkeys(buf, "\j:set cursorline\") + call term_sendkeys(buf, ":\") + call VerifyScreenDump(buf, 'Test_quickfix_cwindow_3', {}) + + call term_sendkeys(buf, ":set cursorlineopt=number,screenline\") + call term_sendkeys(buf, ":\") call VerifyScreenDump(buf, 'Test_quickfix_cwindow_3', {}) call term_sendkeys(buf, "j") *** ../vim-9.0.1047/src/testdir/test_signs.vim 2022-10-10 22:39:38.203545897 +0100 --- src/testdir/test_signs.vim 2022-12-12 13:16:08.474222084 +0000 *************** *** 1805,1816 **** --- 1805,1822 ---- call term_sendkeys(buf, "2G") call term_sendkeys(buf, ":\") call VerifyScreenDump(buf, 'Test_sign_cursor_5', {}) + call term_sendkeys(buf, ":set cursorlineopt=number,screenline\") + call term_sendkeys(buf, ":\") + call VerifyScreenDump(buf, 'Test_sign_cursor_5', {}) " sign highlighting overrules 'cursorline' call term_sendkeys(buf, ":sign unplace 12\") call term_sendkeys(buf, ":sign place 13 line=2 priority=100 name=s2\") call term_sendkeys(buf, ":\") call VerifyScreenDump(buf, 'Test_sign_cursor_6', {}) + call term_sendkeys(buf, ":set cursorlineopt&\") + call term_sendkeys(buf, ":\") + call VerifyScreenDump(buf, 'Test_sign_cursor_6', {}) " clean up call StopVimInTerminal(buf) *** ../vim-9.0.1047/src/testdir/dumps/Test_quickfix_cwindow_3.dump 2022-07-03 14:20:44.788010407 +0100 --- src/testdir/dumps/Test_quickfix_cwindow_3.dump 2022-12-12 13:16:08.474222084 +0000 *************** *** 9,12 **** |X+0#0000e05#ffffff0|C|w|i|n|d|o|w||+0#0000000&|4+0#af5f00255&| |c|o|l| |6|-|7||+0#0000000&| |m|a|t|c|h|e|s| @47 |~+0#4040ff13&| @73 |[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|2|,|1| @12|A|l@1 ! |:+0&&|s|e|t| |c|u|r|s|o|r|l|i|n|e| @59 --- 9,12 ---- |X+0#0000e05#ffffff0|C|w|i|n|d|o|w||+0#0000000&|4+0#af5f00255&| |c|o|l| |6|-|7||+0#0000000&| |m|a|t|c|h|e|s| @47 |~+0#4040ff13&| @73 |[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|2|,|1| @12|A|l@1 ! |:+0&&| @73 *** ../vim-9.0.1047/src/testdir/dumps/Test_quickfix_cwindow_4.dump 2022-07-03 14:20:44.788010407 +0100 --- src/testdir/dumps/Test_quickfix_cwindow_4.dump 2022-12-12 13:16:08.474222084 +0000 *************** *** 9,12 **** >X+8#0000e05#ffffff0|C|w|i|n|d|o|w||+8#0000000&|4+8#af5f00255&| |c|o|l| |6|-|7||+8#0000000&| |m|a|t|c|h|e|s| @47 |~+0#4040ff13&| @73 |[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|3|,|1| @12|A|l@1 ! |:+0&&|s|e|t| |c|u|r|s|o|r|l|i|n|e| @59 --- 9,12 ---- >X+8#0000e05#ffffff0|C|w|i|n|d|o|w||+8#0000000&|4+8#af5f00255&| |c|o|l| |6|-|7||+8#0000000&| |m|a|t|c|h|e|s| @47 |~+0#4040ff13&| @73 |[+3#0000000&|Q|u|i|c|k|f|i|x| |L|i|s|t|]| |:|v|i|m|g|r|e|p| |e| |X|C|w|i|n|d|o|w| @20|3|,|1| @12|A|l@1 ! |:+0&&| @73 *** ../vim-9.0.1047/src/version.c 2022-12-11 14:18:25.954350156 +0000 --- src/version.c 2022-12-12 13:18:41.094538268 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1048, /**/ -- From "know your smileys": (\___/) (+'.'+) Bunny (")_(") /// 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 ///