Get history working in web_config again

This commit is contained in:
ridiculousfish 2018-09-08 22:13:54 -07:00
parent b9c50e400f
commit 6e6fcda8e2
3 changed files with 5 additions and 4 deletions

View file

@ -328,9 +328,10 @@ static bool expand_variables(const wcstring &instr, std::vector<completion_t> *o
history_t *history = nullptr;
maybe_t<env_var_t> var{};
if (var_name == L"history") {
// We do this only on the main thread, matching env.cpp.
// Note reader_get_history may return null, if we are running non-interactively (e.g. from
// web_config).
if (is_main_thread()) {
history = reader_get_history();
history = &history_t::history_with_name(history_session_id());
}
} else if (var_name != wcstring{VARIABLE_EXPAND_EMPTY}) {
var = env_get(var_name);

View file

@ -2026,7 +2026,7 @@ static parser_test_error_bits_t default_test(const wcstring &b) {
return 0;
}
void reader_change_history(const wchar_t *name) {
void reader_change_history(const wcstring &name) {
// We don't need to _change_ if we're not initialized yet.
reader_data_t *data = current_data_or_null();
if (data && data->history) {

View file

@ -70,7 +70,7 @@ const wchar_t *reader_current_filename();
void reader_push_current_filename(const wchar_t *fn);
/// Change the history file for the current command reading context.
void reader_change_history(const wchar_t *fn);
void reader_change_history(const wcstring &name);
/// Pop the current filename from the stack of read files.
void reader_pop_current_filename();