diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-29 22:28:29 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-29 22:28:29 +0200 |
commit | 68a4b04a8d2471adf9de595745437c7cf20b98d8 (patch) | |
tree | eafe9c0d11c84ce76950b845a512515b38f58acc /src/change.c | |
parent | 868b7b6712ea4f2232eeeae18c5cbbbddf2ee84d (diff) | |
download | vim-git-68a4b04a8d2471adf9de595745437c7cf20b98d8.tar.gz |
patch 8.1.1419: listener callbacks may be called recursivelyv8.1.1419
Problem: Listener callbacks may be called recursively.
Solution: Set "updating_screen" while listener callbacks are invoked.
Diffstat (limited to 'src/change.c')
-rw-r--r-- | src/change.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/change.c b/src/change.c index 11f4b0a16..b1a56ae4c 100644 --- a/src/change.c +++ b/src/change.c @@ -376,10 +376,18 @@ invoke_listeners(buf_T *buf) 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 @@ -418,6 +426,12 @@ invoke_listeners(buf_T *buf) --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 |