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

RE: Problem with cursor position after wrapped completion lists



>
> Hm. I've had a look at this: the only solution I see is to make the
> code check if the line it just printed is COLUMNS characters long
> whenever it wants to print a newline. Since there are several ways how
> the different things are printed (display-lists, explanation strings,
> matches), fixing this can get quite ugly, so I better ask first: does
> anybody see a better solution than to keep track of the number of
> characters printed?
>

No. There are two types of terminals. Some ttys wrap immediately after you
printed exactly COLUMNS lines. Some of them wrap first when COLUMNS+1th
character is printed. It means, that after you printed exactly COLUMNS of
characters you do not know, if your cursor is placed on current or next line. As
I have no idea if terminal description inludes such information, the only clean
way to solve it is to explicitly position cursor after exactly COLUMNS
characters were printed. Have you got a look at 4855? Among other things, it
makes Zsh to output '\r' in this case. Weird as it is, it works in both cases.
In the former case, additional character triggers new line; in the latter, we
are already on the new line so nothing changes. Note, that if you output
COLUMNS-1 or COLUMNS+1 characters, you won't get problem at all.

Note, that it only marginally relates to am attrubute. Both types of terminals I
have seen _did_ have am :-)

I believe, that fixing it may be hard but not ugly. The best would be to have
just one function that prints out all sort of output ... dunno, if this is
currently possible.

/andrej



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