To: vim_dev@googlegroups.com Subject: Patch 7.4.2199 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2199 Problem: In the GUI the cursor is hidden when redrawing any window, causing flicker. Solution: Only undraw the cursor when updating the window it's in. Files: src/screen.c, src/gui.c, src/proto/gui.pro, src/gui_gtk_x11.c *** ../vim-7.4.2198/src/screen.c 2016-08-03 22:08:41.743652143 +0200 --- src/screen.c 2016-08-12 13:49:39.195737719 +0200 *************** *** 498,503 **** --- 498,504 ---- int did_one; #endif #ifdef FEAT_GUI + int did_undraw = FALSE; int gui_cursor_col; int gui_cursor_row; #endif *************** *** 697,707 **** /* Remove the cursor before starting to do anything, because * scrolling may make it difficult to redraw the text under * it. */ ! if (gui.in_use) { gui_cursor_col = gui.cursor_col; gui_cursor_row = gui.cursor_row; gui_undraw_cursor(); } #endif } --- 698,709 ---- /* Remove the cursor before starting to do anything, because * scrolling may make it difficult to redraw the text under * it. */ ! if (gui.in_use && wp == curwin) { gui_cursor_col = gui.cursor_col; gui_cursor_row = gui.cursor_row; gui_undraw_cursor(); + did_undraw = TRUE; } #endif } *************** *** 757,763 **** if (gui.in_use) { out_flush(); /* required before updating the cursor */ ! if (did_one && !gui_mch_is_blink_off()) { /* Put the GUI position where the cursor was, gui_update_cursor() * uses that. */ --- 759,765 ---- if (gui.in_use) { out_flush(); /* required before updating the cursor */ ! if (did_undraw && !gui_mch_is_blink_off()) { /* Put the GUI position where the cursor was, gui_update_cursor() * uses that. */ *************** *** 9679,9685 **** #ifdef FEAT_GUI /* Don't update the GUI cursor here, ScreenLines[] is invalid until the * scrolling is actually carried out. */ ! gui_dont_update_cursor(); #endif if (*T_CCS != NUL) /* cursor relative to region */ --- 9681,9687 ---- #ifdef FEAT_GUI /* Don't update the GUI cursor here, ScreenLines[] is invalid until the * scrolling is actually carried out. */ ! gui_dont_update_cursor(row + off <= gui.cursor_row); #endif if (*T_CCS != NUL) /* cursor relative to region */ *************** *** 9781,9790 **** } /* ! * delete lines on the screen and update ScreenLines[] ! * 'end' is the line after the scrolled part. Normally it is Rows. ! * When scrolling region used 'off' is the offset from the top for the region. ! * 'row' and 'end' are relative to the start of the region. * * Return OK for success, FAIL if the lines are not deleted. */ --- 9783,9792 ---- } /* ! * Delete lines on the screen and update ScreenLines[]. ! * "end" is the line after the scrolled part. Normally it is Rows. ! * When scrolling region used "off" is the offset from the top for the region. ! * "row" and "end" are relative to the start of the region. * * Return OK for success, FAIL if the lines are not deleted. */ *************** *** 9900,9906 **** #ifdef FEAT_GUI /* Don't update the GUI cursor here, ScreenLines[] is invalid until the * scrolling is actually carried out. */ ! gui_dont_update_cursor(); #endif if (*T_CCS != NUL) /* cursor relative to region */ --- 9902,9909 ---- #ifdef FEAT_GUI /* Don't update the GUI cursor here, ScreenLines[] is invalid until the * scrolling is actually carried out. */ ! gui_dont_update_cursor(gui.cursor_row >= row + off ! && gui.cursor_row < end + off); #endif if (*T_CCS != NUL) /* cursor relative to region */ *** ../vim-7.4.2198/src/gui.c 2016-08-10 21:28:41.051332690 +0200 --- src/gui.c 2016-08-12 13:40:17.884671822 +0200 *************** *** 1964,1975 **** * gui_can_update_cursor() afterwards. */ void ! gui_dont_update_cursor(void) { if (gui.in_use) { /* Undraw the cursor now, we probably can't do it after the change. */ ! gui_undraw_cursor(); can_update_cursor = FALSE; } } --- 1964,1976 ---- * gui_can_update_cursor() afterwards. */ void ! gui_dont_update_cursor(int undraw) { if (gui.in_use) { /* Undraw the cursor now, we probably can't do it after the change. */ ! if (undraw) ! gui_undraw_cursor(); can_update_cursor = FALSE; } } *** ../vim-7.4.2198/src/proto/gui.pro 2016-01-19 13:21:55.837334377 +0100 --- src/proto/gui.pro 2016-08-12 13:41:44.931896203 +0200 *************** *** 23,29 **** void gui_clear_block(int row1, int col1, int row2, int col2); void gui_update_cursor_later(void); void gui_write(char_u *s, int len); ! void gui_dont_update_cursor(void); void gui_can_update_cursor(void); int gui_outstr_nowrap(char_u *s, int len, int flags, guicolor_T fg, guicolor_T bg, int back); void gui_undraw_cursor(void); --- 23,29 ---- void gui_clear_block(int row1, int col1, int row2, int col2); void gui_update_cursor_later(void); void gui_write(char_u *s, int len); ! void gui_dont_update_cursor(int undraw); void gui_can_update_cursor(void); int gui_outstr_nowrap(char_u *s, int len, int flags, guicolor_T fg, guicolor_T bg, int back); void gui_undraw_cursor(void); *** ../vim-7.4.2198/src/gui_gtk_x11.c 2016-08-10 21:28:41.055332652 +0200 --- src/gui_gtk_x11.c 2016-08-12 13:40:31.328552026 +0200 *************** *** 6698,6704 **** * we don't want it to be. I'm not sure if it's correct to call * gui_dont_update_cursor() at this point but it works as a quick * fix for now. */ ! gui_dont_update_cursor(); do { --- 6698,6704 ---- * we don't want it to be. I'm not sure if it's correct to call * gui_dont_update_cursor() at this point but it works as a quick * fix for now. */ ! gui_dont_update_cursor(TRUE); do { *** ../vim-7.4.2198/src/version.c 2016-08-11 22:52:39.024607308 +0200 --- src/version.c 2016-08-12 13:54:55.232998922 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2199, /**/ -- The goal of science is to build better mousetraps. The goal of nature is to build better mice. /// 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 ///