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

Re: unwanted scrolling of the terminal



On Thu, 23 Jun 2016 13:58:51 +0200
Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> Looking at the output in a script log for an 84 char width terminal, I get:
>   x
>   \e[39m  - colour
>   \e[K    - clear to eol
>   \r
>   \e[8@   - insert 8 characters
>   \e[34m
>   eight spaces
>   \e[75C  - cursor right 75 chars
>   \e[39m
>   two spaces
>   \r
> 
> So why the two spaces? The second of those is what caused the scrolling.
> The first one is printed from line 1958 in zle_refresh.c
> The second is from line 2175 in the moveto function

It appears to be specific to terminals with automatic margins (hasam).  I
*think* that code is supposed to have the effect of ensuring if we
subsequently more the cursor right without printing then it knows that
the new line is actually a logical continuation of the previous one ---
hence the subsequent carriage return to get back from there.

So I would guess this hasn't been thought through in the case where
you're at the end of the screen and don't really want to go right unless
you have to.

This code is all originally 1990s --- I have no idea if modern terminals
even respond to these tricks.  I think automatic margin problems were
much more trendy twenty years ago.

pws



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