Re: switching to vim-tiny for standard vi?
On Tue, 20 Dec 2005, Henning Makholm wrote:
Scripsit Gabor Gombas <firstname.lastname@example.org>
Now, if your terminal pretends to be xterm but does not use the color
scheme of xterm, how should vim know that?
real console: TERM='linux'
I would suggest that the right solution is that every program that
sets foreground colors should also, as its default behavior, make sure
to set a background color that goes well with the chosen foreground.
The "if you pick one color, pick them all" maxim of web design works
for non-web user interfaces, too.
Just stick \e[40m into the program's color codes and suddenly the scheme
becomes XXX-on-black. Use \e[47m and you get XXX-on-white. And, if
termcap/terminfo claim the terminal doesn't support \e[4Xm, it's termcap
which is wrong -- according to my data, Win3.1..ME telnet.exe was the last
terminal emulator in existence which can't handle these.
Even with a genuine xterm users can and do set their personal color
scheme preferences in X resources. But if you're going to override the
foreground color you might as well also override the background
one. Of course any good program should offer per-user customization of
its color scheme, and offer "default" as an option for background
color, in case the user's preferred background is not among the ones
that can be set with ordinary "setb/setab" strings.
Few fancy terminal emulators obey X resources, but you're right. While
the way to set the color palette differs, all of the terminals I named in
this message provide a way to do so.
However, you're wrong if you believe "setb/setab" are good for anything.
Since termcap and terminfo are based on the value of "TERM", they assume
some random settings which are hardly ever valid.
The list I put in the beginning shows that even terminals which use
completely different code bases and have little coverage of common
standards tend to claim they're "xterm". And that's only several
terminals included in Debian. If you go outside, things get a lot worse;
the most spectacular example happens if you log on into a SunOS machine
using any of three terminals shipped with IRIX (as of ~7 years ago).
The failure mode includes removingallcolorsandallspaces.
It may sound strange, but if you want portability, you can't use termcap,
terminfo or *curses -- but on the other hand, using lowest-common-
denominator vt100 codes, \e[ foo m and ioctl(TIOCGWINSZ) makes things work
perfectly everywhere I tested save for the damned telnet.exe.
/-----------------------\ Shh, be vewy, vewy quiet,
| email@example.com | I'm hunting wuntime ewwows!
Segmentation fault (core dumped)