comparison src/terminal.c @ 23035:fabd80ec9620 v8.2.2064

patch 8.2.2064: terminal: cursor is on while redrawing, causing flicker Commit: https://github.com/vim/vim/commit/ebec3e29b83e6b5ccdd67a79993628871cda4b5b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 28 20:22:06 2020 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Sat, 28 Nov 2020 20:30:04 +0100
parents bc3a083b50cb
children 139573353c6d
comparison
equal deleted inserted replaced
23034:562144879d7f 23035:fabd80ec9620
1200 { 1200 {
1201 ch_log(channel, "NOT writing %d bytes to terminal", (int)len); 1201 ch_log(channel, "NOT writing %d bytes to terminal", (int)len);
1202 return; 1202 return;
1203 } 1203 }
1204 ch_log(channel, "writing %d bytes to terminal", (int)len); 1204 ch_log(channel, "writing %d bytes to terminal", (int)len);
1205 cursor_off();
1205 term_write_job_output(term, msg, len); 1206 term_write_job_output(term, msg, len);
1206 1207
1207 #ifdef FEAT_GUI 1208 #ifdef FEAT_GUI
1208 if (term->tl_system) 1209 if (term->tl_system)
1209 { 1210 {
2197 2198
2198 return OK; 2199 return OK;
2199 } 2200 }
2200 2201
2201 static void 2202 static void
2202 position_cursor(win_T *wp, VTermPos *pos, int add_off UNUSED) 2203 position_cursor(win_T *wp, VTermPos *pos)
2203 { 2204 {
2204 wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1)); 2205 wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1));
2205 wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1)); 2206 wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1));
2206 #ifdef FEAT_PROP_POPUP 2207 #ifdef FEAT_PROP_POPUP
2207 if (add_off && popup_is_popup(curwin)) 2208 if (popup_is_popup(wp))
2208 { 2209 {
2209 wp->w_wrow += popup_top_extra(curwin); 2210 if ((wp->w_flags & WFLAG_WROW_OFF_ADDED) == 0)
2210 wp->w_wcol += popup_left_extra(curwin); 2211 wp->w_wrow += popup_top_extra(wp);
2212 if ((wp->w_flags & WFLAG_WCOL_OFF_ADDED) == 0)
2213 wp->w_wcol += popup_left_extra(wp);
2211 wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED; 2214 wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED;
2212 } 2215 }
2213 else 2216 else
2214 wp->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED); 2217 wp->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED);
2215 #endif 2218 #endif
2522 { 2525 {
2523 termwinkey = string_to_key(curwin->w_p_twk, TRUE); 2526 termwinkey = string_to_key(curwin->w_p_twk, TRUE);
2524 if (termwinkey == Ctrl_W) 2527 if (termwinkey == Ctrl_W)
2525 termwinkey = 0; 2528 termwinkey = 0;
2526 } 2529 }
2527 position_cursor(curwin, &curbuf->b_term->tl_cursor_pos, TRUE); 2530 position_cursor(curwin, &curbuf->b_term->tl_cursor_pos);
2528 may_set_cursor_props(curbuf->b_term); 2531 may_set_cursor_props(curbuf->b_term);
2529 2532
2530 while (blocking || vpeekc_nomap() != NUL) 2533 while (blocking || vpeekc_nomap() != NUL)
2531 { 2534 {
2532 #ifdef FEAT_GUI 2535 #ifdef FEAT_GUI
3057 term->tl_cursor_visible = visible; 3060 term->tl_cursor_visible = visible;
3058 3061
3059 while (for_all_windows_and_curwin(&wp, &did_curwin)) 3062 while (for_all_windows_and_curwin(&wp, &did_curwin))
3060 { 3063 {
3061 if (wp->w_buffer == term->tl_buffer) 3064 if (wp->w_buffer == term->tl_buffer)
3062 position_cursor(wp, &pos, FALSE); 3065 position_cursor(wp, &pos);
3063 } 3066 }
3064 if (term->tl_buffer == curbuf && !term->tl_normal_mode) 3067 if (term->tl_buffer == curbuf && !term->tl_normal_mode)
3065 {
3066 may_toggle_cursor(term);
3067 update_cursor(term, term->tl_cursor_visible); 3068 update_cursor(term, term->tl_cursor_visible);
3068 }
3069 3069
3070 return 1; 3070 return 1;
3071 } 3071 }
3072 3072
3073 static int 3073 static int
3816 may_move_terminal_to_buffer(term, FALSE); 3816 may_move_terminal_to_buffer(term, FALSE);
3817 } 3817 }
3818 3818
3819 // The cursor may have been moved when resizing. 3819 // The cursor may have been moved when resizing.
3820 vterm_state_get_cursorpos(state, &pos); 3820 vterm_state_get_cursorpos(state, &pos);
3821 position_cursor(wp, &pos, FALSE); 3821 position_cursor(wp, &pos);
3822 3822
3823 for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end 3823 for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end
3824 && pos.row < wp->w_height; ++pos.row) 3824 && pos.row < wp->w_height; ++pos.row)
3825 { 3825 {
3826 if (pos.row < term->tl_rows) 3826 if (pos.row < term->tl_rows)