* _all_matches moves cursor @ 2006-10-06 5:12 John Eikenberry 2006-10-06 9:41 ` Peter Stephenson 0 siblings, 1 reply; 5+ messages in thread From: John Eikenberry @ 2006-10-06 5:12 UTC (permalink / raw) To: zsh users I recently added _all_matches to my completion config [1] and have come across an annoying behaviour. When the '- all matches -' line is longer than my terminal is wide, the cursor (along with the command being completed) gets bounced down a line. Here's an attempt at showing what it does... the # represents the cursor. This is after typing 'apt-<tab>'. [jae_0]apt- 201 - exterapt-# 201 apt-cache apt-check apt-extracttemplates apt-get apt-sortpkgs apt-cdrom apt-config apt-ftparchive apt-key - all matches - apt-cache apt-cdrom apt-check apt-config apt-extracttemplates apt-ftparchive ... As long as the '- all matches -' line is shorter then the terminal width this doesn't happen. Suggestions? Thanks. [1] Here's all of my zstyle completion settings. zstyle ':completion:*' completer _all_matches _complete _match _approximate _ignored zstyle ':completion:*:match:*' original only zstyle ':completion:*:approximate:*' max-errors 1 numeric zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' menu select zstyle ':completion:*:*:man:*' menu yes zstyle ':completion:*' group-name '' zstyle ':completion:*:manuals' separate-sections true zstyle ':completion:*:manuals.*' insert-sections true zstyle ':completion:*:descriptions' format "- %d -" -- John Eikenberry [jae@zhar.net - http://zhar.net] ______________________________________________________________ "It is difficult to produce a television documentary that is both incisive and probing when every twelve minutes one is interrupted by twelve dancing rabbits singing about toilet paper." - Rod Serling ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: _all_matches moves cursor 2006-10-06 5:12 _all_matches moves cursor John Eikenberry @ 2006-10-06 9:41 ` Peter Stephenson 2006-10-06 10:03 ` Peter Stephenson 2006-10-06 15:47 ` John Eikenberry 0 siblings, 2 replies; 5+ messages in thread From: Peter Stephenson @ 2006-10-06 9:41 UTC (permalink / raw) To: zsh users John Eikenberry wrote: > I recently added _all_matches to my completion config [1] and have come > across an annoying behaviour. When the '- all matches -' line is longer > than my terminal is wide, the cursor (along with the command being > completed) gets bounced down a line. I found this in the latest code, and assumed it was due to my recent changes, but I guessed you were using 4.2.x, and sure enough, unless the shell is lying to me, it's there too. Here's a slight cheat that simply shortens the line being added. I haven't the moral fibre to go back into the line-length calculations in the completion system at the moment, but my conscience is easier since the following is definitely safe with any form of terminal, whatever it does when the character reaches the end of the line, and also prevents a blank line appearing at the bottom of the screen. I suspect, however, the real problem is a calculation inside zsh rather than the terminal's behaviour. Further discussion of this ought to go on zsh-workers since it's down to the internals, not John's settings. Index: Src/Zle/compresult.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v retrieving revision 1.65 diff -u -r1.65 compresult.c --- Src/Zle/compresult.c 11 Aug 2006 21:30:38 -0000 1.65 +++ Src/Zle/compresult.c 6 Oct 2006 09:30:43 -0000 @@ -2134,7 +2134,7 @@ strcat(buf, " "); strncat(buf, m->str, len); } - strcat(buf, " ..."); + strcat(buf, " .."); break; } } -- Peter Stephenson <pws@csr.com> Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: _all_matches moves cursor 2006-10-06 9:41 ` Peter Stephenson @ 2006-10-06 10:03 ` Peter Stephenson 2006-10-06 16:29 ` John Eikenberry 2006-10-06 15:47 ` John Eikenberry 1 sibling, 1 reply; 5+ messages in thread From: Peter Stephenson @ 2006-10-06 10:03 UTC (permalink / raw) To: Zsh users list Peter Stephenson wrote: > John Eikenberry wrote: > > I recently added _all_matches to my completion config [1] and have come > > across an annoying behaviour. When the '- all matches -' line is longer > > than my terminal is wide, the cursor (along with the command being > > completed) gets bounced down a line. > > Here's a slight cheat that simply shortens the line being added. I've read it more carefully and I think there's simply a bug in the calculation at this point. Try this... Index: Src/Zle/compresult.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v retrieving revision 1.65 diff -u -r1.65 compresult.c --- Src/Zle/compresult.c 11 Aug 2006 21:30:38 -0000 1.65 +++ Src/Zle/compresult.c 6 Oct 2006 10:02:53 -0000 @@ -2126,7 +2126,7 @@ if (add) strcat(buf, " "); strcat(buf, m->str); - len -= t; + len -= t + add; add = 1; } else { if (len > add + 2) { -- Peter Stephenson <pws@csr.com> Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: _all_matches moves cursor 2006-10-06 10:03 ` Peter Stephenson @ 2006-10-06 16:29 ` John Eikenberry 0 siblings, 0 replies; 5+ messages in thread From: John Eikenberry @ 2006-10-06 16:29 UTC (permalink / raw) To: Zsh users list That did the trick. Thanks! Peter Stephenson wrote: > I've read it more carefully and I think there's simply a bug in the > calculation at this point. Try this... > > Index: Src/Zle/compresult.c > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v > retrieving revision 1.65 > diff -u -r1.65 compresult.c > --- Src/Zle/compresult.c 11 Aug 2006 21:30:38 -0000 1.65 > +++ Src/Zle/compresult.c 6 Oct 2006 10:02:53 -0000 > @@ -2126,7 +2126,7 @@ > if (add) > strcat(buf, " "); > strcat(buf, m->str); > - len -= t; > + len -= t + add; > add = 1; > } else { > if (len > add + 2) { > -- John Eikenberry [jae@zhar.net - http://zhar.net] ______________________________________________________________ "It is difficult to produce a television documentary that is both incisive and probing when every twelve minutes one is interrupted by twelve dancing rabbits singing about toilet paper." - Rod Serling ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: _all_matches moves cursor 2006-10-06 9:41 ` Peter Stephenson 2006-10-06 10:03 ` Peter Stephenson @ 2006-10-06 15:47 ` John Eikenberry 1 sibling, 0 replies; 5+ messages in thread From: John Eikenberry @ 2006-10-06 15:47 UTC (permalink / raw) To: zsh users Peter Stephenson wrote: > I found this in the latest code, and assumed it was due to my recent > changes, but I guessed you were using 4.2.x, and sure enough, unless the > shell is lying to me, it's there too. Opps. I forgot to say what version I was using. What a rookie mistake. This was with version zsh 4.2.5 and it happened in xterm and urxvt as well as on the (linux) console. -- John Eikenberry [jae@zhar.net - http://zhar.net] ______________________________________________________________ "It is difficult to produce a television documentary that is both incisive and probing when every twelve minutes one is interrupted by twelve dancing rabbits singing about toilet paper." - Rod Serling ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-10-06 16:29 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-10-06 5:12 _all_matches moves cursor John Eikenberry 2006-10-06 9:41 ` Peter Stephenson 2006-10-06 10:03 ` Peter Stephenson 2006-10-06 16:29 ` John Eikenberry 2006-10-06 15:47 ` John Eikenberry
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).