completion: fix file completion of redirection targets

This fixes a regression introduced in
6fb7f9b6b - Fix completion for builtins with subcommands
This commit is contained in:
Johannes Altmanninger
2019-12-16 12:37:41 +01:00
parent 5911fc94b8
commit b1144a1fde
2 changed files with 4 additions and 0 deletions

View File

@@ -1542,6 +1542,7 @@ void completer_t::perform() {
tok_t prev_tok = tokens.at(tokens.size() - 2);
if (prev_tok.type == token_type_t::string)
previous_argument = prev_tok.get_source(cmd);
in_redirection = prev_tok.type == token_type_t::redirect;
}
}

View File

@@ -150,3 +150,6 @@ complete -C'for _ in ' | string collect >&- && echo completed some files
# function; #5415
complete -C'function : --arg'
# CHECK: --argument-names {{.*}}
complete -C'echo > /' | string length -q && echo ok
# CHECK: ok