Hi

Okay, I can see the problem.

$ TERM=screen-256color tput setaf 15|cat -v
^[[97m
$ TERM=xterm-256color tput setaf 15|cat -v
^[[38;5;15

It appears screen-256color converts colours 8-15 into 90-97 which are an
extension designed to allow bright colours without the bold attribute (bold
font).

Looking briefly at xterm-256color in terminfo.src I can't see why it doesn't do
the same but I don't have time or inclination to dig into it right now.

I'm not certain why it does this because in 256 colour mode, colours 8-15 are
supposed to be the bright ANSI colours anyway, compare:

$ echo -e \\033[93mabc\\033[38\;5\;11mdef\\033[33m\\033[1mxyz

This appears to be yet another terminal capability without a terminfo flag
allowing it to be detected so tmux can't make use of it explicitly (ie pass it
through if it is supported). However, converting it into colours 8-15 (which
should then be converted into 3x+bold for non-256-colour terminals) should
hopefully do the trick.

Please try this:

Index: input.c
===================================================================
RCS file: /cvsroot/tmux/tmux/input.c,v
retrieving revision 1.97
diff -u -p -r1.97 input.c
--- input.c     15 Oct 2009 01:53:48 -0000      1.97
+++ input.c     23 Oct 2009 12:17:55 -0000
@@ -1494,6 +1494,28 @@ input_handle_sequence_sgr(struct input_c
                        gc->flags &= ~GRID_FLAG_BG256;
                        gc->bg = 8;
                        break;
+               case 90:
+               case 91:
+               case 92:
+               case 93:
+               case 94:
+               case 95:
+               case 96:
+               case 97:
+                       gc->flags |= GRID_FLAG_FG256;
+                       gc->fg = m - 82;
+                       break;
+               case 100:
+               case 101:
+               case 102:
+               case 103:
+               case 104:
+               case 105:
+               case 106:
+               case 107:
+                       gc->flags |= GRID_FLAG_BG256;
+                       gc->bg = m - 92;
+                       break;
                }
        }
 }



On Fri, Oct 23, 2009 at 10:30:34PM +1100, Tim Allen wrote:
> On Fri, Oct 23, 2009 at 11:11:18AM +0100, Nicholas Marriott wrote:
> > The FAQ does not say that setting TERM to screen-256color will just
> > work, although it could probably be clearer. You need to do two
> > things:
> 
> My apologies - I already have 256-color support with appropriate TERM
> settings working in gnome-terminal and screen, so from my point of view,
> setting TERM inside tmux was the only thing I believed missing.
> 
> > If you do step (2) and can successfully see 256 colours with, for
> > example, the colortest script at
> > http://www.vim.org/scripts/script.php?script_id=1349, and get them by
> > using TERM=xterm-256color, then it sounds like a problem with the
> > screen-256color terminfo entry. In this case, please send me a copy of
> > "infocmp screen-256color" and "tmux info".
> 
> I have attached the output of "infocmp screen-256color" and "tmux info"
> as you requested.
> 
> The colortest script that you link to is useful but verbose - I have
> written my own color-test script (also attached) whose output is more
> compact, and also attached a screenshot comparing the output with
> TERM=screen-256color versus the output with TERM=xterm-256color. It
> seems that the 256 colours are represented well enough, it's the colours
> from 8-15 that aren't being interpreted correctly.

> #     Reconstructed via infocmp from file: /lib/terminfo/s/screen-256color
> screen-256color|GNU Screen with 256 colors,
>       am, km, mir, msgr, xenl,
>       colors#256, cols#80, it#8, lines#24, ncv#3, pairs#32767,
>       acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
>       bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
>       clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M,
>       csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
>       cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
>       cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
>       cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
>       dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
>       flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
>       il=\E[%p1%dL, il1=\E[L, ind=^J, initc@, is2=\E)0, kbs=^H,
>       kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
>       kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
>       kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
>       kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
>       khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
>       nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O,
>       rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m,
>       rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7,
>       setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
>       setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
>       
> sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
>       sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h,
>       smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g,


> tmux 1.0, pid 8056, started Fri Oct 23 22:20:56 2009
> socket path /var/run//tmux/tmux-1000/default, debug level 0
> system is Linux 2.6.30-1-686 #1 SMP Sat Aug 15 19:11:58 UTC 2009 i686
> configuration file is /home/st/.tmux.conf
> protocol version is 1
> 2 clients, 1 sessions
> 
> Clients:
>  0: /dev/pts/4 (4, 5): 0 [80x24 xterm-256color] [flags=0x1/0x18, references=0]
> 
> Sessions: [5/9]
>  0: 0: 1 windows (created Fri Oct 23 22:20:56 2009) [80x23] [flags=0x0, 
> references=0]
>    0: bash [80x23] [flags=0x0, references=1, last layout=-1]
>      0: /dev/pts/5 8057 7 3/23, 515 bytes; UTF-8 0/23, 0 bytes
> 
> Terminals:
> xterm-256color [references=1, flags=0x3]:
>  0: AX: [missing]
>  1: acsc: (string) ``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~
>  2: bel: (string) \007
>  3: blink: (string) \033[5m
>  4: bold: (string) \033[1m
>  5: civis: (string) \033[?25l
>  6: clear: (string) \033[H\033[2J
>  7: cnorm: (string) \033[?12l\033[?25h
>  8: colors: (number) 256
>  9: csr: (string) \033[%i%p1%d;%p2%dr
> 10: cud: (string) \033[%p1%dB
> 11: cud1: (string) \012
> 12: cup: (string) \033[%i%p1%d;%p2%dH
> 13: dch: (string) \033[%p1%dP
> 14: dch1: (string) \033[P
> 15: dim: [missing]
> 16: dl: (string) \033[%p1%dM
> 17: dl1: (string) \033[M
> 18: el: (string) \033[K
> 19: el1: (string) \033[1K
> 20: enacs: [missing]
> 21: ich: (string) \033[%p1%d@
> 22: ich1: [missing]
> 23: il: (string) \033[%p1%dL
> 24: il1: (string) \033[L
> 25: invis: (string) \033[8m
> 26: is1: [missing]
> 27: is2: (string) \033[!p\033[?3;4l\033[4l\033>
> 28: is3: [missing]
> 29: kcbt: (string) \033[Z
> 30: kcub1: (string) \033OD
> 31: kcud1: (string) \033OB
> 32: kcuf1: (string) \033OC
> 33: kcuu1: (string) \033OA
> 34: kdch1: (string) \033[3~
> 35: kend: (string) \033OF
> 36: kf1: (string) \033OP
> 37: kf10: (string) \033[21~
> 38: kf11: (string) \033[23~
> 39: kf12: (string) \033[24~
> 40: kf13: (string) \033O2P
> 41: kf14: (string) \033O2Q
> 42: kf15: (string) \033O2R
> 43: kf16: (string) \033O2S
> 44: kf17: (string) \033[15;2~
> 45: kf18: (string) \033[17;2~
> 46: kf19: (string) \033[18;2~
> 47: kf20: (string) \033[19;2~
> 48: kf2: (string) \033OQ
> 49: kf3: (string) \033OR
> 50: kf4: (string) \033OS
> 51: kf5: (string) \033[15~
> 52: kf6: (string) \033[17~
> 53: kf7: (string) \033[18~
> 54: kf8: (string) \033[19~
> 55: kf9: (string) \033[20~
> 56: khome: (string) \033OH
> 57: kich1: (string) \033[2~
> 58: kmous: (string) \033[M
> 59: knp: (string) \033[6~
> 60: kpp: (string) \033[5~
> 61: op: (string) \033[39;49m
> 62: rev: (string) \033[7m
> 63: ri: (string) \033M
> 64: rmacs: (string) \033(B
> 65: rmcup: (string) \033[?1049l
> 66: rmir: (string) \033[4l
> 67: rmkx: (string) \033[?1l\033>
> 68: setab: (string) \033[48;5;%p1%dm
> 69: setaf: (string) \033[38;5;%p1%dm
> 70: sgr0: (string) \033[m\033(B
> 71: smacs: (string) \033(0
> 72: smcup: (string) \033[?1049h
> 73: smir: (string) \033[4h
> 74: smkx: (string) \033[?1h\033=
> 75: smso: (string) \033[7m
> 76: smul: (string) \033[4m
> 77: xenl: (flag) true
> 

> #!/bin/bash
> 
> 
> if [ "$(tput colors)" -ge 8 ]; then
>     tput setaf 0
>     c=0
>     while [ $c -lt 8 ]; do
>       tput setab $c
>       printf " %02x " $c
>       c=$((c+1))
>     done
>     tput sgr0
>     echo
>     tput el
> fi
> 
> if [ "$(tput colors)" -ge 16 ]; then
>     tput setaf 0
>     c=8
>     while [ $c -lt 16 ]; do
>       tput setab $c
>       printf " %02x " $c
>       c=$((c+1))
>     done
>     tput sgr0
>     echo
>     tput el
> fi
> 
> if [ "$(tput colors)" -ge 256 ]; then
>     x=0
>     while [ $x -lt 6 ]; do 
>       tput setaf 0
>       y=0
>       while [ $y -lt 40 ]; do
>           c=$(($y * 6 + $x + 16))
>           tput setab $c
>           printf "%02x" $c
>           y=$((y+1))
>       done
>       tput sgr0
>       echo
>       tput el
>       x=$((x+1))
>     done
> fi




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to