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

Re: zsh prompt eates up my screen :)



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.

-- 



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