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:
ridiculousfish
2022-01-16 13:34:45 -08:00
parent 49a0362c12
commit 1f8ce5ff6c
2 changed files with 18 additions and 1 deletions

View File

@@ -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();