<<< Date Index >>>     <<< Thread Index >>>

Terminfo settings et al. (was: Subject üî)



It seems to me that my own problems are related to this thread, so
I'll chime in here (with a "Was:..." change of the subject line). I've
found some really useful information, both in the reply to my intial
mail a few days back, and in this thread, but my attempts at changing
things here and there have been too random to be useful, so I've
decided to take a step back and review my options, hopefully with some
guidance from you knowledgeable people.


========
PROBLEM:
========
getting screen to work with 256 colors, without having any of the
following problems:

- function keys w/modifiers (shift, ctrl, alt) don't work, at least
  not as expected. In vim: c-f10 sends something that turns the five
  following characters uppercase. All the f-keys do something similar:
  move somewhere on the line, and make sth uppercase.
  If I enter the function keys directly, either after a command line prompt
  or in vim through ^v, the output is the same, first in an xterm with
  TERM=xterm-256color, then in an xterm with screen running and
  TERM=screen-256color-s. In both cases, the command line says 1;5~
  and in vim it says: ^[[21;5~ c-f10, then, apparently sends
  '<esc>1;5~', and vim behaves accordingly: moves five characters
  forwards and changes their case. 
  So am I right in guessing, then, that when it doesn't work in screen,
  it's because the preceding ^[[2 is not interpreted as I expect it to, and
  that this would be where I would search for an answer?

- colors: some (ncurses based?) apps like mutt, don't display backgrounds
  correctly in areas without text, as I described in my previous post.

- screen refreshing after leaving apps: should get back to the state it was
  before entering e.g. vim, but now just scrolls up the screen (as
  described in this thread by Kyle; does the solution apply to
  settings for xterm too?).

- I don't know if this is related: on the console, many commands make
  some color code being displayed on the screen. E.g.: in a clean
  shell, directly after logon:
      
      $echo $TERM
      $linux
      $vim
      in vim: pressing ':' gives ':2;blue' on the command line



==========
Questions:
==========

Where and how should I set the TERM variable?  I guess there are five
possible levels here: environment/shell, Xterm, Screen, ncurses, and
application.
My distro's wiki (Archlinux) says that it's a bad idea to set the TERM
variable in .bashrc, but that applications should be able to figure it
out for themselves.

So, which of these possible values of TERM do I put where?  
    xterm
    xterm-256color
    screen-256color
    screen-256color-s
    screen-256color-bce
    screen-256color-bce-s

Should it be the same everywhere I set it? 
Or does e.g. screen translate screen-256color to xterm-256color or vice
versa? Or override xterm's choice (xterm-256color) with its own?
What exactly does that setting do anyway? Tell applications what to load
from the terminfo database? about how to translate input (keypresses) to
output?

How do I make changes to the terminfo database?
Are they dangerous?
Can i corrupt anything?  Will experimenting cause damage?
How do I revert?
How much does this have to do with curses?

More concretely:
  - how do I get my function keys back?
  - which escape code is responsible for the missing colour refreshing in
    mutt etc.?
  - dito for the refreshing of the screen after leaving a (ncurses-based?)
    program.
  - and, RTFM oriented, which parts of  the system do I need to know
    more about - terminfo? Screen? I wouldn't want to spend a week
    reading up on terminfo if the solution is to change a single
    variable somewhere....

My system is Archlinux, XTerm(229), Screen version 4.00.03 (FAU)
23-Oct-06, both of which are compiled with 256 color support.

I realize that this ended up not having that much to do with the
original thread, but I did change the subject line...


Eyolf

-- 
Everything that can be invented has been invented.
                -- Charles Duell, Director of U.S. Patent Office, 1899