On Wed, Jul 31, 2019 at 07:57:00PM +0200, Sven Joachim wrote:
> On 2019-07-31 18:38 +0200, Samuel Hym wrote:
> 
> > Package: ncurses-base
> > Version: 6.1+20190713-1
> > Severity: normal
> >
> > Dear Maintainer,
> >
> > Since updating ncurses from 6.1+20181013-2 to 6.1+20190713-1, I get
> > corruption when I run mutt in a tmux. Since reverting that update
> > makes this bug disappear, I report it against ncurses-base. I think I
> > saw such glitches in other contexts than in mutt, but that’s where I
> > got it to reproduce.
> >
> > To reproduce, run in a tmux:
> >
> >     mutt -F /dev/null -e 'set pager_index_lines=6' -f some-mbox
> >
> > select the 5th message from the top of the screen and try to return
> > from the pager to the index. Instead of showing the clean index, I see
> > some leftovers from the pager view, including the separation line
> > between the 6 index lines and the pager.
> > Refreshing the screen with Ctrl-L clears the glitches away.
> 
> Thanks for these detailed instructions.  I can confirm this glitch, and
> also that downgrading ncurses-base to 6.1+20181013-2 makes it go away.
> 
> Since tmux sets TERM=screen by default, and there have not really been
> any changes to screen in ncurses' terminfo.src file, I wondered what
> happened.  Here is what I found out so far:
> 
> ,----
> | $ dpkg-deb -x /var/cache/apt/archives/ncurses-base_6.1+20181013-2_all.deb 
> buster        
> | $ dpkg-deb -x /var/cache/apt/archives/ncurses-base_6.1+20190713-1_all.deb 
> sid    
> | $ infocmp -x -A buster/lib/terminfo -B sid/lib/terminfo screen screen
> | comparing screen to screen.
> |     comparing booleans.
> |     comparing numbers.
> |     comparing strings.
> |         rin: NULL, '\E[%p1%dT'.
> `----
> 
> So rin=\E[%p1%dT has been added in sid, apparently because of the
> following change in the 20190630 patchlevel:
> 
> ,----
> |             + add a check in tic for paired indn/rin
> `----
> 
> It looks like tmux does not quite cope with this correctly or so.

Nicolas' followup indicates that tmux didn't implement this.

The problem was that tmux's terminal description inherits from (use=)
the screen description, and that a maintenance update for the latter
exposed the problem.

That in turn was prompted by another developer wanting to inherit
from "xterm", but since testing showed _that_ to be not accurate --
no surprise -- the building block approach was the way to go.

The indn/rin pair hadn't been done (noticeable when doing this),
and since inspection of screen's source-code showed it supported
this

                case 'S':       /* code from a 97801 term / DEC vt400 */
                        ScrollRegion(win, a1 ? a1 : 1);
                        break;
                case 'T':       /* code from a 97801 term / DEC vt400 */
                case '^':       /* SD as per ISO 6429 */
                        ScrollRegion(win, a1 ? -a1 : -1);
                        break;
                }

then this applied:

ecma+index|ECMA-48 scroll up/down,
        indn=\E[%p1%dS, rin=\E[%p1%dT,

I overlooked the fact that there's no INPUT_CSI_SD in tmux at the moment:

        case INPUT_CSI_SU:
                n = input_get(ictx, 0, 1, 1);
                if (n != -1)
                        screen_write_scrollup(sctx, n, bg);
                break;

The fix would be add "rin@" to the tmux entry (along with a note).
I'll do that...

-- 
Thomas E. Dickey <dic...@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to