mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
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().
This commit is contained in:
@@ -888,6 +888,17 @@ void ex_drop(exarg_T *eap)
|
||||
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
|
||||
ex_rewind(eap);
|
||||
}
|
||||
|
||||
// execute [+cmd]
|
||||
if (eap->do_ecmd_cmd) {
|
||||
bool did_set_swapcommand = set_swapcommand(eap->do_ecmd_cmd, 0);
|
||||
do_cmdline(eap->do_ecmd_cmd, NULL, NULL, DOCMD_VERBOSE);
|
||||
if (did_set_swapcommand) {
|
||||
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// no need to execute [++opts] - they only apply for newly loaded buffers.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user