aboutsummaryrefslogtreecommitdiff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_main.c7
-rw-r--r--Src/Zle/zle_refresh.c4
-rw-r--r--Src/Zle/zle_tricky.c24
3 files changed, 23 insertions, 12 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 7a5d0d7db..4d9c99f87 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -579,12 +579,7 @@ execzlefunc(Thingy func)
if(!(wflags & ZLE_KEEPSUFFIX))
removesuffix();
- if(!(wflags & ZLE_MENUCMP) ||
- ((wflags & WIDGET_NCOMP) && compwidget != w)) {
- /* If we are doing a special completion, and the widget
- * is not the one currently in use for special completion,
- * we are starting a new completion.
- */
+ if(!(wflags & ZLE_MENUCMP)) {
fixsuffix();
invalidatelist();
}
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 1f1063b8d..6b0239961 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -327,7 +327,7 @@ zrefresh(void)
vcs = 0;
else if (!clearflag && lpromptbuf[0]) {
zputs(lpromptbuf, shout);
- if (lpromptw == 0)
+ if (lpromptw == 0 && lprompth == 1)
zputs("\n", shout); /* works with both hasam and !hasam */
}
if (clearflag) {
@@ -947,7 +947,7 @@ tc_rightcurs(int cl)
zputc('\r', shout);
tc_upcurs(lprompth - 1);
zputs(lpromptbuf, shout);
- if (lpromptw == 0)
+ if (lpromptw == 0 && lprompth == 1)
zputs("\n", shout); /* works with both hasam and !hasam */
}
i = lpromptw;
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));
}