jonas / tig

Text-mode interface for git
https://jonas.github.io/tig/
GNU General Public License v2.0
12.41k stars 607 forks source link

Tig Colors Are Missing Inside Tmux #1210

Closed IanEdington closed 2 years ago

IanEdington commented 2 years ago

Thanks for this awesome programme. I use it daily!

I've lost color in tig 😭

I'm using TERM=tmux-256color because it fixes some italic and true color issues I was having with screen-256color.

here's some debug info that was asked on another issue:

> infocmp | head -2
#       Reconstructed via infocmp from file: /Users/ian/.terminfo/74/tmux-256color
tmux-256color|tmux with 256 colors,

> infocmp | grep -e smcup -e rmcup
        ri=\EM, ritm=\E[23m, rmacs=^O, rmcup=\E[?1049l, rmir=\E[4l,
        sgr0=\E[m\017, sitm=\E[3m, smacs=^N, smcup=\E[?1049h,

I'm currently using alias tig="TERM=screen-256color tig" but I'd rather have it work properly with the TERM I have.

mckellygit commented 2 years ago

Hi, Not sure I can help, but I will try, let me ask - you say you've lost color - did it used to work ok with tmux-256color and now it no longer does ? If so, do you know what changed ? Your terminal or shell or tmux or tig version ?? Or is it that once you started using tmux-256color you no longer have colors in tig ? thx, -m

IanEdington commented 2 years ago

Thank you! Yes I used a custom version of xterm-256color and it worked fine. I had to change to a standard terminfo so tried a couple others but tmux-256color seems to be the best option. The only issue I've found with tmux-256color is the tig color.

koutcher commented 2 years ago

Beside the header that tells us that your tmux-256color is actually not a standard one, the interesting line in your infocmp output would be the one with pairs. macOS stock ncurses version does not handle pairs#0x10000 and so far Homebrew maintainers have refused to use a newer version of ncurses in Tig recipe, so the only option we're left with is to use a patched terminfo.

Try

/usr/local/opt/ncurses/bin/infocmp -x tmux-256color | sed -e 's/pairs#0x10000/pairs#32767/' > tmux-256color.src
/usr/bin/tic -x tmux-256color.src

Note that the latest tmux version in Homebrew has been modified to use screen-256color, but unfortunately this terminfo is also broken, at least on 10.11, so you will probably have to do the same to get a working one.

IanEdington commented 2 years ago

Unfortunately, that didn't work.

It sounds like I have a non-standard tmux-256color definition. I got it from invisible-island.net so I thought it would work. Do you know where I should get terminfo definitions if they aren't included on my system or is that generally not a good idea?

Since this is an issue with my setup, I'll close this ticket.

Thanks for the help!

koutcher commented 2 years ago

invisible-island.net is just fine, you have to replace the pairs#10000 as well to use it with macOS ncurses version. You may want to try starting with an empty ~/.terminfo as it has more precedence than the system one.

IanEdington commented 2 years ago

For anyone who comes later this helped a lot:

https://gpanders.com/blog/the-definitive-guide-to-using-tmux-256color-on-macos/

@koutcher, your comment about pairs makes a lot more sense now. Thanks