mirror of
https://github.com/neovim/neovim.git
synced 2026-07-23 09:23:09 +00:00
fix(restart): messages EXX error codes #40759
This commit is contained in:
@@ -75,7 +75,7 @@ Stop or detach the current UI
|
||||
------------------------------------------------------------------------------
|
||||
Restart Nvim
|
||||
|
||||
*:restart* *:restart!*
|
||||
*:restart* *:restart!* *E5201*
|
||||
:restart[!] [+cmd] [command]
|
||||
Restarts Nvim. Saves and restores the current session, unless
|
||||
[!] is given. Sets |v:exitreason|. See also |ZR|.
|
||||
|
||||
@@ -234,6 +234,8 @@ EXTERN const char e_conflicting_configs[] INIT(= N_("E5422: Conflicting configs:
|
||||
|
||||
EXTERN const char e_unknown_option2[] INIT(= N_("E355: Unknown option: %s"));
|
||||
|
||||
EXTERN const char e_restart_failed_cmd_no_quit[] INIT(= N_("E5201: Restart failed: +cmd did not quit server: %s"));
|
||||
|
||||
EXTERN const char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
|
||||
EXTERN const char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
|
||||
|
||||
|
||||
@@ -4987,7 +4987,7 @@ static void ex_restart(exarg_T *eap)
|
||||
quit_cmd = eap->args[1];
|
||||
after_cmd = eap->argc > 2 ? eap->args[2] : "";
|
||||
} else {
|
||||
emsg("restart failed: +cmd did not quit the server");
|
||||
semsg(e_restart_failed_cmd_no_quit, quit_cmd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -5183,14 +5183,14 @@ static void ex_restart(exarg_T *eap)
|
||||
}
|
||||
// Try to quit.
|
||||
nvim_command(cstr_as_string(quit_cmd), &err);
|
||||
xfree(quit_cmd_copy);
|
||||
|
||||
if (ERROR_SET(&err)) {
|
||||
emsg(err.msg); // Could not exit
|
||||
api_clear_error(&err);
|
||||
} else if (!exiting) {
|
||||
emsg("restart failed: +cmd did not quit the server");
|
||||
semsg(e_restart_failed_cmd_no_quit, quit_cmd);
|
||||
}
|
||||
xfree(quit_cmd_copy);
|
||||
|
||||
fail_2:
|
||||
set_vim_var_string(VV_EXITREASON, NULL, -1);
|
||||
|
||||
@@ -444,6 +444,9 @@ describe('TUI :restart', function()
|
||||
'set laststatus=2 background=dark noruler noshowcmd',
|
||||
}, { env = { COLORTERM = 'truecolor' } })
|
||||
screen:set_option('rgb', true)
|
||||
screen:add_extra_attr_ids({
|
||||
[101] = { bold = true, foreground = Screen.colors.WebGreen },
|
||||
})
|
||||
|
||||
-- 'termguicolors' support should be detected properly after :restart!
|
||||
-- The value of has("gui_running") should be 0 before and after :restart!
|
||||
@@ -533,12 +536,15 @@ describe('TUI :restart', function()
|
||||
for _, cmd in ipairs({ ':restart', ':restart!' }) do
|
||||
tt.feed_data(cmd .. ' +echo\013')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~}{18: }|*3
|
||||
{3:[No Name] }|
|
||||
{9:restart failed: +cmd did not quit the server} |
|
||||
|
|
||||
{1:~}{18: }|
|
||||
{3: }|
|
||||
{9:E5201: Restart failed: +cmd did not quit server: e}|
|
||||
{9:cho} |
|
||||
{101:Press ENTER or type command to continue}^ |
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
tt.feed_data('\013')
|
||||
end
|
||||
|
||||
tt.feed_data('ithis will be removed\027')
|
||||
@@ -575,7 +581,7 @@ describe('TUI :restart', function()
|
||||
|
||||
-- Check ":confirm restart! +echo" correctly ignores ":confirm"
|
||||
tt.feed_data(':confirm restart! +echo\013')
|
||||
screen:expect({ any = vim.pesc('+cmd did not quit the server') })
|
||||
screen:expect({ any = vim.pesc('E5201: Restart failed: +cmd did not quit server') })
|
||||
|
||||
-- Check ":restart[!]" on a modified buffer.
|
||||
tt.feed_data('ithis will be removed\027')
|
||||
|
||||
Reference in New Issue
Block a user