complete: fix condition to suppress variable autocompletion

(cherry picked from commit b76e6c5637)
This commit is contained in:
Xiretza 2023-04-25 20:04:18 +00:00 committed by Fabian Boehm
parent 638a29badc
commit fc0e033b82

View File

@ -1234,7 +1234,7 @@ bool completer_t::try_complete_variable(const wcstring &str) {
// Now complete if we have a variable start. Note the variable text may be empty; in that case
// don't generate an autosuggestion, but do allow tab completion.
bool allow_empty = !this->flags.autosuggestion;
bool text_is_empty = (variable_start == len);
bool text_is_empty = (variable_start == len - 1);
bool result = false;
if (variable_start != wcstring::npos && (allow_empty || !text_is_empty)) {
result = this->complete_variable(str, variable_start + 1);