diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-26 07:00:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 07:00:37 +0800 |
commit | a6c9764edaa349f5f268e5e3bf8b940e137fb5c4 (patch) | |
tree | 22feafa1fce1e24f281a70733cc8599efb50f03e /src | |
parent | f8a1cadccff39923643fdea2e282be9fffa60e99 (diff) | |
download | rneovim-a6c9764edaa349f5f268e5e3bf8b940e137fb5c4.tar.gz rneovim-a6c9764edaa349f5f268e5e3bf8b940e137fb5c4.tar.bz2 rneovim-a6c9764edaa349f5f268e5e3bf8b940e137fb5c4.zip |
fix(inccommand): deal with unsynced undo (#20041)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_getln.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 2d39ced582..0ccc12c9b4 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -136,6 +136,7 @@ typedef struct cmdpreview_win_info { typedef struct cmdpreview_buf_info { buf_T *buf; + bool save_b_u_synced; time_t save_b_u_time_cur; long save_b_u_seq_cur; u_header_T *save_b_u_newhead; @@ -2131,6 +2132,7 @@ static void cmdpreview_prepare(CpInfo *cpinfo) CpBufInfo cp_bufinfo; cp_bufinfo.buf = buf; + cp_bufinfo.save_b_u_synced = buf->b_u_synced; cp_bufinfo.save_b_u_time_cur = buf->b_u_time_cur; cp_bufinfo.save_b_u_seq_cur = buf->b_u_seq_cur; cp_bufinfo.save_b_u_newhead = buf->b_u_newhead; @@ -2168,6 +2170,8 @@ static void cmdpreview_prepare(CpInfo *cpinfo) cmdmod.cmod_split = 0; // Disable :leftabove/botright modifiers cmdmod.cmod_tab = 0; // Disable :tab modifier cmdmod.cmod_flags |= CMOD_NOSWAPFILE; // Disable swap for preview buffer + + u_sync(true); } // Restore the state of buffers and windows before command preview. @@ -2200,6 +2204,11 @@ static void cmdpreview_restore_state(CpInfo *cpinfo) buf->b_u_newhead = cp_bufinfo.save_b_u_newhead; buf->b_u_time_cur = cp_bufinfo.save_b_u_time_cur; } + + if (buf->b_u_curhead == NULL) { + buf->b_u_synced = cp_bufinfo.save_b_u_synced; + } + if (cp_bufinfo.save_changedtick != buf_get_changedtick(buf)) { buf_set_changedtick(buf, cp_bufinfo.save_changedtick); } |