1

I am trying to switch from screen to tmux. When I run hg status, I get damaged output like this:

mercurial output in tmux

It doesn't happen to git, it doesn't happen with screen. Any advice will be very appreciated. Thanks.

mpts.cz
  • 221
  • 1
  • 10
  • What happens when you [script](https://stackoverflow.com/questions/1401002/how-to-trick-an-application-into-thinking-its-stdout-is-a-terminal-not-a-pipe) the output on screen vs tmux? do they appear the same? – jeremysprofile Mar 05 '20 at 00:22
  • @jeremysprofile With script nothing changes, on screen or std. gnome terminal the output is OK, on tmux it is broken exactly the same way as without script. – mpts.cz Mar 05 '20 at 00:41
  • It looks like mercurial thinks you are on a VT100 terminal. I guess that $TERM is not set correctly. Try `TERM=xterm-256color hg st` and see if something changes – Rudi May 04 '20 at 04:13

2 Answers2

0

Hmm, it seems like hg is doing something very strange. My guess is it has got completely the wrong idea about how to show colour, but there should be no reason for it to do anything different in tmux than screen.

  • What does echo $TERM show inside tmux before you run hg? What does it show outside tmux?

  • Have you created a .hgrc or similar configuration file? What's in it?

  • Is it the same if you do \hg --pager never --color always status?

  • What does \hg --pager never --color always status|od show?

Nicholas Marriott
  • 3,148
  • 9
  • 12
0

Based on an answer from Nicholas Marriott and comment from Rudi: the problem seems to be that $TERM is set to screen in tmux (whilst std. gnome-terminal has it set to xterm-256color and screen to screen.xterm-256color).

Therefore the solution (at least the one working for me) is to set terminal in the ~/.tmux.conf as follows:

set -g default-terminal "screen.xterm-256color"

Note: using hg --pager never also works, however that is not an acceptable solution.

mpts.cz
  • 221
  • 1
  • 10