From 206237c8ec4b7619d9e70a75004cd1ae1066b0a0 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 25 Apr 1999 15:43:41 +0000 Subject: zsh-3.1.5-pws-16 --- Src/Zle/zle_tricky.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'Src/Zle/zle_tricky.c') diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 1f13d55b4..92b167cfe 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -72,6 +72,10 @@ static int wb, we; static int offs; +/* the last completion widget called */ + +static Widget lastcompwidget; + /* These control the type of completion that will be done. They are * * affected by the choice of ZLE command and by relevant shell options. * * usemenu is set to 2 if we have to start automenu and 3 if we have to * @@ -756,10 +760,12 @@ docomplete(int lst) /* If we are doing a menu-completion... */ - if (menucmp && lst != COMP_LIST_EXPAND) { + if (menucmp && lst != COMP_LIST_EXPAND && compwidget && + compwidget == lastcompwidget) { do_menucmp(lst); return; } + lastcompwidget = compwidget; /* We may have to reset the cursor to its position after the * * string inserted by the last completion. */ @@ -6970,10 +6976,20 @@ do_single(Cmatch m) t = 1; else { /* Build the path name. */ - p = (char *) zhalloc(strlen(prpre) + strlen(str) + + if (m->ripre && !*psuf) { + int ne = noerrs; + + p = (char *) zhalloc(strlen(m->ripre) + strlen(str) + 1); + sprintf(p, "%s%s", m->ripre, str); + noerrs = 1; + parsestr(p); + singsub(&p); + noerrs = ne; + } else { + p = (char *) zhalloc(strlen(prpre) + strlen(str) + strlen(psuf) + 3); - sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf); - + sprintf(p, "%s%s%s", (prpre && *prpre) ? prpre : "./", str, psuf); + } /* And do the stat. */ t = (!(sr = ztat(p, &buf, 0)) && S_ISDIR(buf.st_mode)); } -- cgit 1.4.1