mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
* Reuse inccommand preview window Currently, show_sub (inside ex_substitute) creates a new split on each run for its existing buffer, and ex_substitute calls close_windows for it. This functionality seems to relay in delayed operations on window structures where the close event on the newest window is "cancelled" by win_grid_alloc. But for multigrid, there is optimization in place in win_grid_alloc which causes any (unnecessary?) allocations to be skipped, and thus inccommand preview window is not preserved but closed immediately. Alternative fix would be to remove said optimization, but the whole "lets create a new split each time and trash the earlier window" seems too wasteful. Fix #11529 * Update failing test The failing test sets inccommand=split and does `:%s/.`, but isn't expecting to get any contents for the preview window, other than the windows status line. Update the test to include the preview window contents too.
This commit is contained in:
@@ -450,6 +450,11 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
||||
ExpandCleanup(&s->xpc);
|
||||
ccline.xpc = NULL;
|
||||
|
||||
if (s->gotesc) {
|
||||
// There might be a preview window open for inccommand. Close it.
|
||||
close_preview_windows();
|
||||
}
|
||||
|
||||
if (s->did_incsearch) {
|
||||
if (s->gotesc) {
|
||||
curwin->w_cursor = s->save_cursor;
|
||||
@@ -1958,8 +1963,10 @@ static int command_line_changed(CommandLineState *s)
|
||||
update_topline();
|
||||
|
||||
redrawcmdline();
|
||||
|
||||
} else if (State & CMDPREVIEW) {
|
||||
State = (State & ~CMDPREVIEW);
|
||||
close_preview_windows();
|
||||
update_screen(SOME_VALID); // Clear 'inccommand' preview.
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user