Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Another completion cursor-placement glitch



Bart Schaefer wrote:

> In a freshly-started shell with `prompt bart` in effect, I typed <C-x h> for
> complete-help after the scp command and the cursor got left where the `+' is
> in the cut'n'paste below (one line too high):
> 
> zagzig [fg] ~     +                                            01-06-13  3:01AM
> schaefer[501] scp                                                         4.0.1
> tags in context :completion::complete:scp::
>     argument-rest options  (_arguments _ssh _ssh)
> tags in context :completion::complete:scp:argument-rest:
>     files hosts users  (_alternative _ssh _ssh) 
>     all-files          (_files _alternative _ssh _ssh) 
>     hosts              (_hosts _combination _ssh_hosts _alternative _ssh _ssh) 
>     users              (_users _combination _ssh_users _alternative _ssh _ssh)
> 
> Yeah, I know, I should be in bed, then I wouldn't see these wierd bugs.  It
> happens with `zsh -f' plus compinit, so it's not the prompt causing it.

;-)

One half was a off-by-one error.  The printing functions for the
explanation strings included newlines in their calculations of the
lengths of lines printed so far.  The other part was that these
functions didn't do that space-backspace thing at the end if the last
line in the listing happened to be as long as the screen is wide.

Another candidate for 4.0.


Bye
  Sven

Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.41
diff -u -r1.41 complist.c
--- Src/Zle/complist.c	2001/05/08 08:14:34	1.41
+++ Src/Zle/complist.c	2001/06/13 13:58:30
@@ -887,7 +887,7 @@
 	    if (*p == '\n') {
 		if (dopr == 1 && mlbeg >= 0 && tccan(TCCLEAREOL))
 		    tcout(TCCLEAREOL);
-		l += 1 + (cc / columns);
+		l += 1 + ((cc - 1) / columns);
 		cc = 0;
 	    }
 	    if (dopr == 1) {
@@ -909,9 +909,12 @@
 	    }
 	}
     }
-    if (dopr && mlbeg >= 0 && tccan(TCCLEAREOL))
-	tcout(TCCLEAREOL);
-
+    if (dopr) {
+        if (!(cc % columns))
+            fputs(" \010", shout);
+        if (mlbeg >= 0 && tccan(TCCLEAREOL))
+            tcout(TCCLEAREOL);
+    }
     if (stat && n)
 	mfirstl = -1;
 
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.27
diff -u -r1.27 zle_tricky.c
--- Src/Zle/zle_tricky.c	2001/05/16 10:27:07	1.27
+++ Src/Zle/zle_tricky.c	2001/06/13 13:58:31
@@ -1949,7 +1949,7 @@
 			    putc(' ', shout);
 		    }
 		}
-		l += 1 + (cc / columns);
+		l += 1 + ((cc - 1) / columns);
 		cc = 0;
 	    }
 	    if (dopr) {
@@ -1960,6 +1960,8 @@
 	}
     }
     if (dopr) {
+        if (!(cc % columns))
+            fputs(" \010", shout);
 	if (tccan(TCCLEAREOL))
 	    tcout(TCCLEAREOL);
 	else {

-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author