diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-01-21 05:14:40 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-01-21 05:14:40 +0800 |
commit | 2fa1b4cbff06b6dabc6d59df585953e9220e5007 (patch) | |
tree | 3af3e562654ce5fe3cefb835628098fa5bfffdfb /src/nvim/buffer.c | |
parent | 431915fe6af4e176a84a60c95ad7aa9d36b71e50 (diff) | |
download | rneovim-2fa1b4cbff06b6dabc6d59df585953e9220e5007.tar.gz rneovim-2fa1b4cbff06b6dabc6d59df585953e9220e5007.tar.bz2 rneovim-2fa1b4cbff06b6dabc6d59df585953e9220e5007.zip |
vim-patch:8.2.4166: undo synced when switching buffer in another window
Problem: Undo synced when switching buffer in another window.
Solution: Do not sync undo when not needed. (closes vim/vim#9575)
https://github.com/vim/vim/commit/e615db06046312e74886fa1ef98feb5a9db2a7c3
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index abd22fba26..83c95da4f7 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1454,7 +1454,10 @@ void set_curbuf(buf_T *buf, int action) } if (bufref_valid(&prevbufref) && !aborting()) { win_T *previouswin = curwin; - if (prevbuf == curbuf) { + // Do not sync when in Insert mode and the buffer is open in + // another window, might be a timer doing something in another + // window. + if (prevbuf == curbuf && ((State & INSERT) == 0 || curbuf->b_nwindows <= 1)) { u_sync(false); } close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, |