On Fri, Apr 17, 2026 at 03:35:17PM +0200, Vincent Lefevre wrote:
> On 2026-04-14 03:38:55 -0400, Thomas Dickey wrote:
> > fixed in #409
> 
> Thanks, this has much improved, but the behavior is still strange.
> For instance, after selecting the full body
> 
> ----------------------------------------
> z
> 
> 1234
> 123456
> 12345678
> 1234567
> 12
> 
> 123456
> 1234
> 12
> ----------------------------------------
> 
> and typing the <Down> key, the first two lines ("z" and the blank
> line that follows) are still selected. In case this is regarded
> as an expected behavior to keep a common part of the selection,
> this is inconsistent, because when I type the <Up> key to go back
> to the first message, the selection is entirely cleared.

That's "expected behavior".  In the example you reported, ncurses is
setting a scrolling region in the middle of the screen.  It does that
to move some lines up or down - and the selection moved with the text.

Refer to

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291787

I added a feature (which I did make configurable "keepSelection") that
tells xterm to try to keep the selection/highlighting when outputs to
the screen don't actually modify the content of the selection.  I allowed
for scrolling (which may truncate the selection but not otherwise alter
it).  But in implementing it, I overlooked a few of the controls that could
make the text scroll.  As a result, the highlighting wasn't being updated
properly.  That is what you saw in the bug report.

The remaining highlighting (recalling from your example) is truncated
from the initial selection (because of the scrolling operations).

I wrote a test driver to investigate this.

Most terminals simply drop the selection/highlighting on any output to the
terminal (some don't implement the scrolling correctly anyway).

PuTTY (not mintty) and TeraTerm do (partly -- for instance, I see in a quick
check they simply drop the selection when it straddles a scrolling region
margin).

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to