Skip to content

TERM "*-direct" values are not recognized as True Color-capable #4137

Closed

Description

@mc-butler

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 -V

GNU 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

  1. mc-butler commented on Oct 20, 2020

    @mc-butler
    Author

    Changed by andrew_b (@aborodin) on Oct 20, 2020 at 13:01 UTC (comment 1)

    • Component changed from mc-core to mc-tty
  2. mc-butler commented on Oct 20, 2020

    @mc-butler
    Author

    Changed by andrew_b (@aborodin) on Oct 20, 2020 at 13:24 UTC (comment 2)

    Is ncurses-term package installed?

  3. mc-butler commented on Oct 21, 2020

    @mc-butler
    Author

    Changed by RogueScholar (admin@….net) on Oct 21, 2020 at 4:16 UTC (comment 2.3)

    Replying to andrew_b:

    Is ncurses-term package installed?

    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.

  4. added theissue type on Feb 28, 2025
  5. egmontkob commented on Oct 17, 2025

    @egmontkob
    Contributor

    *-direct terminfo 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 *-direct entries.

    But the question is: Will it work? Can mc be adjusted to make them work?

    • Would the bright variants of the basic 8 colors work?
    • Would the extended 256 colors (the newly added 6x6x6 color cube and the 24-color grayscale ramp) work?
    • Would truecolors #000000 .. #000007 work?

    Because *-direct terminfo 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 *-direct nonsense, 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).

  6. added a commit that references this issue on Oct 25, 2025
    cfa0d08
  7. egmontkob commented on Oct 25, 2025

    @egmontkob
    Contributor

    Just go to know, thanks to #4821 / PR #4822 that there exist xterm-direct16 and xterm-direct256 terminfo 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.

  8. added 14 commits that reference this issue on Oct 26, 2025
    2bdb766
    8de0488
    b0dbf5a
    7aa592b
    03bdc74
    07b9de0
    95a0a13
    d2da004
    0887a67
    f6d6a48
    38a3a9e
    3e4ba37
    901dfc2
    54408a8
  9. added a commit that references this issue on Nov 6, 2025
    cd5fc97
  10. added a commit that references this issue on Nov 6, 2025
  11. modified the milestones: Future Releases, 4.8.34 on Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ttyInteraction with the terminal, screen librariesprio: mediumHas the potential to affect progress

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions