diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2024-03-15 00:39:44 +0100 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2024-03-15 09:15:56 +0100 |
commit | d41b8d47587bd4c300420fa76f517298e97af513 (patch) | |
tree | cae0a4702badcb3e52a200d6bfd301fc19eab3c1 /test/functional/ui/cmdline_spec.lua | |
parent | c971f538ab87b537ae4c97bd44167661c5691a2d (diff) | |
download | rneovim-d41b8d47587bd4c300420fa76f517298e97af513.tar.gz rneovim-d41b8d47587bd4c300420fa76f517298e97af513.tar.bz2 rneovim-d41b8d47587bd4c300420fa76f517298e97af513.zip |
fix(ui): ext_cmdline should not move cursor to curwin
Problem: The ext_cmdline cursor position on the screen seems to rely on
an implicit assumption that the event listener implements a
cmdline window that is made the current window which is
problematic (e.g. breaks 'incsearch' in the actual current
window).
Solution: Remove this assumption and allow nvim_win_set_cursor() to move
the cursor on the screen to a non-current window (previous
commit).
Diffstat (limited to 'test/functional/ui/cmdline_spec.lua')
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 0eb5770819..3b5b488982 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -824,6 +824,29 @@ local function test_cmdline(linegrid) | ]]) end) + + it('does not move cursor to curwin #20309', function() + local win = api.nvim_get_current_win() + command('norm icmdlinewin') + command('new') + command('norm icurwin') + feed(':') + api.nvim_win_set_cursor(win, { 1, 7 }) + screen:expect { + grid = [[ + curwin | + {3:[No Name] [+] }| + cmdline^win | + {2:[No Name] [+] }| + | + ]], + cmdline = { { + content = { { '' } }, + firstc = ':', + pos = 0, + } }, + } + end) end -- the representation of cmdline and cmdline_block contents changed with ext_linegrid |