From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3642 invoked from network); 13 Jun 2001 14:02:06 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Jun 2001 14:02:06 -0000 Received: (qmail 23331 invoked by alias); 13 Jun 2001 14:01:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14903 Received: (qmail 23317 invoked from network); 13 Jun 2001 14:01:36 -0000 From: Sven Wischnowsky Date: Wed, 13 Jun 2001 16:00:33 +0200 (MET DST) Message-Id: <200106131400.QAA04212@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: Re: Another completion cursor-placement glitch In-Reply-To: <1010613100959.ZM26225@candle.brasslantern.com> Bart Schaefer wrote: > In a freshly-started shell with `prompt bart` in effect, I typed 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@informatik.hu-berlin.de