gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.99k stars 3.37k forks source link

recent change broke 24bit #626

Closed choppsv1 closed 1 year ago

choppsv1 commented 1 year ago

commit 044d633 added a call to an apply256 color function. This (or something) caused new sessions to be set to tmux-256color now rather than tmux-24bit that it was previously.

$ tmux -V
tmux 3.2a
$ egrep '24|256' ~/.tmux.conf.local
# RGB 24-bit colour support (tmux >= 2.2), possible values are:
tmux_conf_theme_24b_colour=true
tmux_conf_theme_clock_style='24'
set -g default-terminal "tmux-24bit" # colors!
# set -g terminal-overrides ',tmux-256color:Tc'
# set -g default-terminal "xterm-24bit"
# set -g terminal-overrides ',xterm-24bit:Tc'
#set -g terminal-overrides ',tmux-256color:sitm=\E[3m,tmux-256color:ritm=\E[23m,tmux-256color:setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,tmux-256color:setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,tmux-256color:Tc'
gpakosz commented 1 year ago

Hello @choppsv1 👋

What is tmux-24bit?

choppsv1 commented 1 year ago

oh.. well I have that as

$ diff tmux-256color.terminfo tmux-24bit.terminfo
1c1
< tmux-256color|tmux with 256 colors,
---
> tmux-24bit|tmux with 24-bit direct color mode,
47a48,50
>    setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
>    setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
>    Tc,
choppsv1 commented 1 year ago

I just did some googling and it looks like the official terminfo name is tmux-direct. I started doing this 24bit stuff a while ago prior to it being more standardized so tmux-24bit might be my own made up thing.

gpakosz commented 1 year ago

I don't know where that comes from. AFAIK the official tmux documentation only mentions tmux-256color.

Can you please try to revert to a stock ncurses setup and use the tmux_conf_24b_colour=true option in your .local customization file copy?

choppsv1 commented 1 year ago

I probably made it up, ncurses/tmux now uses tmux-direct it seems. I used to maintain a patch for emacs to support 24 bit color terminals, tmux-24bit probably dates from that time. :) In any case TERM needs to be tmux-direct for emacs to do 24bit color, when it is tmux-256color emacs only does 256.

gpakosz commented 1 year ago

And if you really want to set default-terminal to something else, can you please try

set -g default-terminal "tmux-24bit" #!important

But I don't recommend using #!important until you have all figured it out 🙂

gpakosz commented 1 year ago

Maybe I didn't search properly but the tmux Wiki doesn't mention tmux-direct. But my ncurses indeed has it

choppsv1 commented 1 year ago

I found the info here: https://github.com/tmux/tmux/issues/2370

gpakosz commented 1 year ago

Can you please try the gh-626 branch?

choppsv1 commented 1 year ago

So, that works once I changed my old config line

-set -g default-terminal "tmux-24bit" # colors!
+set -g default-terminal "tmux-direct" # colors!

FWIW I had already used #!important to get the behavior I wanted, but I reverted that for the test. :)

Interestingly vim does not render the same with this new tmux-direct compared to my old tmux-24bit terminfo.

image
gpakosz commented 1 year ago

Yeah terminfo definitions are not my area of expertise.

I'll land the fix to avoid changing tmux-direct and then there's always the #!important solution