commit 7da695f64b647eff0744e545124f51dd04194757
parent 459dd7b4bc6225e712b25359785558cb61283113
Author: Bert Münnich <ber.t@posteo.de>
Date: Sat, 15 Jun 2019 22:13:03 +0200
Fix tab completion of quoted commands and variables
An open quoted string was always completed as a filename. The type of
completion is now guessed based on the token preceding the opening quote in the
same way as it is done for unqoted words.
; 'fals -> ; 'false'
; echo $'hom -> ; echo $'home'
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/edit-readline.c b/edit-readline.c
@@ -160,10 +160,10 @@ static rl_compentry_func_t *compl_func(const char *text, int start, int end) {
char last = ';', *s, *t;
for (s = &rl_line_buffer[0], t = &rl_line_buffer[start]; s < t; s++) {
- if (!quote && *s != ' ' && *s != '\t')
- last = *s;
if (*s == '\'')
quote = !quote;
+ if (!quote && *s != ' ' && *s != '\t')
+ last = *s;
}
switch (last) {
case '`': case '@': case '|': case '&':