Jens Wilhelm Wulf <[EMAIL PROTECTED]> wrote:
>
> I thought that the codes from terminfo are the ones programs see (if
> they use it, no matter how it is done), and so it is important that
> terminfo is correct.

The codes you refer to in terminfo are actually strings, whereas the
value KEY_NPAGE is simply a number.  A number is much easier for a
computer to handle than just a string.

> Why does ncurses do a second translation?

Keep in mind that there are two major methods for handling terminals: 
terminfo and termcap.  Some curses systems do not use terminfo at all,
and so that is another reason to create an abstraction layer above
terminfo/termcap:  So that a curses program does not need to know what
the underlying terminal access method is, and is thus more portable.

> But what about the fact that my mutt is linked against slang, not
> curses?  (I mentioned this in my first mail!)

I can't remember every message sent to me.  :)

> slang defines:
>  #define SL_KEY_PPAGE            0x105
>  #define SL_KEY_NPAGE            0x106
>  #define KEY_PPAGE       SL_KEY_PPAGE
>  #define KEY_NPAGE       SL_KEY_NPAGE

You are correct that these are the codes you should be paying attention
to.  My assumption that you were using ncurses was incorrect.

> So I linked David's program to slang instead of curses and got:
> 
> 412/415 for pageup/pagedown and 0177777 for home/end.  THAT looks like
> what mutt sees.

If I remember rightly, slang does not use terminfo, but termcap instead.
I suppose that means you should check for /etc/termcap, and see if you
can find your terminal defined there.

> My problem is that 0x105 is 261 and not 415 or 522.

I (and Mikko) was using "octal" (base 8) representation for these
numbers.  Octal 412 is hex 0x10a, and 415 is 0x10D.  Looking these up in
slang.h, I find:

    #define SL_KEY_A3           0x10A
    #define SL_KEY_C3           0x10C

I don't know offhand what those keys mean, or why slang wants to treat
your page up/down keys with these codes.

> I can't even do a quick hack to mutt, as it gets 0177777 for more than
> one key.

Octal 177777 is the representation for -1, which is an error return from
getch().  I guess that means it doesn't understand what key you pressed?

Anyway, it seems to me that ncurses works the way you expect in this
case, and slang does not.  Either way, however, Mutt is not the source
of the problem.

-- 
David DeSimone   | "The doctrine of human equality reposes on this:
[EMAIL PROTECTED]   |  that there is no man really clever who has not
Hewlett-Packard  |  found that he is stupid." -- Gilbert K. Chesterson
UX WTEC Engineer |    PGP: 5B 47 34 9F 3B 9A B0 0D  AB A6 15 F1 BB BE 8C 44

Reply via email to