Gentoo Archives: gentoo-dev

From: Francesco R <vivo@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Fixing the TERM mess
Date: Mon, 29 Aug 2005 10:47:31
Message-Id: 4312E71F.2080603@gentoo.org
In Reply to: Re: [gentoo-dev] Re: Fixing the TERM mess by Ciaran McCreesh
1 Ciaran McCreesh wrote:
2
3 >On Sun, 21 Aug 2005 18:43:54 -0400 Dan Meltzer
4 ><parallelgrapefruit@×××××.com> wrote:
5 >| putty pretends to be an xterm and dies at xtermcontrol --get-bg... I
6 >| can test other things if you need.. just give me some idea :)
7 >
8 >Thanks. The other useful one is to see whether it does 256 colours
9 >properly like real xterm does. The following bash script, when run with
10 >'256' as its argument, should look the same as it does when run under
11 >a real xterm.
12 >
13 >
14 >#!/usr/bin/env bash
15 ># vim: set sw=4 sts=4 et :
16 >
17 >[[ -z "${1}" ]] && cat <<END && exit 1
18 >Usage: ${0} [count]
19 >
20 >count should usually be either 88 (rxvt-based terminals) or 256
21 >(xterm-based terminals).
22 >END
23 >
24 >echo -n " 0: "
25 >for (( a = 0 ; a < ${1} ; a++ )) ; do
26 > echo -n -e "\e[38;5;${a#0}m#\e[48;5;${a#0}mX\e[0;0m "
27 > [[ -z "${a##*9}" ]] && echo -n -e "\n\e[0;0m$(printf '%3d' ${a} ): "
28 >done
29 >echo -e "\e[0;0m" ; echo
30 >
31 >
32 >
33 Probably putty use "xterm" as default instead to be usable on most
34 configurations.
35 I've found that putty is the best (free on windows) "linux" term
36 emulator around.
37 As a consequence all my win boxes use it with the following settings:
38
39 Terminal -> Keyboard -> The Functions keys and keypad -> Linux
40 Connection -> Data -> Terminal-type string -> "linux"
41
42 with this settings the "xtermcontrol --get-bg" output this:
43 xtermcontrol: TERM=linux: probably not xterm variant
44
45 The script you posted here has good results for $1 = 256 for putty
46 version 0.58 .
47 For version 0.56 of putty the for loop need to start from "13" instead
48 of "0" or it screwed up things at the extend that a "reset" need to be
49 run. Additionally the color support is limited to 16 .
50
51 --
52 gentoo-dev@g.o mailing list