bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: Using alt 1049 in nsterm (Terminal.app) 445?


From: Thomas Dickey
Subject: re: Using alt 1049 in nsterm (Terminal.app) 445?
Date: Wed, 24 Aug 2022 20:28:34 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

> After a few months of "background color leakage" when exiting vim, I 
> attempted to find the source of the problem. I found an effective fix (or 
> workaround), but I would like some help determining whether this is worthy of 
> a terminfo update or arises from some quirk of my configuration.
> 
> Observed behavior:
>  1. Using MacOS Terminal.app Build 445, open something in vim, observe 
> gruvbox's "off black" background color working properly.
>  2. :q, as one does. Observe background has been reset properly.
>  3. Fire up "man man" to exercise the alternate background outside of vim

presumably using less, since that's the default.

>  4. Observe that lines with text are correctly colored, but blank lines have 
> inherited the "off black" background color from vim's gruvbox theme.
>  5. Exit man.
>  6. Run "man man" again, colors are all as they should be, the goofy 
> background state has been reset through unknown means.
> 
> This whole scenario appears to work properly (which is to say, vim colors
> don't leave vim) if I patch my nsterm description with the following:
> > use=xterm+alt1049
> 
> I will also note that the equivalent rmcup and smcup sequences appear in the
> "xterm-256color" (and thus, default) description shipped with MacOS.

> Can anyone advise me on how to use vttest or tack to ascertain whether
> "alt1049" is the right way to drive modern Terminal.app?

vttest has a test for 1049, but that's monochrome.
tack doesn't test that aspect eiher.

But what you're saying is that there's some unwanted text on the
alternate screen.

nsterm's using

        rmcup=\E[2J\E[?47l\E8,
        smcup=\E7\E[?47h, 

i.e., on restoring _from_ the alternate screen, that would first be cleared.
With 1049, xterm clears the alternate screen when switching _to_ it.

I did that to make it possible (with a menu entry) to inspect the alternate
screen.  While most terminals don't provide _that_, I see that Terminal.app
does have a menu entry (under "View").  fwiw, iTerm2 also does, but under
Session/Terminal State (making it less accessible).

In a quick check, Terminal.app does clear the screen if I just use
tput smcup/rmcup.  However, running vim doesn't switch to the
alternate screen (checking a little further, vim's ignoring that
part of the terminal description when it uses 47, but does use it with 1049).

I can see this by setting TERM and using "script" to capture the output
from vim when starting/stopping it.

Some of vim's behavior is configurable, some is not.

> The following was used to reproduce the "leakage":
>  * MacOS 12.5.1, Terminal.app Build 445
>  * MacPorts vim, linked against macports ncurses
>  * MacOS /usr/bin/man 1.6g
>  * MacPorts nurses 6.3.0
              ncurses 6.3 :-)
>  * TERM=nsterm-256color (terminfo included below)
>  * vim colorscheme - https://github.com/morhetz/gruvbox
> 
> nsterm|nsterm-256color|Apple_Terminal|AppKit Terminal.app,
>       am, bce, hs, mir, msgr, npc, xenl, xon,
>       colors#0x100, cols#80, it#8, lines#24, pairs#0, wsl#50,
>       acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
>       bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l,
>       clear=\E[H\E[J, cnorm=\E[?25h, cr=\r,
>       csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
>       cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C,
>       cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
>       dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM,
>       dl1=\E[M, dsl=\E]2;\007, ed=\E[J, el=\E[K, el1=\E[1K,
>       enacs=\E(B\E)0, flash=\E[?5h$<200/>\E[?5l, fsl=^G,
>       home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@,
>       ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\n, invis=\E[8m,
>       kDC=\E[3;2~, kLFT=\E[1;2D, kRIT=\E[1;2C, ka1=\EOq,
>       ka3=\EOs, kb2=\EOr, kbs=^?, kc1=\EOp, kc3=\EOn, kcbt=\E[Z,
>       kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
>       kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
>       kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~,
>       kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~,
>       kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS,
>       kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
>       khome=\EOH, kmous=\E[<, knp=\E[6~, kpp=\E[5~, op=\E[39;49m,
>       rc=\E8, rev=\E[7m, ri=\EM, ritm=\E[23m, rmacs=^O,
>       rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l,
>       rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m,
>       rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
>       setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
>       setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
>       
> sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
>       sgr0=\E[m\017, sitm=\E[3m, smacs=^N, smam=\E[?7h,
>       smcup=\E7\E[?47h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m,
>       smul=\E[4m, tbc=\E[3g, tsl=\E]2;, u6=\E[%i%d;%dR, u7=\E[6n,
>       u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]