zsh-workers
 help / color / mirror / code / Atom feed
* listlist() display corruption
@ 2011-03-19 17:54 Mikael Magnusson
  2011-03-19 18:49 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2011-03-19 17:54 UTC (permalink / raw)
  To: zsh workers

listlist(), used among other places in list-expand and where-is, moves
the prompt one line down every time it executes if any of the elements
it tries to show is longer than the terminal width. To try it, touch a
long filename (or make the terminal narrower) and type part of it's
name and a * and run list-expand. Alternatively, run where-is and type
history-incr, make the terminal quite narrow, and press tab a few
times.

I am not quite in the mood to look at it right now so I'm posting it
so I won't forget, but I won't complain if anyone else fixes it in the
meantime.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: listlist() display corruption
  2011-03-19 17:54 listlist() display corruption Mikael Magnusson
@ 2011-03-19 18:49 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2011-03-19 18:49 UTC (permalink / raw)
  To: zsh workers

On Mar 19,  6:54pm, Mikael Magnusson wrote:
} Subject: listlist() display corruption
}
} listlist(), used among other places in list-expand and where-is, moves
} the prompt one line down every time it executes if any of the elements
} it tries to show is longer than the terminal width. To try it, touch a
} long filename (or make the terminal narrower) and type part of it's
} name and a * and run list-expand. Alternatively, run where-is and type
} history-incr, make the terminal quite narrow, and press tab a few
} times.

There are a couple of things going on here.

For one, resizing the window doesn't always correctly reset $COLUMNS
[which is columns in listlist()] so the computation of number of lines
required is not always correct.  Not sure what can be done about that,
it's to do with whether the terminal delivers SIGWINCH.

Another is the below; somebody confirm it works before I commit:

Index: zle_tricky.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/Zle/zle_tricky.c,v
retrieving revision 1.30
diff -c -r1.30 zle_tricky.c
--- zle_tricky.c	21 Dec 2010 16:41:16 -0000	1.30
+++ zle_tricky.c	19 Mar 2011 18:44:58 -0000
@@ -2650,7 +2650,9 @@
     } else {
 	for (p = data; *p; p++) {
 	    nicezputs(*p, shout);
-	    putc('\n', shout);
+	    /* One column: newlines between elements, not after the last */
+	    if (p[1])
+		putc('\n', shout);
 	}
     }
     if (clearflag) {


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-19 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-19 17:54 listlist() display corruption Mikael Magnusson
2011-03-19 18:49 ` Bart Schaefer

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).