diff options
| author | Bert Münnich <ber.t@posteo.de> | 2019-06-15 22:13:03 +0200 |
|---|---|---|
| committer | Bert Münnich <ber.t@posteo.de> | 2019-12-06 17:57:34 +0100 |
| commit | 7da695f64b647eff0744e545124f51dd04194757 (patch) | |
| tree | 7a966cdec8adef3b462924664bcb6990ef7b9622 /edit-readline.c | |
| parent | 459dd7b4bc6225e712b25359785558cb61283113 (diff) | |
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 (limited to 'edit-readline.c')
| -rw-r--r-- | edit-readline.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 '&': |