Repository navigation
TERM "*-direct" values are not recognized as True Color-capable #4137
Description
Important
This issue was migrated from Trac:
| Origin | https://midnight-commander.org/ticket/4137 |
|---|---|
| Reporter | RogueScholar (admin@….net) |
| Keywords | truecolor, terminfo, color |
Using latest versions of Konsole and Yakuake terminal emulators with True Color (24-bit or Direct RGB) color support announced via the pair of environment variables:
TERM=konsole-direct COLORTERM=truecolor
With MC configured to use either 256-color or 16M-color skins reports on invocation that the terminal is capable of only basic 16-color palettes and has reverted to the default skin accordingly. Prepending 'TERM=konsole-256color' to the invocation while leaving the COLORTERM variable set as before provides the expected behavior, with skins of all color bit-depths able to be set and subsequently displaying as designed. A test with TERM set to the more generic 'xterm-direct' value produced the same results as 'konsole-direct' where MC does not recognize direct RGB colors. This leads me to conclude that MC lacks recognition for the "-direct" values for TERM which were implemented in S-Lang 2.3.1 built with ncurses >=6.1.
System info
- Operating System: Kubuntu 20.10
- KDE Plasma Version: 5.20.0
- KDE Frameworks Version: 5.76.0
- Qt Version: 5.15.0
- Kernel Version: 5.8.0-23-generic
- OS Type: 64-bit
Hardware
- Model: Lenovo ThinkPad T420s
- Processor: Intel® Core™ i7-2620M CPU @ 2.70GHz
- Memory: 8 GiB of RAM
- Graphics Processor: NVS 4200M/PCIe/SSE2
Relevant Software Versions
- libncursesw6: 6.2
- libslang2: 2.3.2 (built using unicode-data 13.0.0)
- konsole: 20.08.2
- yakuake: 20.08.1
Debugging command output
$ LC_MESSAGES=C mc -VGNU Midnight Commander 4.8.25-55-g5bf714b
Built with GLib 2.64.2
Built with S-Lang 2.3.2 with terminfo database
With builtin Editor and Aspell support
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
With ext2fs attributes support
Virtual File Systems:
cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish
Data types:
char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;$ mc --configure-options
'--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include'
'--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info'
'--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=/usr/lib'
'--srcdir=.' '--disable-maintainer-mode' '--disable-dependency-tracking'
'--disable-silent-rules' '--with-x' '--with-screen=slang' '--enable-aspell'
'--disable-rpath' '--disable-static' 'build_alias=x86_64-linux-gnu'
'CFLAGS=-g -O2 -fdebug-prefix-map=/build/mc-4.8.25~git20201017=.
-fstack-protector-strong -Wformat -Werror=format-security'
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
Activity
mc-butler commentedon Oct 20, 2020
mc-butler commentedon Oct 20, 2020
Is ncurses-term package installed?
mc-butler commentedon Oct 21, 2020
Replying to andrew_b:
Indeed it is, sorry for having neglected to include it in my report. It and ncurses-base are both installed, matching set with libncursesw6, all version 6.2.
egmontkob commentedon Oct 17, 2025
*-directterminfo entries are about as broken as they could be.mc checks for the number of colors the terminfo entry claims to support, as well as the widespread practice of
$COLORTERM(((which is so stupid to exist outside of terminfo, there should be a good way to denote that inside terminfo, but that's what we have))), and based on that it decides whether to allow or reject 256-color or truecolor skins. This logic could easily be adjusted to recognize*-directentries.But the question is: Will it work? Can mc be adjusted to make them work?
#000000..#000007work?Because
*-directterminfo is so broken by design that it's unable to describe any of these three.Would these work in ncurses? Given that it's developed by the same person who came up with this
*-directnonsense, I pretty much doubt it, although I haven't tested.Would these work in slang? I have no idea. It could if slang knows some hardwired escape sequences rather than taking them from terminfo (just as it does now for truecolors if terminfo only describes 256).
lib/tty: Add true color support with ncurses and improve S-Lang color…
egmontkob commentedon Oct 25, 2025
Just go to know, thanks to #4821 / PR #4822 that there exist
xterm-direct16andxterm-direct256terminfo entries.These do support compatibility with the older 16-color or 256-color modes.
In turn, they chop off a larger part of the 256x256x256 truecolor cube. E.g. with
xterm-direct256, colors#000000..#0000FF(i.e. where R==0 and G==0) are inaccessible.lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
lib/tty: Add true color support with ncurses and improve S-Lang color…
Merge pull request #4822 from horkykuba/ncurses-truecolor