Don't chomp foo= when completing foo=br

`complete_param_expand` knows how to handle cases like `foo=br` so we
don't need to bother sending just the `br` part. Furthermore, sending
just `br` is incorrect because we will end up replacing the entirety of
`foo=br` with the result of the completion. That is, `foo=br` will be
replaced with `bar` instead of being completed to `foo=bar`.
This commit is contained in:
Collin Styles 2020-10-13 23:26:53 -07:00 committed by Johannes Altmanninger
parent 13459d4d3a
commit da0acb28ba

View file

@ -1622,7 +1622,7 @@ void completer_t::perform_for_commandline(wcstring cmdline) {
if (cmd_tok.location_in_or_at_end_of_source_range(cursor_pos)) {
maybe_t<size_t> equal_sign_pos = variable_assignment_equals_pos(current_token);
if (equal_sign_pos) {
complete_param_expand(current_token.substr(*equal_sign_pos + 1), true /* do_file */);
complete_param_expand(current_token, true /* do_file */);
return;
}
// Complete command filename.