Problem: Listener callbacks may be called recursively.
Solution: Set "updating_screen" while listener callbacks are invoked.
linenr_T start = MAXLNUM;
linenr_T end = 0;
linenr_T added = 0;
+ int save_updating_screen = updating_screen;
+ static int recursive = FALSE;
if (buf->b_recorded_changes == NULL // nothing changed
- || buf->b_listener == NULL) // no listeners
+ || buf->b_listener == NULL // no listeners
+ || recursive) // already busy
return;
+ recursive = TRUE;
+
+ // Block messages on channels from being handled, so that they don't make
+ // text changes here.
+ ++updating_screen;
argv[0].v_type = VAR_NUMBER;
argv[0].vval.v_number = buf->b_fnum; // a:bufnr
--textlock;
list_unref(buf->b_recorded_changes);
buf->b_recorded_changes = NULL;
+
+ if (save_updating_screen)
+ updating_screen = TRUE;
+ else
+ after_updating_screen(TRUE);
+ recursive = FALSE;
}
#endif
int redraw_asap(int type);
void redraw_after_callback(int call_update_screen);
void redrawWinline(win_T *wp, linenr_T lnum);
-void reset_updating_screen(int may_resize_shell);
+void after_updating_screen(int may_resize_shell);
void update_curbuf(int type);
int update_screen(int type_arg);
int conceal_cursor_line(win_T *wp);
void update_debug_sign(buf_T *buf, linenr_T lnum);
void updateWindow(win_T *wp);
int screen_get_current_line_off(void);
-void screen_line(int row, int coloff, int endcol, int clear_width, int rlflag);
+void screen_line(int row, int coloff, int endcol, int clear_width, int flags);
void rl_mirror(char_u *str);
void status_redraw_all(void);
void status_redraw_curbuf(void);
redraw_win_later(wp, VALID);
}
+/*
+ * To be called when "updating_screen" was set before and now the postponed
+ * side effects may take place.
+ */
void
-reset_updating_screen(int may_resize_shell UNUSED)
+after_updating_screen(int may_resize_shell UNUSED)
{
updating_screen = FALSE;
#ifdef FEAT_GUI
FOR_ALL_WINDOWS(wp)
wp->w_buffer->b_mod_set = FALSE;
- reset_updating_screen(TRUE);
+ after_updating_screen(TRUE);
/* Clear or redraw the command line. Done last, because scrolling may
* mess up the command line. */
end_search_hl();
# endif
- reset_updating_screen(TRUE);
+ after_updating_screen(TRUE);
# ifdef FEAT_GUI
/* Redraw the cursor and update the scrollbars when all screen updating is
if (save_updating_screen)
updating_screen = TRUE;
else
- reset_updating_screen(FALSE);
+ after_updating_screen(FALSE);
recursive = FALSE;
}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1419,
/**/
1418,
/**/