* gui_can_update_cursor() afterwards.
*/
void
-gui_dont_update_cursor(void)
+gui_dont_update_cursor(int undraw)
{
if (gui.in_use)
{
/* Undraw the cursor now, we probably can't do it after the change. */
- gui_undraw_cursor();
+ if (undraw)
+ gui_undraw_cursor();
can_update_cursor = FALSE;
}
}
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_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);
int did_one;
#endif
#ifdef FEAT_GUI
+ int did_undraw = FALSE;
int gui_cursor_col;
int gui_cursor_row;
#endif
/* Remove the cursor before starting to do anything, because
* scrolling may make it difficult to redraw the text under
* it. */
- if (gui.in_use)
+ 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
}
if (gui.in_use)
{
out_flush(); /* required before updating the cursor */
- if (did_one && !gui_mch_is_blink_off())
+ if (did_undraw && !gui_mch_is_blink_off())
{
/* Put the GUI position where the cursor was, gui_update_cursor()
* uses that. */
#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_dont_update_cursor(row + off <= gui.cursor_row);
#endif
if (*T_CCS != NUL) /* cursor relative to region */
}
/*
- * 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.
+ * 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.
*/
#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_dont_update_cursor(gui.cursor_row >= row + off
+ && gui.cursor_row < end + off);
#endif
if (*T_CCS != NUL) /* cursor relative to region */