neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 2b539d6fdf985d765ce03964be320c69d02b376c
parent 2b252430aa9ef52de7da733e2c0221c97111bce2
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sat, 11 Jun 2022 13:04:19 +0800

fix(inccommand): clear cmdpreview state if preview is not shown (#18923)


Diffstat:
Msrc/nvim/ex_getln.c | 1+
Mtest/functional/ui/inccommand_spec.lua | 30++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c @@ -2516,6 +2516,7 @@ static void cmdpreview_show(CommandLineState *s) // If preview callback returned 0, update screen to clear remnants of an earlier preview. if (cmdpreview_type == 0) { + cmdpreview = false; update_screen(SOME_VALID); } end: diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua @@ -2907,6 +2907,36 @@ it(':substitute with inccommand, timer-induced :redraw #9777', function() ]]) end) +it(':substitute with inccommand, allows :redraw before first separator is typed #18857', function() + local screen = Screen.new(30,6) + clear() + common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz') + command('hi! link NormalFloat CursorLine') + local float_buf = meths.create_buf(false, true) + meths.open_win(float_buf, false, { + relative = 'editor', height = 1, width = 5, row = 3, col = 0, focusable = false, + }) + feed(':%s') + screen:expect([[ + foo bar baz | + bar baz fox | + bar foo baz | + {16: }{15: }| + {15:~ }| + :%s^ | + ]]) + meths.buf_set_lines(float_buf, 0, -1, true, {'foo'}) + command('redraw') + screen:expect([[ + foo bar baz | + bar baz fox | + bar foo baz | + {16:foo }{15: }| + {15:~ }| + :%s^ | + ]]) +end) + it(":substitute doesn't crash with inccommand, if undo is empty #12932", function() local screen = Screen.new(10,5) clear()