mirror of
https://github.com/neovim/neovim.git
synced 2026-08-04 22:58:50 +00:00
Problem: Calling `:restart` twice erases the original args passed to `nvim`. This is caused by interactions between the `:restart` command handler, the `v:argv` parsing logic in the UI restart handler, and the options added to `v:argv` by the server upon restart. For example, * Launch `nvim` as `nvim foo`: * initial argv: `nvim foo` * after nvim server launch: `nvim --embed foo` * Run `:restart` * after `ex_restart()`: `nvim -c '' --embed foo` * after `remote_ui_restart()`: `nvim -c '' foo` * after nvim server launch: `nvim --embed -c '' foo` * Run `:restart` again * after `ex_restart()`: `nvim -c '' --embed -c '' foo` * after `remote_ui_restart()`: `nvim -c ''` * after nvim server launch: `nvim --embed -c ''` The intention of the argv parser in `remote_ui_restart()` is to only take the first `-c cmd` and ignore any additional ones, but it actually ignores the rest of argv when it encounters a second `-c` and there are no `-` or `--` remaining. Solution: Fix the argv parser to reset the `skipping_minc` flag at the end of every iteration that does not reach the `continue` statement.