diff options
author | jyn <github@jyn.dev> | 2025-04-08 08:54:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-08 05:54:32 -0700 |
commit | 3647b821ea69ea095ccc4bf8c265df474333a5d5 (patch) | |
tree | 626ae9dfd2fda5fb8fb150a1ea2f72926240c002 /test | |
parent | 5b1561bb717eae8781ff62646c675c7e842e4444 (diff) | |
download | rneovim-3647b821ea69ea095ccc4bf8c265df474333a5d5.tar.gz rneovim-3647b821ea69ea095ccc4bf8c265df474333a5d5.tar.bz2 rneovim-3647b821ea69ea095ccc4bf8c265df474333a5d5.zip |
fix(editor): respect [+cmd] when executing :drop #33339
Problem:
Normally, `:drop +41 foo.txt` will open foo.txt with the cursor on line
41. But if foo.txt is already open, it instead is a no-op, even if the
cursor is on a different line.
Steps to reproduce:
nvim --clean foo.txt
:drop +30 foo.txt
Solution:
Handle +cmd in ex_drop().
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ex_cmds/drop_spec.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/drop_spec.lua b/test/functional/ex_cmds/drop_spec.lua index d341c823b9..cd1ca978aa 100644 --- a/test/functional/ex_cmds/drop_spec.lua +++ b/test/functional/ex_cmds/drop_spec.lua @@ -75,4 +75,25 @@ describe(':drop', function() :drop Xdrop_modified.txt | ]]) end) + + it('jumps to line number when passed +line', function() + exec([[ + edit Xdrop_line.txt + call append(0, "I just miss doing art. Don't you?") + call append(1, "It is not so hard as we have supposed.") + call append(2, "We are propelled by disaster. We are moving swiftly.") + ]]) + feed_command('drop +2 Xdrop_line.txt') + screen:expect([[ + I just miss doing art. Don't you? | + ^It is not so hard as we have suppos| + ed. | + We are propelled by disaster. We ar| + e moving swiftly. | + | + {0:~ }|*2 + {1:Xdrop_line.txt [+] }| + :drop +2 Xdrop_line.txt | + ]]) + end) end) |