Skip to content

:drop +line does not work if the buffer is already open in a window #33338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jyn514 opened this issue Apr 5, 2025 · 2 comments · Fixed by #33339
Closed

:drop +line does not work if the buffer is already open in a window #33338

jyn514 opened this issue Apr 5, 2025 · 2 comments · Fixed by #33339
Milestone

Comments

@jyn514
Copy link
Contributor

jyn514 commented Apr 5, 2025

Problem

Normally, :drop +41 foo.txt will open foo.txt with the cursor on line 41. however, 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

Expected behavior

The cursor should move from line 1 to line 30.

Nvim version (nvim -v)

NVIM v0.11.0 Build type: Release LuaJIT 2.1.1741730670 Run "nvim -V1 -v" for more info

Vim (not Nvim) behaves the same?

yes, vim 8.2: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 03 2025 11:54:38) Included patches: 1-16, 647, 17-579, 1969, 580-647, 678, 648-1848, 4975, 5016, 5023, 5072, 2068, 1849-1854, 1857, 1855-1857, 1331, 1858, 1858-1859, 1873, 1860-1969, 1992, 1970-1992, 2010, 1993-2068, 2106, 2069-2106, 2108, 2107-2109, 2109-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919, 213, 1840, 1846-1847, 2110-2112, 2121

Operating system/version

popOS 22.04

Terminal name/version

kitty 0.39.1

$TERM environment variable

tmux-256color

Installation

directly from github releases

@jyn514
Copy link
Contributor Author

jyn514 commented Apr 5, 2025

implemented here:

goto_tabpage_win(tp, wp);

i see it calling goto_tabpage_win, but it never handles the ++opt and +cmd arguments.

it's not trivial to fix because :first gives an error if the file is modified and :drop shouldn't.

@jyn514
Copy link
Contributor Author

jyn514 commented Apr 5, 2025

oh, i am wrong. :first does not error on modified files. it errors if and only if the current file is the same as the file to edit, lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants