mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
Stop ignoring initial command in read -c
`read` allows specifying the initial command line text. This was
text got accidentally ignored starting in a32248277f
. Fix this
regression and add a test.
Fixes #8633
This commit is contained in:
parent
49a0362c12
commit
1f8ce5ff6c
2 changed files with 18 additions and 1 deletions
|
@ -4189,7 +4189,12 @@ bool reader_data_t::jump(jump_direction_t dir, jump_precision_t precision, edita
|
|||
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 res = reader_test_and_clear_interrupted();
|
||||
|
|
|
@ -54,6 +54,18 @@ expect_prompt()
|
|||
expect_marker(2)
|
||||
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
|
||||
|
||||
sendline("read -s foo")
|
||||
|
|
Loading…
Reference in a new issue