1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-12 05:01:27 +02:00

45915: fix handling of hyphens in spckword()

This commit is contained in:
Bart Schaefer 2020-05-30 14:31:10 -07:00
parent 911500d3be
commit 94e38548e3
2 changed files with 15 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2020-05-30 Bart Schaefer <schaefer@zsh.org>
* 45915: Src/utils.c: fix handling of hyphens in spckword()
2020-05-28 Yasuhiro KIMURA <yasu@utahime.org>
* 45934: Completion/Unix/Command/_subversion: Make 'svnliteadmin'

View file

@ -3128,12 +3128,14 @@ spckword(char **s, int hist, int cmd, int ask)
int preflen = 0;
int autocd = cmd && isset(AUTOCD) && strcmp(*s, ".") && strcmp(*s, "..");
if ((histdone & HISTFLAG_NOEXEC) || **s == '-' || **s == '%')
if (!(*s)[0] || !(*s)[1])
return;
if ((histdone & HISTFLAG_NOEXEC) ||
/* Leading % is a job, else leading hyphen is an option */
(cmd ? **s == '%' : (**s == '-' || **s == Dash)))
return;
if (!strcmp(*s, "in"))
return;
if (!(*s)[0] || !(*s)[1])
return;
if (cmd) {
if (shfunctab->getnode(shfunctab, *s) ||
builtintab->getnode(builtintab, *s) ||
@ -3151,8 +3153,12 @@ spckword(char **s, int hist, int cmd, int ask)
if (*t == Tilde || *t == Equals || *t == String)
t++;
for (; *t; t++)
if (itok(*t))
return;
if (itok(*t)) {
if (*t == Dash)
*t = '-';
else
return;
}
best = NULL;
for (t = *s; *t; t++)
if (*t == '/')