[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: terminfo, function keys and linux console

From: Dave Wood
Subject: Re: terminfo, function keys and linux console
Date: Fri, 9 Jan 2009 06:04:29 +0000
User-agent: Mutt/1.5.18 (2008-12-10)

On (16:26 09/01/09), Tim Allen <address@hidden> put forth the proposition:
On Fri, Jan 09, 2009 at 05:12:54AM +0000, Dave Wood wrote:
I notice in /etc/termcap:


for linux console. I tried changing these too but no effect. You mention
editing source, but what is the point of termcap/terminfo if those entries
get ignored and the console emits what it likes? I don't understand this at
all. I thought the whole point of terminfo was that is was to do just that?

Let's say you're running mutt on the linux console and hit F1. Whatt
happens is something like this:

- The kernel reads the scancode from the keyboard hardware.
- The kernel figures out which TTY is connected to the active virtual
- The console driver converts the keycode into a string, and writes
  that string to the TTY.
- mutt reads the string from the TTY, then hands the string off to
- ncurses looks up the string in the termcap/terminfo database.
- ncurses finds the string corresponds to KEY_F1 (or whatever) and
  returns that code to mutt.
- mutt runs whatever function is bound to KEY_F1.

If you change the definition of F1 in the termcap/terminfo databases,
you'll merely prevent applications from recognising the F1 key, you
won't cause the console driver change.

That's the problem - vim, mutt and other programs don't recognise the F1 -
F5 keys. When I press F1 in vim it thinks I'm pressing 'A' because the sequence is [[A where in most consoles in X for example it's [11~.
So far the only way I've found to fix this is make a keymap that binds
those function keys to keys that I don't use often and then set up mappings
in vim to use those keys rather than F1-5.

The only terminal emulator I know of that reads termcap/terminfo to
figure out what to send is zvt, used by gnome-terminal - and these days
it has a lot of hard-coded VT100 sequences anyway.

Bug-ncurses mailing list

Show respect for age.  Drink good Scotch for a change.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]