zsh-workers
 help / color / mirror / code / Atom feed
* zsh prompt eates up my screen :)
@ 2009-05-23 14:44 Jörg Sommer
  2009-05-23 16:54 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Jörg Sommer @ 2009-05-23 14:44 UTC (permalink / raw)
  To: zsh-workers

Hi,

try this:

% zsh -f
ibook% TRAPALRM() { PS1=${(l:$COLUMNS::xx:)}$'\nline 2%% '; zle reset-prompt; }
ibook% TMOUT=2
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
line 2%

At me (4.3.9), the line with the xs walks up into the first line of the
screen and stays there. If I use fewer than $COLUMNS characters in the
line, it works as expected. It looks like a length calculation is wrong.

Bye, Jörg.
-- 
Dein Gesicht wird dir geschenkt. Lächeln musst du selber! (Inga Hermann)


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

* Re: zsh prompt eates up my screen :)
  2009-05-23 14:44 zsh prompt eates up my screen :) Jörg Sommer
@ 2009-05-23 16:54 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2009-05-23 16:54 UTC (permalink / raw)
  To: zsh-workers

On May 23,  2:44pm, Joerg wrote:
}
} % zsh -f
} ibook% TRAPALRM() { PS1=${(l:$COLUMNS::xx:)}$'\nline 2%% '; zle reset-prompt; }
} ibook% TMOUT=2
} 
} At me (4.3.9), the line with the xs walks up into the first line of the
} screen and stays there. If I use fewer than $COLUMNS characters in the
} line, it works as expected. It looks like a length calculation is wrong.

The calculation is correct, what's wrong (and nearly impossible to get
right) is the assumption about what happens when a character is printed
to the rightmost column.

The prompt code is assuming [possibly based on bad terminfo description,
but maybe not] that when the rightmost "x" is printed, the terminal will
immediately wrap to the next line.  Therefore the $'\n' that follows is
assumed to create a blank line, so that "line 2% " is believed to appear
on a THIRD line.

What's happening instead is that the terminal silently swallows a newline
at that position, leaving zle with an inaccurate internal picture of the
screen state.

What makes this so difficult is that different terminals handle this in
different ways, and it's frequently not possible to tell from terminfo
exactly what is going to happen.

The "bart" prompt theme goes to some length to avoid ever printing to
the rightmost screen column for exactly this reason.

-- 


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

end of thread, other threads:[~2009-05-23 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-23 14:44 zsh prompt eates up my screen :) Jörg Sommer
2009-05-23 16:54 ` 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).