Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Aug 2024 20:10:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 280679] [termcap] [patch] bold colors broken in ncurses apps for xterm-256color
Message-ID:  <bug-280679-227-ehTohQLZap@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-280679-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-280679-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D280679

--- Comment #4 from Cullum Smith <cullum@sacredheartsc.com> ---
While I lack the inclination to grok all the arcane details of
termcap/terminfo, after comparing the `infocmp` output for xterm-256color w=
ith
a Linux system, I believe I understand the problem.

Termcap appears to be an older/less expressive format compared to terminfo.
FreeBSD's terminfo seems to have a termcap compatibility layer, and reads a=
ll
the termcap definitions from /etc/termcap.

xterm appears to have a quirk that requires some special handling in 256-co=
lor
mode. On my Linux system, the setaf/setab values for xterm-256color look li=
ke
this:

setab=3D\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=3D\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,

I do not fully understand this line noise, but it appears to have some spec=
ial
logic for values in between 8 and 16 (the bright colors?)

You can't blindly copy this into the xterm-256color definition in /etc/term=
cap,
because the termcap format seems to lack support for whatever syntax this i=
s.
However, you can compile a terminfo override and it appears to take precede=
nce
over /etc/termcap. Running the shell fragment below allows bright colors to
work in xterm-256color while maintaining full 256 color capability.

