mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
make the read
builtin respect ctrl-C
This commit is contained in:
parent
abae08a9fb
commit
970d05df39
@ -2399,6 +2399,7 @@ static int builtin_read(parser_t &parser, wchar_t **argv)
|
|||||||
}
|
}
|
||||||
/* No autosuggestions in builtin_read */
|
/* No autosuggestions in builtin_read */
|
||||||
reader_set_allow_autosuggesting(false);
|
reader_set_allow_autosuggesting(false);
|
||||||
|
reader_set_interruptible(true);
|
||||||
|
|
||||||
reader_set_buffer(commandline, wcslen(commandline));
|
reader_set_buffer(commandline, wcslen(commandline));
|
||||||
proc_push_interactive(1);
|
proc_push_interactive(1);
|
||||||
|
15
reader.cpp
15
reader.cpp
@ -580,10 +580,23 @@ static void reader_kill(size_t begin_idx, size_t length, int mode, int newv)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Called from a signal handler, so make sure to check \c data exists.
|
||||||
|
This is in fact racey as there is no guarantee that \c *data's members are
|
||||||
|
written to memory before \c data is. But signal handling is currently racey
|
||||||
|
anyway, so this should be fixed together with the rest of the signal
|
||||||
|
handling infrastructure.
|
||||||
|
*/
|
||||||
|
static bool get_interruptible()
|
||||||
|
{
|
||||||
|
return data ? data->interruptible : false;
|
||||||
|
}
|
||||||
|
|
||||||
/* This is called from a signal handler! */
|
/* This is called from a signal handler! */
|
||||||
void reader_handle_int(int sig)
|
void reader_handle_int(int sig)
|
||||||
{
|
{
|
||||||
if (!is_interactive_read)
|
if (!is_interactive_read || get_interruptible())
|
||||||
{
|
{
|
||||||
parser_t::skip_all_blocks();
|
parser_t::skip_all_blocks();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user