mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:41:42 +08:00
Migrate the fix for 6892 into reader itself
No functional change here; this migrates the fix ensuring that history items are available in the builtin interactive read command into the reader itself, in preparation for removing reader_get_history().
This commit is contained in:
parent
869c42d72a
commit
49c8ed9765
|
@ -220,9 +220,8 @@ static int read_interactive(parser_t &parser, wcstring &buff, int nchars, bool s
|
|||
|
||||
conf.in = in;
|
||||
|
||||
// Don't keep history.
|
||||
// Keep in-memory history only.
|
||||
reader_push(parser, wcstring{}, std::move(conf));
|
||||
reader_get_history()->resolve_pending();
|
||||
|
||||
reader_set_buffer(commandline, std::wcslen(commandline));
|
||||
scoped_push<bool> interactive{&parser.libdata().is_interactive, true};
|
||||
|
|
|
@ -2568,6 +2568,7 @@ static std::shared_ptr<reader_data_t> reader_push_ret(parser_t &parser,
|
|||
const wcstring &history_name,
|
||||
reader_config_t &&conf) {
|
||||
std::shared_ptr<history_t> hist = history_t::with_name(history_name);
|
||||
hist->resolve_pending(); // see #6892
|
||||
auto data = std::make_shared<reader_data_t>(parser.shared(), hist, std::move(conf));
|
||||
reader_data_stack.push_back(data);
|
||||
data->command_line_changed(&data->command_line);
|
||||
|
|
|
@ -240,8 +240,8 @@ struct reader_config_t {
|
|||
int in{0};
|
||||
};
|
||||
|
||||
/// Push a new reader environment controlled by \p conf.
|
||||
/// If \p history_name is not empty, then use the history with that name.
|
||||
/// Push a new reader environment controlled by \p conf, using the given history name.
|
||||
/// If \p history_name is empty, then save history in-memory only; do not write it to disk.
|
||||
void reader_push(parser_t &parser, const wcstring &history_name, reader_config_t &&conf);
|
||||
|
||||
/// Return to previous reader environment.
|
||||
|
|
Loading…
Reference in New Issue
Block a user