Patch 8.2.4638
Problem: Superfluous check if a redraw is needed for 'cursorline'.
Solution: Remove check_redraw_cursorline(). (closes #10030, closes #10029)
Files: src/drawscreen.c, src/proto/
drawscreen.pro, src/edit.c,
src/main.c, src/normal.c, src/move.c,
src/testdir/dumps/Test_cursorcolumn_callback_1.dump,
src/testdir/dumps/Test_relativenumber_callback_1.dump,
src/testdir/test_highlight.vim, src/testdir/test_number.vim
*** ../vim-8.2.4637/src/drawscreen.c 2022-03-25 15:42:07.307639054 +0000
--- src/drawscreen.c 2022-03-27 18:55:01.258583432 +0100
***************
*** 3032,3054 ****
}
#endif
- #if defined(FEAT_SYN_HL) || defined(PROTO)
- /*
- * Check if the cursor moved and 'cursorline' is set. Mark for a VALID redraw
- * if needed.
- */
- void
- check_redraw_cursorline(void)
- {
- // When 'cursorlineopt' is "screenline" need to redraw always.
- if (curwin->w_p_cul
- && (curwin->w_last_cursorline != curwin->w_cursor.lnum
- || (curwin->w_p_culopt_flags & CULOPT_SCRLINE))
- && !char_avail())
- redraw_later(VALID);
- }
- #endif
-
/*
* Invoked after an asynchronous callback is called.
* If an echo command was used the cursor needs to be put back where
--- 3032,3037 ----
***************
*** 3093,3102 ****
}
else if (State & (NORMAL | INSERT | TERMINAL))
{
! #ifdef FEAT_SYN_HL
! // might need to update for 'cursorline'
! check_redraw_cursorline();
! #endif
// keep the command line if possible
update_screen(VALID_NO_UPDATE);
setcursor();
--- 3076,3084 ----
}
else if (State & (NORMAL | INSERT | TERMINAL))
{
! update_topline();
! validate_cursor();
!
// keep the command line if possible
update_screen(VALID_NO_UPDATE);
setcursor();
*** ../vim-8.2.4637/src/proto/
drawscreen.pro 2022-03-19 11:09:52.519730941 +0000
--- src/proto/
drawscreen.pro 2022-03-27 18:52:24.026739957 +0100
***************
*** 8,14 ****
void update_debug_sign(buf_T *buf, linenr_T lnum);
void updateWindow(win_T *wp);
int redraw_asap(int type);
- void check_redraw_cursorline(void);
void redraw_after_callback(int call_update_screen, int do_message);
void redraw_later(int type);
void redraw_win_later(win_T *wp, int type);
--- 8,13 ----
*** ../vim-8.2.4637/src/edit.c 2022-03-26 13:27:06.201576216 +0000
--- src/edit.c 2022-03-27 18:51:38.162775785 +0100
***************
*** 1058,1067 ****
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.
--- 1058,1063 ----
*** ../vim-8.2.4637/src/main.c 2022-03-19 11:09:52.519730941 +0000
--- src/main.c 2022-03-27 18:51:48.602768065 +0100
***************
*** 1384,1393 ****
update_topline();
validate_cursor();
- #ifdef FEAT_SYN_HL
- // Might need to update for 'cursorline'.
- check_redraw_cursorline();
- #endif
if (VIsual_active)
update_curbuf(INVERTED); // update inverted part
else if (must_redraw)
--- 1384,1389 ----
*** ../vim-8.2.4637/src/normal.c 2022-03-26 13:27:06.201576216 +0000
--- src/normal.c 2022-03-27 18:52:00.774758740 +0100
***************
*** 6971,6980 ****
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);
}
--- 6971,6976 ----
*** ../vim-8.2.4637/src/move.c 2022-03-23 14:55:19.709745872 +0000
--- src/move.c 2022-03-27 19:06:34.377526768 +0100
***************
*** 135,140 ****
--- 135,160 ----
}
}
+ #ifdef FEAT_SYN_HL
+ /*
+ * Redraw when w_virtcol changes and 'cursorcolumn' is set or 'cursorlineopt'
+ * contains "screenline".
+ */
+ static void
+ redraw_for_cursorcolumn(win_T *wp)
+ {
+ if ((wp->w_valid & VALID_VIRTCOL) == 0 && !pum_visible())
+ {
+ // When 'cursorcolumn' is set need to redraw with SOME_VALID.
+ if (wp->w_p_cuc)
+ redraw_later(SOME_VALID);
+ // When 'cursorlineopt' contains "screenline" need to redraw with VALID.
+ else if (wp->w_p_cul && (wp->w_p_culopt_flags & CULOPT_SCRLINE))
+ redraw_later(VALID);
+ }
+ }
+ #endif
+
/*
* Update curwin->w_topline and redraw if necessary.
* Used to update the screen before printing a message.
***************
*** 798,808 ****
if (!(wp->w_valid & VALID_VIRTCOL))
{
getvvcol(wp, &wp->w_cursor, NULL, &(wp->w_virtcol), NULL);
- wp->w_valid |= VALID_VIRTCOL;
#ifdef FEAT_SYN_HL
! if (wp->w_p_cuc && !pum_visible())
! redraw_win_later(wp, SOME_VALID);
#endif
}
}
--- 818,827 ----
if (!(wp->w_valid & VALID_VIRTCOL))
{
getvvcol(wp, &wp->w_cursor, NULL, &(wp->w_virtcol), NULL);
#ifdef FEAT_SYN_HL
! redraw_for_cursorcolumn(wp);
#endif
+ wp->w_valid |= VALID_VIRTCOL;
}
}
***************
*** 1169,1178 ****
redraw_later(NOT_VALID);
#ifdef FEAT_SYN_HL
! // Redraw when w_virtcol changes and 'cursorcolumn' is set
! if (curwin->w_p_cuc && (curwin->w_valid & VALID_VIRTCOL) == 0
! && !pum_visible())
! redraw_later(SOME_VALID);
#endif
#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
if (popup_is_popup(curwin) && curbuf->b_term != NULL)
--- 1188,1194 ----
redraw_later(NOT_VALID);
#ifdef FEAT_SYN_HL
! redraw_for_cursorcolumn(curwin);
#endif
#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
if (popup_is_popup(curwin) && curbuf->b_term != NULL)
*** ../vim-8.2.4637/src/testdir/dumps/Test_cursorcolumn_callback_1.dump 2022-03-27 19:23:01.203531872 +0100
--- src/testdir/dumps/Test_cursorcolumn_callback_1.dump 2022-03-27 19:06:37.249521678 +0100
***************
*** 0 ****
--- 1,8 ----
+ >a+0&#ffffff0@4| @69
+ |b+0&#e0e0e08|b+0&#ffffff0@3| @69
+ |c+0&#e0e0e08|c+0&#ffffff0@3| @69
+ |d+0&#e0e0e08|d+0&#ffffff0@3| @69
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|4|,|5| @10|A|l@1|
*** ../vim-8.2.4637/src/testdir/dumps/Test_relativenumber_callback_1.dump 2022-03-27 19:23:01.207531860 +0100
--- src/testdir/dumps/Test_relativenumber_callback_1.dump 2022-03-27 19:06:37.249521678 +0100
***************
*** 0 ****
--- 1,8 ----
+ | +0#af5f00255#ffffff0@1|0| >a+0#0000000&@4| @65
+ | +0#af5f00255&@1|1| |b+0#0000000&@4| @65
+ | +0#af5f00255&@1|2| |c+0#0000000&@4| @65
+ | +0#af5f00255&@1|3| |d+0#0000000&@4| @65
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|4|,|1| @10|A|l@1|
*** ../vim-8.2.4637/src/testdir/test_highlight.vim 2022-02-10 19:51:42.549569899 +0000
--- src/testdir/test_highlight.vim 2022-03-27 19:06:37.249521678 +0100
***************
*** 592,597 ****
--- 592,622 ----
call delete('Xtest_cursorline_with_visualmode')
endfunc
+ func Test_cursorcolumn_callback()
+ CheckScreendump
+ CheckFeature timers
+
+ let lines =<< trim END
+ call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
+ set cursorcolumn
+ call cursor(4, 5)
+
+ func Func(timer)
+ call cursor(1, 1)
+ endfunc
+
+ call timer_start(300, 'Func')
+ END
+ call writefile(lines, 'Xcuc_timer')
+
+ let buf = RunVimInTerminal('-S Xcuc_timer', #{rows: 8})
+ call TermWait(buf, 310)
+ call VerifyScreenDump(buf, 'Test_cursorcolumn_callback_1', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xcuc_timer')
+ endfunc
+
func Test_wincolor()
CheckScreendump
" make sure the width is enough for the test
*** ../vim-8.2.4637/src/testdir/test_number.vim 2021-08-17 21:14:25.621495451 +0100
--- src/testdir/test_number.vim 2022-03-27 19:06:37.249521678 +0100
***************
*** 298,303 ****
--- 298,328 ----
call delete('XTest_relnr')
endfunc
+ func Test_relativenumber_callback()
+ CheckScreendump
+ CheckFeature timers
+
+ let lines =<< trim END
+ call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
+ set relativenumber
+ call cursor(4, 1)
+
+ func Func(timer)
+ call cursor(1, 1)
+ endfunc
+
+ call timer_start(300, 'Func')
+ END
+ call writefile(lines, 'Xrnu_timer')
+
+ let buf = RunVimInTerminal('-S Xrnu_timer', #{rows: 8})
+ call TermWait(buf, 310)
+ call VerifyScreenDump(buf, 'Test_relativenumber_callback_1', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xrnu_timer')
+ endfunc
+
" Test for displaying line numbers with 'rightleft'
func Test_number_rightleft()
CheckFeature rightleft
*** ../vim-8.2.4637/src/version.c 2022-03-27 18:11:01.458525523 +0100
--- src/version.c 2022-03-27 19:22:44.843586007 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4638,
/**/
--
With sufficient thrust, pigs fly just fine.
-- RFC 1925
/// 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 ///