# The following was blindly copied from a 'infocmp xterm-256color' on a lin=
ux
host.
cat <<'EOF' > /root/xterm-256color.terminfo
xterm-256color|xterm with 256 colors,
        am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
        colors#0x100, cols#80, it#8, lines#24, pairs#0x10000,
        acsc=3D``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=3D^G, blink=3D\E[5m, bold=3D\E[1m, cbt=3D\E[Z, civis=3D\E[?25l,
        clear=3D\E[H\E[2J, cnorm=3D\E[?12l\E[?25h, cr=3D\r,
        csr=3D\E[%i%p1%d;%p2%dr, cub=3D\E[%p1%dD, cub1=3D^H,
        cud=3D\E[%p1%dB, cud1=3D\n, cuf=3D\E[%p1%dC, cuf1=3D\E[C,
        cup=3D\E[%i%p1%d;%p2%dH, cuu=3D\E[%p1%dA, cuu1=3D\E[A,
        cvvis=3D\E[?12;25h, dch=3D\E[%p1%dP, dch1=3D\E[P, dim=3D\E[2m,
        dl=3D\E[%p1%dM, dl1=3D\E[M, ech=3D\E[%p1%dX, ed=3D\E[J, el=3D\E[K,
        el1=3D\E[1K, flash=3D\E[?5h$<100/>\E[?5l, home=3D\E[H,
        hpa=3D\E[%i%p1%dG, ht=3D^I, hts=3D\EH, ich=3D\E[%p1%d@,
        il=3D\E[%p1%dL, il1=3D\E[L, ind=3D\n, indn=3D\E[%p1%dS,
=20=20=20=20=20=20=20
initc=3D\E]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/=
%p4%{255}%*%{1000}%/%2.2X\E\\,
        invis=3D\E[8m, is2=3D\E[!p\E[?3;4l\E[4l\E>, kDC=3D\E[3;2~,
        kEND=3D\E[1;2F, kHOM=3D\E[1;2H, kIC=3D\E[2;2~, kLFT=3D\E[1;2D,
        kNXT=3D\E[6;2~, kPRV=3D\E[5;2~, kRIT=3D\E[1;2C, ka1=3D\EOw,
        ka3=3D\EOy, kb2=3D\EOu, kbs=3D^?, kc1=3D\EOq, kc3=3D\EOs, kcbt=3D\E=
[Z,
        kcub1=3D\EOD, kcud1=3D\EOB, kcuf1=3D\EOC, kcuu1=3D\EOA,
        kdch1=3D\E[3~, kend=3D\EOF, kent=3D\EOM, kf1=3D\EOP, kf10=3D\E[21~,
        kf11=3D\E[23~, kf12=3D\E[24~, kf13=3D\E[1;2P, kf14=3D\E[1;2Q,
        kf15=3D\E[1;2R, kf16=3D\E[1;2S, kf17=3D\E[15;2~, kf18=3D\E[17;2~,
        kf19=3D\E[18;2~, kf2=3D\EOQ, kf20=3D\E[19;2~, kf21=3D\E[20;2~,
        kf22=3D\E[21;2~, kf23=3D\E[23;2~, kf24=3D\E[24;2~,
        kf25=3D\E[1;5P, kf26=3D\E[1;5Q, kf27=3D\E[1;5R, kf28=3D\E[1;5S,
        kf29=3D\E[15;5~, kf3=3D\EOR, kf30=3D\E[17;5~, kf31=3D\E[18;5~,
        kf32=3D\E[19;5~, kf33=3D\E[20;5~, kf34=3D\E[21;5~,
        kf35=3D\E[23;5~, kf36=3D\E[24;5~, kf37=3D\E[1;6P, kf38=3D\E[1;6Q,
        kf39=3D\E[1;6R, kf4=3D\EOS, kf40=3D\E[1;6S, kf41=3D\E[15;6~,
        kf42=3D\E[17;6~, kf43=3D\E[18;6~, kf44=3D\E[19;6~,
        kf45=3D\E[20;6~, kf46=3D\E[21;6~, kf47=3D\E[23;6~,
        kf48=3D\E[24;6~, kf49=3D\E[1;3P, kf5=3D\E[15~, kf50=3D\E[1;3Q,
        kf51=3D\E[1;3R, kf52=3D\E[1;3S, kf53=3D\E[15;3~, kf54=3D\E[17;3~,
        kf55=3D\E[18;3~, kf56=3D\E[19;3~, kf57=3D\E[20;3~,
        kf58=3D\E[21;3~, kf59=3D\E[23;3~, kf6=3D\E[17~, kf60=3D\E[24;3~,
        kf61=3D\E[1;4P, kf62=3D\E[1;4Q, kf63=3D\E[1;4R, kf7=3D\E[18~,
        kf8=3D\E[19~, kf9=3D\E[20~, khome=3D\EOH, kich1=3D\E[2~,
        kind=3D\E[1;2B, kmous=3D\E[<, knp=3D\E[6~, kpp=3D\E[5~,
        kri=3D\E[1;2A, mc0=3D\E[i, mc4=3D\E[4i, mc5=3D\E[5i, meml=3D\El,
        memu=3D\Em, mgc=3D\E[?69l, nel=3D\EE, oc=3D\E]104\007,
        op=3D\E[39;49m, rc=3D\E8, rep=3D%p1%c\E[%p2%{1}%-%db,
        rev=3D\E[7m, ri=3D\EM, rin=3D\E[%p1%dT, ritm=3D\E[23m, rmacs=3D\E(B,
        rmam=3D\E[?7l, rmcup=3D\E[?1049l\E[23;0;0t, rmir=3D\E[4l,
        rmkx=3D\E[?1l\E>, rmm=3D\E[?1034l, rmso=3D\E[27m, rmul=3D\E[24m,
        rs1=3D\Ec\E]104\007, rs2=3D\E[!p\E[?3;4l\E[4l\E>, sc=3D\E7,
        setab=3D\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1=
%d%;m,
        setaf=3D\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%=
d%;m,
=20=20=20=20=20=20=20
sgr=3D%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;=
7%;%?%p4%t;5%;%?%p7%t;8%;m,
        sgr0=3D\E(B\E[m, sitm=3D\E[3m, smacs=3D\E(0, smam=3D\E[?7h,
        smcup=3D\E[?1049h\E[22;0;0t,
        smglr=3D\E[?69h\E[%i%p1%d;%p2%ds, smir=3D\E[4h,
        smkx=3D\E[?1h\E=3D, smm=3D\E[?1034h, smso=3D\E[7m, smul=3D\E[4m,
        tbc=3D\E[3g, u6=3D\E[%i%d;%dR, u7=3D\E[6n,
        u8=3D\E[?%[;0123456789]c, u9=3D\E[c, vpa=3D\E[%i%p1%dd,
EOF

tic -o /usr/local/share/site-terminfo /root/xterm-256color.terminfo

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-280679-227-ehTohQLZap>