Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
X-AuditID: cbfec7f5-f792a6d000001302-59-576bd3f2fe5a
Date: Thu, 23 Jun 2016 13:19:59 +0100
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh workers <zsh-workers@zsh.org>
Subject: Re: unwanted scrolling of the terminal
Message-id: <20160623131959.03fef86b@pwslap01u.europe.root.pri>
In-reply-to: <30660.1466683131@thecus.kiddle.eu>
References: <30660.1466683131@thecus.kiddle.eu>
Organization: Samsung Cambridge Solution Centre
X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu)
MIME-version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7bit
X-Brightmail-Tracker:
 H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsVy+t/xK7qfLmeHGyxcJmxxsPkhkwOjx6qD
	H5gCGKO4bFJSczLLUov07RK4Mlo3v2AseMVZ8e5ATgPjQfYuRk4OCQETiRs9x5ggbDGJC/fW
	s3UxcnEICSxllGif9ZIdwpnBJHHv7AuozDlGiWmPdzBBOGcZJTZ+62IF6WcRUJW48WYN2Cw2
	AUOJqZtmM4LYIkDxOSdOgdUIC+hLrJh9hg3E5hWwlzj96jVYPaeAgcTGowuZQWwhoJq5M36C
	1fAD2Vf/foK6z15i5pUzjBC9ghI/Jt9jAbGZBbQkNm9rYoWw5SU2r3kLNUdd4sbd3ewTGIVn
	IWmZhaRlFpKWBYzMqxhFU0uTC4qT0nON9IoTc4tL89L1kvNzNzFCwvnrDsalx6wOMQpwMCrx
	8GYcywoXYk0sK67MPcQowcGsJMJbfSk7XIg3JbGyKrUoP76oNCe1+BCjNAeLkjjvzF3vQ4QE
	0hNLUrNTUwtSi2CyTBycUg2Mc6ZJ75x92UvydfM7jr++Mpu6HjxW3bqp+pnFrbVi/c5sh45V
	bSg5f+9qHZ/DNwPxuRIb8jaYH28XyWNapn5t1reOxcdi5q1Pulhc+vdEkkP7Ol/hrV2HhdnY
	apP6eEvqTSR8K0xiPmy5pHetN+qO7o0qgx9FywxcDwZxTpmgsP3s+a4TweHCSizFGYmGWsxF
	xYkADdIUEmMCAAA=
X-Seq: zsh-workers 38755

On Thu, 23 Jun 2016 13:58:51 +0200
Oliver Kiddle <okiddle@yahoo.co.uk> 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

