Skip to content

Commit c07ff5c

Browse files
committed
patch 8.1.0849: cursorline highlight is not always updated
Problem: Cursorline highlight is not always updated. Solution: Set w_last_cursorline when redrawing. Fix resetting cursor flags when using the popup menu.
1 parent b191be2 commit c07ff5c

5 files changed

Lines changed: 35 additions & 5 deletions

File tree

src/popupmnu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pum_call_update_screen()
368368
// Update the cursor position to be able to compute the popup menu
369369
// position. The cursor line length may have changed because of the
370370
// inserted completion.
371-
curwin->w_valid &= VALID_CROW|VALID_CHEIGHT;
371+
curwin->w_valid &= ~(VALID_CROW|VALID_CHEIGHT);
372372
validate_cursor();
373373
}
374374

src/screen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3712,6 +3712,7 @@ win_line(
37123712
{
37133713
line_attr = HL_ATTR(HLF_CUL);
37143714
area_highlighting = TRUE;
3715+
wp->w_last_cursorline = wp->w_cursor.lnum;
37153716
}
37163717
#endif
37173718

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0#af5f00255#ffffff0@1|3| | +0#0000000&@70
2+
| +0#af5f00255&@1|2| |1+0#0000000&| @69
3+
| +0#af5f00255&@1|1| |2+0#0000000&| @69
4+
| +0#af5f00255&@1|0| >3+8#0000000&| @69
5+
| +0#af5f00255&@1|1| | +0#0000000&@70
6+
|~+0#4040ff13&| @73
7+
|~| @73
8+
|4+0#0000000&| |l|i|n|e|s| |y|a|n|k|e|d| @42|4|,|1| @10|A|l@1|

src/testdir/test_highlight.vim

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
" Tests for ":highlight" and highlighting.
22

33
source view_util.vim
4+
source screendump.vim
45

56
func Test_highlight()
67
" basic test if ":highlight" doesn't crash
@@ -129,10 +130,6 @@ func Test_highlight_eol_with_cursorline()
129130
endfunc
130131

131132
func Test_highlight_eol_with_cursorline_vertsplit()
132-
if !has('vertsplit')
133-
return
134-
endif
135-
136133
let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
137134

138135
call NewWindow('topleft 5', 5)
@@ -533,3 +530,25 @@ func Test_termguicolors()
533530
set t_Co=0
534531
redraw
535532
endfunc
533+
534+
func Test_cursorline_after_yank()
535+
if !CanRunVimInTerminal()
536+
return
537+
endif
538+
539+
call writefile([
540+
\ 'set cul rnu',
541+
\ 'call setline(1, ["","1","2","3",""])',
542+
\ ], 'Xtest_cursorline_yank')
543+
let buf = RunVimInTerminal('-S Xtest_cursorline_yank', {'rows': 8})
544+
call term_wait(buf)
545+
call term_sendkeys(buf, "Gy3k")
546+
call term_wait(buf)
547+
call term_sendkeys(buf, "jj")
548+
549+
call VerifyScreenDump(buf, 'Test_cursorline_yank_01', {})
550+
551+
" clean up
552+
call StopVimInTerminal(buf)
553+
call delete('Xtest_cursorline_yank')
554+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ static char *(features[]) =
783783

784784
static int included_patches[] =
785785
{ /* Add new patch number below this line */
786+
/**/
787+
849,
786788
/**/
787789
848,
788790
/**/

0 commit comments

Comments
 (0)