diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:15:05 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:27:38 +0000 |
commit | c5d770d311841ea5230426cc4c868e8db27300a8 (patch) | |
tree | dd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/functional/ui/inccommand_user_spec.lua | |
parent | 9be89f131f87608f224f0ee06d199fcd09d32176 (diff) | |
parent | 081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff) | |
download | rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2 rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/ui/inccommand_user_spec.lua')
-rw-r--r-- | test/functional/ui/inccommand_user_spec.lua | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua index 12f3640b54..2d26d2c5e0 100644 --- a/test/functional/ui/inccommand_user_spec.lua +++ b/test/functional/ui/inccommand_user_spec.lua @@ -239,7 +239,6 @@ describe("'inccommand' for user commands", function() before_each(function() clear() screen = Screen.new(40, 17) - screen:attach() exec_lua(setup_replace_cmd) command('set cmdwinheight=5') insert [[ @@ -508,6 +507,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() @@ -516,7 +548,6 @@ describe("'inccommand' with multiple buffers", function() before_each(function() clear() screen = Screen.new(40, 17) - screen:attach() exec_lua(setup_replace_cmd) command('set cmdwinheight=10') insert [[ |