mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
Add exit
bind function
Currently binding `exit` to a key checks too late that it's exitted, so it leaves the shell hanging around until the user does an execute or similar. As I understand it, the `exit` builtin is supposed to only exit the current "thread" (once that actually becomes a thing), and the bindings would probably run in a dedicated one, so the simplest solution here is to just add an `exit` bind function. Fixes #7604.
This commit is contained in:
parent
4116aaeb5f
commit
6eeb8861e7
4 changed files with 11 additions and 0 deletions
|
@ -126,6 +126,8 @@ The following special input functions are available:
|
|||
|
||||
- ``execute``, run the current commandline
|
||||
|
||||
- ``exit``, exit the shell
|
||||
|
||||
- ``forward-bigword``, move one whitespace-delimited word to the right
|
||||
|
||||
- ``forward-char``, move one character to the right
|
||||
|
|
|
@ -152,6 +152,7 @@ static const input_function_metadata_t input_function_metadata[] = {
|
|||
{readline_cmd_t::func_or, L"or"},
|
||||
{readline_cmd_t::expand_abbr, L"expand-abbr"},
|
||||
{readline_cmd_t::delete_or_exit, L"delete-or-exit"},
|
||||
{readline_cmd_t::exit, L"exit"},
|
||||
{readline_cmd_t::cancel_commandline, L"cancel-commandline"},
|
||||
{readline_cmd_t::cancel, L"cancel"},
|
||||
{readline_cmd_t::undo, L"undo"},
|
||||
|
|
|
@ -75,6 +75,7 @@ enum class readline_cmd_t {
|
|||
func_or,
|
||||
expand_abbr,
|
||||
delete_or_exit,
|
||||
exit,
|
||||
cancel_commandline,
|
||||
cancel,
|
||||
undo,
|
||||
|
|
|
@ -3076,6 +3076,13 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
|
|||
delete_char();
|
||||
break;
|
||||
}
|
||||
case rl::exit: {
|
||||
// This is by definition a successful exit, override the status
|
||||
parser().set_last_statuses(statuses_t::just(STATUS_CMD_OK));
|
||||
exit_loop_requested = true;
|
||||
check_exit_loop_maybe_warning(this);
|
||||
break;
|
||||
}
|
||||
case rl::delete_or_exit:
|
||||
case rl::delete_char: {
|
||||
// Remove the current character in the character buffer and on the screen using
|
||||
|
|
Loading…
Reference in a new issue