Do not compute $history in builtin set.

Most uses of set don't care about the value of $history, and it
can be expensive to compute.

See #6290
This commit is contained in:
Johannes Altmanninger
2019-11-05 16:47:01 +01:00
parent e1e82ecd40
commit 939d4674e4
3 changed files with 24 additions and 9 deletions

View File

@@ -36,6 +36,7 @@
#include "expand.h"
#include "fallback.h" // IWYU pragma: keep
#include "function.h"
#include "history.h"
#include "iothread.h"
#include "parse_constants.h"
#include "parse_util.h"
@@ -1193,7 +1194,7 @@ bool completer_t::complete_variable(const wcstring &str, size_t start_offset) {
if (this->type() != COMPLETE_AUTOSUGGEST) {
// $history can be huge, don't put it in the completion description; see #6288.
if (env_name == L"history") {
desc = format_string(L"Full history of interactive commands");
desc = history_variable_description;
} else {
// Can't use this->vars here, it could be any variable.
auto var = vars.get(env_name);