aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-11-08 11:22:14 +0100
committerGitHub <noreply@github.com>2024-11-08 11:22:14 +0100
commit8ab1903092f0ab193adf17ee635da838cce01dfa (patch)
tree85e11afe668a2fe1c1b67fa946a5955ff50b7f7a /test
parentf83a31b49d5d976cd39f7faa6356565cb0a4a97a (diff)
parent59e130b6cacd71326ecc99ca180fd574abc8115c (diff)
downloadrneovim-8ab1903092f0ab193adf17ee635da838cce01dfa.tar.gz
rneovim-8ab1903092f0ab193adf17ee635da838cce01dfa.tar.bz2
rneovim-8ab1903092f0ab193adf17ee635da838cce01dfa.zip
Merge pull request #31040 from luukvbaal/cmdpreviewcurs
fix(inccommand): ensure cursor is where it belongs
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/inccommand_user_spec.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua
index 12f3640b54..e8b546d33a 100644
--- a/test/functional/ui/inccommand_user_spec.lua
+++ b/test/functional/ui/inccommand_user_spec.lua
@@ -508,6 +508,39 @@ describe("'inccommand' for user commands", function()
feed(':Test')
eq('nosplit', api.nvim_get_option_value('inccommand', {}))
end)
+
+ it('does not flush intermediate cursor position at end of message grid', function()
+ exec_lua([[
+ vim.api.nvim_create_user_command('Test', function() end, {
+ nargs = '*',
+ preview = function(_, _, _)
+ vim.api.nvim_buf_set_text(0, 0, 0, 1, -1, { "Preview" })
+ vim.cmd.sleep("1m")
+ return 1
+ end
+ })
+ ]])
+ local cursor_goto = screen._handle_grid_cursor_goto
+ screen._handle_grid_cursor_goto = function(...)
+ cursor_goto(...)
+ assert(screen._cursor.col < 12)
+ end
+ feed(':Test baz<Left><Left>arb')
+ screen:expect({
+ grid = [[
+ Preview |
+ oh no, even more text |
+ will the text ever stop |
+ oh well |
+ did the text stop |
+ why won't it stop |
+ make the text stop |
+ |
+ {1:~ }|*8
+ :Test barb^az |
+ ]],
+ })
+ end)
end)
describe("'inccommand' with multiple buffers", function()