mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Stop ignoring initial command in read -c
`read` allows specifying the initial command line text. This was text got accidentally ignored starting in a32248277f026fb. Fix this regression and add a test. Fixes #8633
This commit is contained in:
parent
49a0362c12
commit
1f8ce5ff6c
@ -4189,7 +4189,12 @@ bool reader_data_t::jump(jump_direction_t dir, jump_precision_t precision, edita
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_t<wcstring> reader_readline(int nchars) { return current_data()->readline(nchars); }
|
maybe_t<wcstring> reader_readline(int nchars) {
|
||||||
|
auto *data = current_data();
|
||||||
|
// Apply any outstanding commandline changes (#8633).
|
||||||
|
data->apply_commandline_state_changes();
|
||||||
|
return data->readline(nchars);
|
||||||
|
}
|
||||||
|
|
||||||
int reader_reading_interrupted() {
|
int reader_reading_interrupted() {
|
||||||
int res = reader_test_and_clear_interrupted();
|
int res = reader_test_and_clear_interrupted();
|
||||||
|
@ -54,6 +54,18 @@ expect_prompt()
|
|||||||
expect_marker(2)
|
expect_marker(2)
|
||||||
print_var_contents("foo", "bar")
|
print_var_contents("foo", "bar")
|
||||||
|
|
||||||
|
# read -c (see #8633)
|
||||||
|
sendline(r"read -c init_text somevar && echo $somevar")
|
||||||
|
expect_re("\r\n?read> init_text$")
|
||||||
|
sendline("someval")
|
||||||
|
expect_prompt("someval\r\n")
|
||||||
|
|
||||||
|
sendline(r"read --command='some other text' somevar && echo $somevar")
|
||||||
|
expect_re("\r\n?read> some other text$")
|
||||||
|
sendline("another value")
|
||||||
|
expect_prompt("another value\r\n")
|
||||||
|
|
||||||
|
|
||||||
# read -s
|
# read -s
|
||||||
|
|
||||||
sendline("read -s foo")
|
sendline("read -s foo")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user