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

Re: Terminfo settings et al



On 2007-09-07, Eyolf strem <eyolf@xxxxxxxxxxx> wrote:
> First of all: thanks for your reply - here, and to the previous post.
> Much helpful. I will have to read up on terminfo, I can tell...
> And test some settings. Phew...

You're welcome.  Sometimes these issues have easy answers and 
sometimes you just have to wade through the documentation and try 
some stuff.

I'm not an expert on any of this.  I've just encountered enough 
problems over the years and learned enough to solve most of them 
that I can give you a few answers and maybe point you in the right 
direction to find the rest yourself.

> On 07.09.2007 (10:10), Gary Johnson wrote:
>  
> > When using screen, however, the
> > application is communicating with your terminal through screen, so
> > while screen should sit transparently between your terminal and the
> > application, screen does have to know something about the character
> > sequences being used to control the terminal.
> 
> Does this mean that I could make a terminfo entry called, say,
> 'my-screen-in-xterm', based on that for xterm-256color, and set that
> in .screenrc? That would tell screen exactly which capabilities the
> terminal has, wouldn't it? But why then doesn't it work to set 'term
> xterm-256color' directly?

I don't know.  It's been a while since I read the screen man page.  
The last time I did, I learned a little (now forgotten) about the 
interactions among screen, terminals and applications and how to 
compile a terminfo entry that would fix the problem.  It didn't 
involve my .screenrc.

> > Also, there are some applications that are hard-coded to recognize
> > certain terminal names.  They may know what to do with "xterm" but
> > not "xterm-256color".
> 
> Is this the reason? That mutt and mocp (and vim?) know about xterm but
> not xterm-256color?

I don't know.  Probably not in the case of mutt, but the only way to 
know for sure is to look in the source.

> > > How much does this have to do with curses?
> > 
> > Everything.  Applications often use a curses library to interface
> > with the terminal they're running in.  That library uses the
> > terminfo database to figure out what character sequences to send to
> > the terminal in order to execute a particular curses function.
> 
> So terminfo is only relevant for applications that use ncurses? 

Not only ncurses, but any library the provides an interface to the 
terminfo library.  HP-UX and Solaris each have their own curses 
library, for example.  Slang is another.

> > Things that can go wrong include:
> > 
> > -  The TERM value is incorrect for the terminal being used.
> 
> And when I run screen, what is 'the terminal being used' - is it
> screen(-256color) or the terminal which screen runs in? Or both?

I meant the thing you look at and type into, e.g. xterm, but when 
using screen, which has some of the behaviors of a terminal and 
which sets TERM itself, it does get more complicated.

> This is one of the things I haven't fully grasped yet: 
> does the information pass serially through the full chain 
> application > ncurses > screen > xterm > system (so that e.g. 
> mutt will have to know about screen's capabilities, and screen 
> about xterm's?), or are there shortcuts? Also: are the values 
> simply transFERRED from one level to the next, or are they also 
> transLATED, so that, e.g. c-F10 is called 'apple' in mutt and 
> 'orange' in xterm, and ncurses knows how to translate between 
> them? 

As I wrote above, I don't remember exactly which character sequences 
screen passes transparently, which ones it acts upon and which, if 
any, it modifies.  All that is in the man page, as I recall.

> > -  The terminfo database entry for TERM is missing, incomplete or
> >    otherwise doesn't contain accurate information for the terminal
> >    being used.
> 
> It sounds as if this is the case, then? since ...
> 
> > -  The curses library used by the application is old, broken or
> >    otherwise doesn't allow the application access to all of the
> >    terminfo capabilities.  
> 
> ... the curses version is 5.6.20061217, and ...

If you're using ncurses on a relatively recent Linux distribution, 
it's not likely to be the problem.  That one in particular should be 
fine (based on my usage of 5.5).

> > -  The application uses its own idea of a terminal's capabilities
> >    instead of or in addition to the terminfo database.
> 
> ... the problem occurs in many different applications, so unless they
> all make the same assumptions, the problem should lie somewhere else,
> no?

True.  

Regards,
Gary