fix(startup): stop TUI properly when quitting at swap dialog (#25337)

This commit is contained in:
zeertzjq
2023-09-24 16:29:07 +08:00
committed by GitHub
parent ac1c23442f
commit 9637b7dae4
2 changed files with 103 additions and 8 deletions

View File

@@ -341,7 +341,7 @@ int main(int argc, char **argv)
uint64_t rv = ui_client_start_server(params.argc, params.argv);
if (!rv) {
os_errmsg("Failed to start Nvim server!\n");
getout(1);
os_exit(1);
}
ui_client_channel_id = rv;
}
@@ -1582,6 +1582,7 @@ static void handle_tag(char *tagname)
// If the user doesn't want to edit the file then we quit here.
if (swap_exists_did_quit) {
ui_call_error_exit(1);
getout(1);
}
}
@@ -1725,6 +1726,7 @@ static void create_windows(mparm_T *parmp)
if (got_int || only_one_window()) {
// abort selected or quit and only one window
did_emsg = false; // avoid hit-enter prompt
ui_call_error_exit(1);
getout(1);
}
// We can't close the window, it would disturb what
@@ -1828,6 +1830,7 @@ static void edit_buffers(mparm_T *parmp, char *cwd)
if (got_int || only_one_window()) {
// abort selected and only one window
did_emsg = false; // avoid hit-enter prompt
ui_call_error_exit(1);
getout(1);
}
win_close(curwin, true, false);
@@ -2238,6 +2241,7 @@ static void usage(void)
static void check_swap_exists_action(void)
{
if (swap_exists_action == SEA_QUIT) {
ui_call_error_exit(1);
getout(1);
}
handle_swap_exists(NULL);