forked from aniani/vim
patch 8.2.2064: terminal: cursor is on while redrawing, causing flicker
Problem: terminal: cursor is on while redrawing, causing flicker. Solution: Switch the cursor off while redrawing. Always add the top and left offset to the cursor position when not done already. (closes #5943)
This commit is contained in:
@@ -3699,6 +3699,9 @@ update_popups(void (*win_update)(win_T *wp))
|
|||||||
int attr_scroll = 0;
|
int attr_scroll = 0;
|
||||||
int attr_thumb = 0;
|
int attr_thumb = 0;
|
||||||
|
|
||||||
|
// hide the cursor until redrawing is done.
|
||||||
|
cursor_off();
|
||||||
|
|
||||||
// Find the window with the lowest zindex that hasn't been updated yet,
|
// Find the window with the lowest zindex that hasn't been updated yet,
|
||||||
// so that the window with a higher zindex is drawn later, thus goes on
|
// so that the window with a higher zindex is drawn later, thus goes on
|
||||||
// top.
|
// top.
|
||||||
|
@@ -1202,6 +1202,7 @@ write_to_term(buf_T *buffer, char_u *msg, channel_T *channel)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ch_log(channel, "writing %d bytes to terminal", (int)len);
|
ch_log(channel, "writing %d bytes to terminal", (int)len);
|
||||||
|
cursor_off();
|
||||||
term_write_job_output(term, msg, len);
|
term_write_job_output(term, msg, len);
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
@@ -2199,15 +2200,17 @@ send_keys_to_term(term_T *term, int c, int modmask, int typed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
position_cursor(win_T *wp, VTermPos *pos, int add_off UNUSED)
|
position_cursor(win_T *wp, VTermPos *pos)
|
||||||
{
|
{
|
||||||
wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1));
|
wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1));
|
||||||
wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1));
|
wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1));
|
||||||
#ifdef FEAT_PROP_POPUP
|
#ifdef FEAT_PROP_POPUP
|
||||||
if (add_off && popup_is_popup(curwin))
|
if (popup_is_popup(wp))
|
||||||
{
|
{
|
||||||
wp->w_wrow += popup_top_extra(curwin);
|
if ((wp->w_flags & WFLAG_WROW_OFF_ADDED) == 0)
|
||||||
wp->w_wcol += popup_left_extra(curwin);
|
wp->w_wrow += popup_top_extra(wp);
|
||||||
|
if ((wp->w_flags & WFLAG_WCOL_OFF_ADDED) == 0)
|
||||||
|
wp->w_wcol += popup_left_extra(wp);
|
||||||
wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED;
|
wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2524,7 +2527,7 @@ terminal_loop(int blocking)
|
|||||||
if (termwinkey == Ctrl_W)
|
if (termwinkey == Ctrl_W)
|
||||||
termwinkey = 0;
|
termwinkey = 0;
|
||||||
}
|
}
|
||||||
position_cursor(curwin, &curbuf->b_term->tl_cursor_pos, TRUE);
|
position_cursor(curwin, &curbuf->b_term->tl_cursor_pos);
|
||||||
may_set_cursor_props(curbuf->b_term);
|
may_set_cursor_props(curbuf->b_term);
|
||||||
|
|
||||||
while (blocking || vpeekc_nomap() != NUL)
|
while (blocking || vpeekc_nomap() != NUL)
|
||||||
@@ -3059,13 +3062,10 @@ handle_movecursor(
|
|||||||
while (for_all_windows_and_curwin(&wp, &did_curwin))
|
while (for_all_windows_and_curwin(&wp, &did_curwin))
|
||||||
{
|
{
|
||||||
if (wp->w_buffer == term->tl_buffer)
|
if (wp->w_buffer == term->tl_buffer)
|
||||||
position_cursor(wp, &pos, FALSE);
|
position_cursor(wp, &pos);
|
||||||
}
|
}
|
||||||
if (term->tl_buffer == curbuf && !term->tl_normal_mode)
|
if (term->tl_buffer == curbuf && !term->tl_normal_mode)
|
||||||
{
|
|
||||||
may_toggle_cursor(term);
|
|
||||||
update_cursor(term, term->tl_cursor_visible);
|
update_cursor(term, term->tl_cursor_visible);
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -3818,7 +3818,7 @@ term_update_window(win_T *wp)
|
|||||||
|
|
||||||
// The cursor may have been moved when resizing.
|
// The cursor may have been moved when resizing.
|
||||||
vterm_state_get_cursorpos(state, &pos);
|
vterm_state_get_cursorpos(state, &pos);
|
||||||
position_cursor(wp, &pos, FALSE);
|
position_cursor(wp, &pos);
|
||||||
|
|
||||||
for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end
|
for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end
|
||||||
&& pos.row < wp->w_height; ++pos.row)
|
&& pos.row < wp->w_height; ++pos.row)
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2064,
|
||||||
/**/
|
/**/
|
||||||
2063,
|
2063,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user