Skip to content

Commit

Permalink
patch 8.2.4630: 'cursorline' not always updated with 'culopt' is "scr…
Browse files Browse the repository at this point in the history
…eenline"

Problem:    'cursorline' not always updated with 'cursorlineopt' is
            "screenline".
Solution:   Call check_redraw_cursorline() more often. (closes #10013)
  • Loading branch information
brammool committed Mar 26, 2022
1 parent c6c1ec4 commit bf269ed
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,10 @@ edit(
case K_COMMAND: // <Cmd>command<CR>
case K_SCRIPT_COMMAND: // <ScriptCmd>command<CR>
do_cmdkey_command(c, 0);
#ifdef FEAT_SYN_HL
// Might need to update for 'cursorline'.
check_redraw_cursorline();
#endif
#ifdef FEAT_TERMINAL
if (term_use_loop())
// Started a terminal that gets the input, exit Insert mode.
Expand Down
4 changes: 4 additions & 0 deletions src/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6971,6 +6971,10 @@ nv_edit(cmdarg_T *cap)
coladvance(getviscol());
State = save_State;
}
#ifdef FEAT_SYN_HL
// Might need to update for 'cursorline'.
check_redraw_cursorline();
#endif

invoke_edit(cap, FALSE, cap->cmdchar, FALSE);
}
Expand Down
8 changes: 8 additions & 0 deletions src/testdir/dumps/Test_cursorline_screenline_1.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
|x+0&#ffffff0|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z
| +8&&|x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| > @29
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|1|2|1| @8|A|l@1|
8 changes: 8 additions & 0 deletions src/testdir/dumps/Test_cursorline_screenline_2.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
>x+8&#ffffff0|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z
| +0&&|x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| |x|y|z| @30
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|1| @10|A|l@1|
21 changes: 21 additions & 0 deletions src/testdir/test_cursorline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,26 @@ func Test_cursorline_callback()
call delete('Xcul_timer')
endfunc

func Test_cursorline_screenline_update()
CheckScreendump

let lines =<< trim END
call setline(1, repeat('xyz ', 30))
set cursorline cursorlineopt=screenline
inoremap <F2> <Cmd>call cursor(1, 1)<CR>
END
call writefile(lines, 'Xcul_screenline')

let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8})
call term_sendkeys(buf, "A")
call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {})
call term_sendkeys(buf, "\<F2>")
call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {})
call term_sendkeys(buf, "\<Esc>")

call StopVimInTerminal(buf)
call delete('Xcul_screenline')
endfunc


" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4630,
/**/
4629,
/**/
Expand Down

0 comments on commit bf269ed

Please sign in to comment.