To: vim_dev@googlegroups.com Subject: Patch 8.2.2064 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2064 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) Files: src/terminal.c, src/popupwin.c *** ../vim-8.2.2063/src/terminal.c 2020-11-27 20:54:56.609430538 +0100 --- src/terminal.c 2020-11-28 20:18:20.692379834 +0100 *************** *** 1202,1207 **** --- 1202,1208 ---- return; } ch_log(channel, "writing %d bytes to terminal", (int)len); + cursor_off(); term_write_job_output(term, msg, len); #ifdef FEAT_GUI *************** *** 2199,2213 **** } static void ! position_cursor(win_T *wp, VTermPos *pos, int add_off UNUSED) { wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1)); wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1)); #ifdef FEAT_PROP_POPUP ! if (add_off && popup_is_popup(curwin)) { ! wp->w_wrow += popup_top_extra(curwin); ! wp->w_wcol += popup_left_extra(curwin); wp->w_flags |= WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED; } else --- 2200,2216 ---- } static void ! position_cursor(win_T *wp, VTermPos *pos) { wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1)); wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1)); #ifdef FEAT_PROP_POPUP ! if (popup_is_popup(wp)) { ! if ((wp->w_flags & WFLAG_WROW_OFF_ADDED) == 0) ! 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; } else *************** *** 2524,2530 **** if (termwinkey == Ctrl_W) termwinkey = 0; } ! position_cursor(curwin, &curbuf->b_term->tl_cursor_pos, TRUE); may_set_cursor_props(curbuf->b_term); while (blocking || vpeekc_nomap() != NUL) --- 2527,2533 ---- if (termwinkey == Ctrl_W) termwinkey = 0; } ! position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); may_set_cursor_props(curbuf->b_term); while (blocking || vpeekc_nomap() != NUL) *************** *** 3059,3071 **** while (for_all_windows_and_curwin(&wp, &did_curwin)) { if (wp->w_buffer == term->tl_buffer) ! position_cursor(wp, &pos, FALSE); } if (term->tl_buffer == curbuf && !term->tl_normal_mode) - { - may_toggle_cursor(term); update_cursor(term, term->tl_cursor_visible); - } return 1; } --- 3062,3071 ---- while (for_all_windows_and_curwin(&wp, &did_curwin)) { if (wp->w_buffer == term->tl_buffer) ! position_cursor(wp, &pos); } if (term->tl_buffer == curbuf && !term->tl_normal_mode) update_cursor(term, term->tl_cursor_visible); return 1; } *************** *** 3818,3824 **** // The cursor may have been moved when resizing. vterm_state_get_cursorpos(state, &pos); ! position_cursor(wp, &pos, FALSE); for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end && pos.row < wp->w_height; ++pos.row) --- 3818,3824 ---- // The cursor may have been moved when resizing. vterm_state_get_cursorpos(state, &pos); ! position_cursor(wp, &pos); for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end && pos.row < wp->w_height; ++pos.row) *** ../vim-8.2.2063/src/popupwin.c 2020-11-21 12:42:05.343791682 +0100 --- src/popupwin.c 2020-11-28 20:19:26.992263837 +0100 *************** *** 3699,3704 **** --- 3699,3707 ---- int attr_scroll = 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, // so that the window with a higher zindex is drawn later, thus goes on // top. *** ../vim-8.2.2063/src/version.c 2020-11-28 18:52:29.999995143 +0100 --- src/version.c 2020-11-28 20:21:37.232118287 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2064, /**/ -- WOMAN: I didn't know we had a king. I thought we were an autonomous collective. DENNIS: You're fooling yourself. We're living in a dictatorship. A self-perpetuating autocracy in which the working classes-- WOMAN: Oh there you go, bringing class into it again. DENNIS: That's what it's all about if only people would-- The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///