about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-14 09:43:42 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-14 09:43:42 +0000
commit0e7c726c326ec255e00ce43818c793d974bc2268 (patch)
tree44328e108bd5ad0b9a0af76f3ea7f96227b9fefa
parentae54428aedb8f237f090f302750df5b6c51a8fb9 (diff)
downloadzsh-0e7c726c326ec255e00ce43818c793d974bc2268.tar.gz
zsh-0e7c726c326ec255e00ce43818c793d974bc2268.tar.xz
zsh-0e7c726c326ec255e00ce43818c793d974bc2268.zip
zsh-workers/10127
-rw-r--r--Doc/Zsh/zle.yo9
-rw-r--r--Src/Zle/compresult.c5
-rw-r--r--Src/Zle/iwidgets.list1
-rw-r--r--Src/Zle/zle_main.c2
-rw-r--r--Src/Zle/zle_misc.c12
-rw-r--r--Src/Zle/zle_refresh.c7
-rw-r--r--Src/Zle/zle_thingy.c10
-rw-r--r--Src/Zle/zle_tricky.c25
8 files changed, 62 insertions, 9 deletions
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index baca81e62..241b90a21 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -129,6 +129,10 @@ The offset of the cursor, within the edit buffer.  This is in the range
 Attempts to move the cursor outside the buffer will result in the
 cursor being moved to the appropriate end of the buffer.
 )
+vindex(MARK)
+item(tt(MARK) (integer))(
+Like tt(CURSOR), but for the mark.
+)
 vindex(LBUFFER)
 item(tt(LBUFFER) (scalar))(
 The part of the buffer that lies to the left of the cursor position.
@@ -938,6 +942,11 @@ Perform menu completion, like tt(menu-complete), except that if
 a menu completion is already in progress, move to the em(previous)
 completion rather than the next.
 )
+tindex(end-of-list)
+item(tt(end-of-list))(
+When a previous completion displayed a list below the prompt, this
+widget can be used to move the prompt below the list.
+)
 enditem()
 texinode(Miscellaneous)()(Completion)(Zsh Line Editor)
 subsect(Miscellaneous)
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index d49c7b811..1d3ee6d27 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1528,6 +1528,7 @@ mod_export int asklist(void)
     showinglist = listshown = 0;
 
     clearflag = (isset(USEZLE) && !termflags && dolastprompt);
+    lastlistlen = 0;
 
     /* Maybe we have to ask if the user wants to see the list. */
     if ((!minfo.cur || !minfo.asked) &&
@@ -1756,16 +1757,20 @@ printlist(int over, CLPrintFunc printm, int showall)
 	    pnl = 1;
 	g = g->next;
     }
+    lastlistlen = 0;
     if (clearflag) {
 	/* Move the cursor up to the prompt, if always_last_prompt *
 	 * is set and all that...                                  */
 	if ((ml = listdat.nlines + nlnct - 1) < lines) {
 	    tcmultout(TCUP, TCMULTUP, ml);
 	    showinglist = -1;
+
+	    lastlistlen = listdat.nlines;
 	} else
 	    clearflag = 0, putc('\n', shout);
     } else
 	putc('\n', shout);
+
     listshown = (clearflag ? 1 : -1);
 
     return printed;
diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index c28acb438..bd321e8d4 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -44,6 +44,7 @@
 "end-of-history", endofhistory, 0
 "end-of-line", endofline, 0
 "end-of-line-hist", endoflinehist, 0
+"end-of-list", endoflist, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
 "exchange-point-and-mark", exchangepointandmark, 0
 "execute-last-named-cmd", NULL, 0
 "execute-named-cmd", NULL, 0
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 622cca6d5..020710f07 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -593,7 +593,7 @@ zleread(char *lp, char *rp, int flags)
     trashzle();
     free(lpromptbuf);
     free(rpromptbuf);
-    zleactive = zlereadflags = 0;
+    zleactive = zlereadflags = lastlistlen = 0;
     alarm(0);
 
     freeundo();
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 0e4e58bdb..fef55f01d 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -641,7 +641,7 @@ executenamedcommand(char *prmt)
 {
     Thingy cmd;
     int len, l = strlen(prmt), feep = 0, listed = 0, curlist = 0;
-    int ols = (listshown && validlist);
+    int ols = (listshown && validlist), olll = lastlistlen;
     char *ptr;
     char *okeymap = curkeymapname;
 
@@ -659,9 +659,10 @@ executenamedcommand(char *prmt)
 	if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak)) {
 	    statusline = NULL;
 	    selectkeymap(okeymap, 1);
-	    if ((listshown = ols))
+	    if ((listshown = ols)) {
 		showinglist = -2;
-	    else if (listed)
+		lastlistlen = olll;
+	    } else if (listed)
 		clearlist = listshown = 1;
 
 	    return NULL;
@@ -725,9 +726,10 @@ executenamedcommand(char *prmt)
 		    unrefthingy(r);
 		    statusline = NULL;
 		    selectkeymap(okeymap, 1);
-		    if ((listshown = ols))
+		    if ((listshown = ols)) {
 			showinglist = -2;
-		    else if (listed)
+			lastlistlen = olll;
+		    } else if (listed)
 			clearlist = listshown = 1;
 		    return r;
 		}
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 4c5a0cdf8..75da73efb 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -59,6 +59,11 @@ mod_export int showinglist;
 /**/
 mod_export int listshown;
 
+/* Length of last list displayed (if it is below the prompt). */
+
+/**/
+mod_export int lastlistlen;
+
 /* Non-zero if ALWAYS_LAST_PROMPT has been used, meaning that the *
  * screen below the buffer display should not be cleared by       *
  * zrefresh(), but should be by trashzle().                       */
@@ -282,7 +287,7 @@ zrefresh(void)
 	    clearflag = 0;
 	    resetneeded = 1;
 	}
-	listshown = 0;
+	listshown = lastlistlen = 0;
 	if (showinglist != -2)
 	    showinglist = 0;
     }
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index fd9fa3e7f..8cad90e2b 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -416,12 +416,18 @@ bin_zle_refresh(char *name, char **args, char *ops, char func)
 
 	    zmult = 1;
 	    listlist(l);
+	    if (statusline)
+		lastlistlen++;
 	    showinglist = clearlist = 0;
 	    zmult = zmultsav;
-	} else if (ops['c'])
+	} else if (ops['c']) {
 	    clearlist = 1;
-    } else if (ops['c'])
+	    lastlistlen = 0;
+	}
+    } else if (ops['c']) {
 	clearlist = listshown = 1;
+	lastlistlen = 0;
+    }
     zrefresh();
 
     clearlist = ocl;
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 464e6607e..00bc0382a 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2009,6 +2009,8 @@ listlist(LinkList l)
 	    putc('\n', shout);
 	settyinfo(&shttyinfo);
     }
+    lastlistlen = (clearflag ? nlines : 0);
+
     if (ncols) {
 	if (isset(LISTROWSFIRST)) {
 	    for (col = 1, p = data, lenp = lens; *p;
@@ -2253,3 +2255,26 @@ expandorcompleteprefix(char **args)
     comppref = 0;
     return ret;
 }
+
+/**/
+int
+endoflist(char **args)
+{
+    if (lastlistlen > 0) {
+	int i;
+
+	clearflag = 0;
+	trashzle();
+
+	for (i = lastlistlen; i > 0; i--)
+	    putc('\n', shout);
+
+	showinglist = lastlistlen = 0;
+
+	if (sfcontext)
+	    zrefresh();
+
+	return 0;
+    }
+    return 1;
+}