Comment by JdeBP
1 day ago
> if you do not set TERM with tmux properly, your colors will render incorrectly
This is of course true of every other terminal emulator as well, and indeed it's not only colours that are incorrect. Function and editing keys get recognized incorrectly; REP can get used where it does not work; and even simple relative cursor motions can be done wrongly.
TERM and the ideas incorporated into terminfo/termcap are inherent in the way that terminal devices work on Unices and Linux-based operating systems. That there are different terminals and terminal emulators not all speaking exactly the same protocol is also an unavoidable reality.
Setting TERM properly isn't some tmux-specific problem.
Yet the author incorrectly blames it on tmux, which gives the article a bad taste.
Also im not sure whether the scolling problem is actually tmux fault. Tmux uses the alternate screen buffer, the alternate screen buffer is activated using the smcup/rmcup terminfo capabilities, whose semantics actually say that it "fixes" the window viewport in-place so absolute cursor movement has a known zero position. In this state, any native scrolling attempt should have no effect, and the keypress/scroll wheel events should be forwarded to tmux directly.
For some reason, every other terminal emulator still allows local scrolling in the alternate screen, which kinda breaks the semantics of smcup/rmcup and easy scrolling in tmux, too.
Sadly after experimenting with a bunch of "modern" terminals I'm forced to consider that their primary audience is more interest in ricing than actually implementing the terminal commands (or connecting to anything other than their favourite linux box) and so I'm stuck with xterm as the only reliable terminal emulator that won't occasionally spew unreadable junk.
And, actually having terminals crush. It is kind of absurd to have a terminal crush.
I've tried
Wezterm Ghoatty Ptyxis
First two had some frequent crushes, ptyxis is quiet reliable, but I felt it consumes too much memory for a terminal. But I feel it's a good terminal.
Though I wish I could get rid of the headerbar
6 replies →
Have you tried Ghostty? Its creator has been pretty serious about getting everything right.
14 replies →
I agree. It's also true of nearly any program. If you do not set its configuration properly, it may not work as expected.
In the case of TMUX, it can be a bit annoying because it's not immediately apparent _why_ things look wonky. But I'm not sure what the solution is. Default to 256 colors?
Indeed, the TERM environment variable actually is the configuration of "nearly any program" (excluding the ones that aren't doing explicitly terminal I/O, of course, and the bad ones that just ignore TERM and make assumptions). Set TERM wrongly, and one has set the configuration incorrectly for a whole load of programs, in one fell swoop.
Well, not “nearly any program”; I believe that probing for capabilities is the preferred method these days.
2 replies →
> Setting TERM properly isn't some tmux-specific problem.
Correct, but it's another layer to deal with. There are `tmux` specific TERMs that should be used which sit on top of your terminal emulator TERM. This was my point: you have another layer that you need to be aware of when using tmux and when debugging.
Just look at the top of tmux's FAQ:
https://github.com/tmux/tmux/wiki/FAQ
> PLEASE NOTE: most display problems are due to incorrect TERM! Before reporting problems make SURE that TERM settings are correct inside and outside tmux.
> Inside tmux TERM must be "screen", "tmux" or similar (such as "tmux-256color"). Don't bother reporting problems where it isn't!
> Outside, it should match your terminal: particularly, use "rxvt" for rxvt and derivatives.