From 7da695f64b647eff0744e545124f51dd04194757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Sat, 15 Jun 2019 22:13:03 +0200 Subject: 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' --- edit-readline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'edit-readline.c') diff --git a/edit-readline.c b/edit-readline.c index 46c1c14..4be8f1e 100644 --- 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 '&': -- cgit v1.2.3