Patch 8.2.4520

11 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 6, 2022, 2:56:41 PM3/6/22
to vim...@googlegroups.com

Patch 8.2.4520
Problem: Using wrong highlight for cursor line number.
Solution: Take filler lines into account when using CursorLineNr.
(closes #9897)
Files: src/drawline.c, src/testdir/test_diffmode.vim,
src/testdir/dumps/Test_diff_with_cursorline_number_01.dump,
src/testdir/dumps/Test_diff_with_cursorline_number_02.dump


*** ../vim-8.2.4519/src/drawline.c 2022-02-25 21:05:31.598434512 +0000
--- src/drawline.c 2022-03-06 19:41:21.364353813 +0000
***************
*** 1194,1201 ****
if (wp->w_p_cul
&& lnum == wp->w_cursor.lnum
&& (wp->w_p_culopt_flags & CULOPT_NBR)
! && (row == startrow
! || wp->w_p_culopt_flags & CULOPT_LINE))
char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN));
#endif
if (wp->w_p_rnu && lnum < wp->w_cursor.lnum
--- 1194,1202 ----
if (wp->w_p_cul
&& lnum == wp->w_cursor.lnum
&& (wp->w_p_culopt_flags & CULOPT_NBR)
! && (row == startrow + filler_lines
! || (row > startrow + filler_lines
! && wp->w_p_culopt_flags & CULOPT_LINE)))
char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN));
#endif
if (wp->w_p_rnu && lnum < wp->w_cursor.lnum
*** ../vim-8.2.4519/src/testdir/test_diffmode.vim 2022-02-10 19:51:42.545569904 +0000
--- src/testdir/test_diffmode.vim 2022-03-06 19:52:08.399356316 +0000
***************
*** 1056,1061 ****
--- 1056,1087 ----
call delete('Xtest_diff_cursorline')
endfunc

+ func Test_diff_with_cursorline_number()
+ CheckScreendump
+
+ let lines =<< trim END
+ hi CursorLine ctermbg=red ctermfg=white
+ hi CursorLineNr ctermbg=white ctermfg=black cterm=underline
+ set cursorline number
+ call setline(1, ["baz", "foo", "foo", "bar"])
+ 2
+ vnew
+ call setline(1, ["foo", "foo", "bar"])
+ windo diffthis
+ 1wincmd w
+ END
+ call writefile(lines, 'Xtest_diff_cursorline_number')
+ let buf = RunVimInTerminal('-S Xtest_diff_cursorline_number', {})
+
+ call VerifyScreenDump(buf, 'Test_diff_with_cursorline_number_01', {})
+ call term_sendkeys(buf, ":set cursorlineopt=number\r")
+ call VerifyScreenDump(buf, 'Test_diff_with_cursorline_number_02', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('Xtest_diff_cursorline_number')
+ endfunc
+
func Test_diff_with_cursorline_breakindent()
CheckScreendump

*** ../vim-8.2.4519/src/testdir/dumps/Test_diff_with_cursorline_number_01.dump 2022-03-06 19:50:08.719533317 +0000
--- src/testdir/dumps/Test_diff_with_cursorline_number_01.dump 2022-03-06 19:41:21.364353813 +0000
***************
*** 0 ****
--- 1,20 ----
+ | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|-+0#4040ff13#afffff255@30||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |b+0#0000000#5fd7ff255|a|z| @27
+ | +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|1| >f+8#ffffff16#ff404010|o@1| @27||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|2| |f+8#ffffff16#ff404010|o@1| @27
+ | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |f+0#0000000&|o@1| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|o@1| @27
+ | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |b+0#0000000&|a|r| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|4| |b+0#0000000&|a|r| @27
+ |~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|1| @11|A|l@1
+ | +0&&@74
*** ../vim-8.2.4519/src/testdir/dumps/Test_diff_with_cursorline_number_02.dump 2022-03-06 19:50:08.727533307 +0000
--- src/testdir/dumps/Test_diff_with_cursorline_number_02.dump 2022-03-06 19:41:21.364353813 +0000
***************
*** 0 ****
--- 1,20 ----
+ | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|-+0#4040ff13#afffff255@30||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |b+0#0000000#5fd7ff255|a|z| @27
+ | +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|1| >f+0#0000000#ffffff0|o@1| @27||+1&&| +0#0000e05#a8a8a8255@1| +8#0000001#ffffff16@1|2| |f+8#ffffff16#ff404010|o@1| @27
+ | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |f+0#0000000&|o@1| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|o@1| @27
+ | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |b+0#0000000&|a|r| @27||+1&&| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|4| |b+0#0000000&|a|r| @27
+ |~+0#4040ff13&| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |~| @35||+1#0000000&|~+0#4040ff13&| @35
+ |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|2|,|1| @11|A|l@1
+ |:+0&&|s|e|t| |c|u|r|s|o|r|l|i|n|e|o|p|t|=|n|u|m|b|e|r| @49
*** ../vim-8.2.4519/src/version.c 2022-03-06 14:51:19.058997629 +0000
--- src/version.c 2022-03-06 19:48:35.647672637 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4520,
/**/

--
hundred-and-one symptoms of being an internet addict:
180. You maintain more than six e-mail addresses.

/// Bram Moolenaar -- Br...@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 ///

John Marriott

unread,
Mar 6, 2022, 3:17:38 PM3/6/22
to vim...@googlegroups.com

On 07-Mar-2022 06:56, Bram Moolenaar wrote:
> Patch 8.2.4520
> Problem: Using wrong highlight for cursor line number.
> Solution: Take filler lines into account when using CursorLineNr.
> (closes #9897)
> Files: src/drawline.c, src/testdir/test_diffmode.vim,
> src/testdir/dumps/Test_diff_with_cursorline_number_01.dump,
> src/testdir/dumps/Test_diff_with_cursorline_number_02.dump
>
>
After this match mingw64 (gcc 11.2.0) spits out this error if FEAT_DIFF
or FEAT_SIGNS are not defined:
<snip>
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD drawline.c -o
gobjnative/drawline.o
drawline.c: In function 'win_line':
drawline.c:1197:53: error: 'filler_lines' undeclared (first use in this
function)
 1197 |                               && (row == startrow + filler_lines
      | ^~~~~~~~~~~~
drawline.c:1197:53: note: each undeclared identifier is reported only
once for each function it appears in
make: *** [Make_cyg_ming.mak:1184: gobjnative/drawline.o] Error 1
</snip>

Not sure the best way to fix it.

Cheers
John

Bram Moolenaar

unread,
Mar 6, 2022, 3:48:32 PM3/6/22
to vim...@googlegroups.com, John Marriott
There were a couple other places with an #ifdef around using
filler_lines. Let's #define it to zero when it's not declared.

--
hundred-and-one symptoms of being an internet addict:
181. You still remember the "happy tune" your modem made
while dialing your ISP.
Reply all
Reply to author
Forward
0 new messages