about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/complist.c44
2 files changed, 43 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6849bbe3d..6be546983 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-28  Sven Wischnowsky  <wischnow@informatik.hu-berlin.de>
+
+	* 10992: Src/Zle/complist.c: avoid wrapping around both
+ 	horizontally and vertically at the same time
+	
 2000-04-27  Bart Schaefer  <schaefer@brasslantern.com>
 
 	* Tanaka Akira: 10980: Completion for enscript.
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 61edd216c..527cd9825 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1809,12 +1809,23 @@ domenuselect(Hookdef dummy, Chdata dat)
 		   cmd == Th(z_downlineorhistory) ||
 		   cmd == Th(z_downlineorsearch) ||
 		   cmd == Th(z_vidownlineorhistory)) {
+	    int omline;
+	    Cmatch **op;
+
 	    wrap = 0;
 
 	down:
 
+	    omline = mline;
+	    op = p;
+
 	    do {
 		if (mline == mlines - 1) {
+		    if (wrap & 2) {
+			mline = omline; 
+			p = op;
+			break;
+		    }
 		    p -= mline * mcols;
 		    mline = 0;
 		    wrap |= 1;
@@ -1832,12 +1843,23 @@ domenuselect(Hookdef dummy, Chdata dat)
 		   cmd == Th(z_uplineorhistory) ||
 		   cmd == Th(z_uplineorsearch) ||
 		   cmd == Th(z_viuplineorhistory)) {
+	    int omline;
+	    Cmatch **op;
+
 	    wrap = 0;
 
 	up:
 
+	    omline = mline;
+	    op = p;
+
 	    do {
 		if (!mline) {
+		    if (wrap & 2) {
+			mline = omline; 
+			p = op;
+			break;
+		    }
 		    mline = mlines - 1;
 		    p += mline * mcols;
 		    wrap |= 1;
@@ -1948,17 +1970,22 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    p = lp;
 	} else if (cmd == Th(z_forwardchar) || cmd == Th(z_viforwardchar)) {
 	    int omcol;
-	    Cmatch *op;
+	    Cmatch **op;
 
 	    wrap = 0;
 
 	right:
 
 	    omcol = mcol;
-	    op = *p;
+	    op = p;
 
 	    do {
 		if (mcol == mcols - 1) {
+		    if (wrap & 1) {
+			p = op;
+			mcol = omcol;
+			break;
+		    }
 		    p -= mcol;
 		    mcol = 0;
 		    wrap |= 2;
@@ -1966,24 +1993,29 @@ domenuselect(Hookdef dummy, Chdata dat)
 		    mcol++;
 		    p++;
 		}
-	    } while (!*p || (mcol != omcol && *p == op));
+	    } while (!*p || (mcol != omcol && *p == *op));
 	    wishcol = mcol;
 
 	    if (wrap == 2)
 		goto down;
 	} else if (cmd == Th(z_backwardchar) || cmd == Th(z_vibackwardchar)) {
 	    int omcol;
-	    Cmatch *op;
+	    Cmatch **op;
 
 	    wrap = 0;
 
 	left:
 
 	    omcol = mcol;
-	    op = *p;
+	    op = p;
 
 	    do {
 		if (!mcol) {
+		    if (wrap & 1) {
+			p = op;
+			mcol = omcol;
+			break;
+		    }
 		    mcol = mcols - 1;
 		    p += mcol;
 		    wrap |= 2;
@@ -1991,7 +2023,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 		    mcol--;
 		    p--;
 		}
-	    } while (!*p || (mcol != omcol && *p == op));
+	    } while (!*p || (mcol != omcol && *p == *op));
 	    wishcol = mcol;
 
 	    if (wrap == 2)