From 23eb6e9c09fa5b022eba254fcb07007ffcfc3b14 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 5 Nov 2019 12:59:49 +0100 Subject: [PATCH] Don't compute $history for variable completion description Fixes #6288 --- src/complete.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/complete.cpp b/src/complete.cpp index 94e162366..0120f03d9 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -1190,13 +1190,18 @@ bool completer_t::complete_variable(const wcstring &str, size_t start_offset) { wcstring desc; if (this->wants_descriptions()) { - // Can't use this->vars here, it could be any variable. - auto var = vars.get(env_name); - if (!var) continue; - if (this->type() != COMPLETE_AUTOSUGGEST) { - wcstring value = expand_escape_variable(*var); - desc = format_string(COMPLETE_VAR_DESC_VAL, value.c_str()); + // $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"); + } else { + // Can't use this->vars here, it could be any variable. + auto var = vars.get(env_name); + if (!var) continue; + + wcstring value = expand_escape_variable(*var); + desc = format_string(COMPLETE_VAR_DESC_VAL, value.c_str()); + } } }