mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Fix special readline functions after and/or
Here we needed to handle self-insert immediately, but we ended up returning it. Fixes #9051
This commit is contained in:
parent
98ba66ed8e
commit
d920610f96
|
@ -752,12 +752,12 @@ char_event_t inputter_t::read_char(const command_handler_t &command_handler) {
|
||||||
}
|
}
|
||||||
case readline_cmd_t::func_and:
|
case readline_cmd_t::func_and:
|
||||||
case readline_cmd_t::func_or: {
|
case readline_cmd_t::func_or: {
|
||||||
// If previous function has right status, we keep reading tokens
|
// If previous function has correct status, we keep reading tokens
|
||||||
if (evt.get_readline() == readline_cmd_t::func_and) {
|
if (evt.get_readline() == readline_cmd_t::func_and) {
|
||||||
if (function_status_) return readch();
|
// Don't return immediately, we might need to handle it here - like self-insert.
|
||||||
|
if (function_status_) continue;
|
||||||
} else {
|
} else {
|
||||||
assert(evt.get_readline() == readline_cmd_t::func_or);
|
if (!function_status_) continue;
|
||||||
if (!function_status_) return readch();
|
|
||||||
}
|
}
|
||||||
// Else we flush remaining tokens
|
// Else we flush remaining tokens
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -292,6 +292,16 @@ send("echo git@github.com:fish-shell/fish-shell")
|
||||||
send("\x17\x17\x17\r")
|
send("\x17\x17\x17\r")
|
||||||
expect_prompt("git@", unmatched="ctrl-w does not stop at @")
|
expect_prompt("git@", unmatched="ctrl-w does not stop at @")
|
||||||
|
|
||||||
|
sendline("abbr --add foo 'echo foonanana'")
|
||||||
|
expect_prompt()
|
||||||
|
sendline("bind ' ' expand-abbr or self-insert")
|
||||||
|
expect_prompt()
|
||||||
|
send("foo ")
|
||||||
|
expect_str("echo foonanana")
|
||||||
|
send(" banana\r")
|
||||||
|
expect_str(" banana\r")
|
||||||
|
expect_prompt("foonanana banana")
|
||||||
|
|
||||||
# Ensure that nul can be bound properly (#3189).
|
# Ensure that nul can be bound properly (#3189).
|
||||||
send("bind -k nul 'echo nul seen'\r")
|
send("bind -k nul 'echo nul seen'\r")
|
||||||
expect_prompt()
|
expect_prompt()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user