lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev something wrong with LYNXKEYMAP


From: Klaus Weide
Subject: Re: lynx-dev something wrong with LYNXKEYMAP
Date: Thu, 21 Oct 1999 09:07:52 -0500 (CDT)

On Thu, 21 Oct 1999, Henry Nelson wrote:

> > 2.8.3dev.4* should get the actions as well as the descriptions right
> > *without lynx.cfg KEYMAP tricks* (and without .lynx-keymaps tricks).
> > If that is not the case, we should investigate further.  (I have an
> > idea why something might be wrong, but am waiting for confirmation/
> 
> Report as best as I can do.  Lynx 2.8.3dev.12, compiled with gcc 2.7.2.3,
> using slang-1.3.8, on Solaris2.6.

Thanks for the level of detail.

> When my terminfo descriptions "ttpro" and "screen" contain the following:
>               kich1=\E[1~, khome=\E[2~, kpp=\E[3~, 
>               kdch1=\E[4~, kend=\E[5~, knp=\E[6~, 
> and my termcap description "SC" contains the following:
>               :kI=\E[1~:kh=\E[2~:kP=\E[3~:\
>               :kD=\E[4~:@7=\E[5~:kN=\E[6~:\
> the following "output" from the keys on the "6-key pad" is captured in
> the file created by the command (csh shell) `cat > 6keypad` (with real
> escape codes substituted with the ascii characters "^[").
> When "screen" is NOT running:
>               insert: ^[[1~  home: ^[[2~  pgup: ^[[3~
>               delete: ^[[4~   end: ^[[5~  pgdn: ^[[6~
> When "screen" IS running:
>               insert: ^[[2~  home: ^[[1~  pgup: ^[[5~
>               delete: ^[[3~   end: ^[[4~  pgdn: ^[[6~

Well, obviously screen "fixes up" your keys to generate the "normal"
sequences, as far as programs running under screen see.  (See how
"standard" they are? :))  But then you go and try very hard to tell
those programs running under screen that no, screen hasn't done that,
and that the keys still act as if the programs were NOT running under
screen - with your "screen" and "SC" descriptions.  That can't help
any programs.  Some may just ignore it (like lynx-with-slang before
2.8.3dev.4) or somehow compensate for it.

What I don't understand, in the running-under-screen case, is why only
one key is wrong.  I would expect much more breakage.  I don't know
what is in the TERMCAP environment variable (you showed only the first
line of a multiline string).  I don't know whether slang uses the terminfo
"screen" description or the TERMCAP variable if both are present (as you
show).  I don't know whether slang does any special "fixups" when it
detects that TERM=screen.  Somehow the result is that most of the 6 keys
act the right way, I'm not sure I want to understand all the details.

But I think I do understand why, in the non-screen case, one key is
wrong.  Try this "patch":

In LYStrings.c, locate 'PRIVATE void setup_vtXXX_keymap NOARGS'.
Replace all of the 'EXTERN_KEY(...)' lines with the following:

        INTERN_KEY( "\033[A",   UPARROW,        KEY_UP ),
        INTERN_KEY( "\033OA",   UPARROW,        KEY_UP ),
        INTERN_KEY( "\033[B",   DNARROW,        KEY_DOWN ),
        INTERN_KEY( "\033OB",   DNARROW,        KEY_DOWN ),
        INTERN_KEY( "\033[C",   RTARROW,        KEY_RIGHT ),
        INTERN_KEY( "\033OC",   RTARROW,        KEY_RIGHT ),
        INTERN_KEY( "\033[D",   LTARROW,        KEY_LEFT ),
        INTERN_KEY( "\033OD",   LTARROW,        KEY_LEFT ),
        INTERN_KEY( "\033[1~",  FIND_KEY,       KEY_FIND ),
        INTERN_KEY( "\033[2~",  INSERT_KEY,     KEY_IC ),
        INTERN_KEY( "\033[3~",  REMOVE_KEY,     KEY_DC ),
        INTERN_KEY( "\033[4~",  SELECT_KEY,     KEY_SELECT ),
        INTERN_KEY( "\033[5~",  PGUP,           KEY_PPAGE ),
        INTERN_KEY( "\033[6~",  PGDOWN,         KEY_NPAGE ),
        INTERN_KEY( "\033[8~",  END_KEY,        KEY_END ),
        INTERN_KEY( "\033[7~",  HOME,           KEY_HOME),
        INTERN_KEY( "\033[28~", F1,             KEY_F(1) ),
        INTERN_KEY( "\033OP",   F1,             KEY_F(1) ),
        INTERN_KEY( "\033[OP",  F1,             KEY_F(1) ),
        INTERN_KEY( "\033[29~", DO_KEY,         KEY_F(16) ),
#if defined(USE_SLANG) && !defined(VMS)
        INTERN_KEY(     "^(ku)", UPARROW,       KEY_UP ),
        INTERN_KEY(     "^(kd)", DNARROW,       KEY_DOWN ),
        INTERN_KEY(     "^(kr)", RTARROW,       KEY_RIGHT ),
        INTERN_KEY(     "^(kl)", LTARROW,       KEY_LEFT ),
        INTERN_KEY(     "^(@0)", FIND_KEY,      KEY_FIND ),
        INTERN_KEY(     "^(kI)", INSERT_KEY,    KEY_IC ),
        INTERN_KEY(     "^(kD)", REMOVE_KEY,    KEY_DC ),
        INTERN_KEY(     "^(*6)", SELECT_KEY,    KEY_SELECT ),
        INTERN_KEY(     "^(kP)", PGUP,          KEY_PPAGE ),
        INTERN_KEY(     "^(kN)", PGDOWN,        KEY_NPAGE ),
        INTERN_KEY(     "^(@7)", END_KEY,       KEY_END ),
        INTERN_KEY(     "^(kh)", HOME,          KEY_HOME),
        INTERN_KEY(     "^(k1)", F1,            KEY_F(1) ),
        INTERN_KEY(     "^(F6)", DO_KEY,        KEY_F(16) ),
#endif /* SLANG && !VMS */

The problem this solves: because of the order, some of the defaults
could override the terminfo/termcap derived bindings, when the
latter should always override the defaults if there are both for a
given escape sequence.

(A proper patch should probably rename the macro and get rid of
EXTERN_KEY, or redefine EXTERN_KEY.)

> There is no KEYMAP define in lynx.cfg, and to the best of my knowledge
> there is no ".lynx-keymaps" file anywhere on my system.  My environment
> variables determined by the command (csh shell) `setenv | grep TERM` are,
> When "screen" is NOT running:
>               TERM=ttpro
>               TERMCAP=/home1/henry/.termcap
>               TERMINFO=/usr/local/share/terminfo
> When "screen" IS running:
>               TERM=screen
>               TERMCAP=SC|screen|VT 100/ANSI X3.64 virtual terminal:\

It seems this is only the first line of several.

>               TERMINFO=/usr/local/share/terminfo
> 
> When Lynx is run with the alias:
>       $HOME/.usr/bin/lynx -cfg=$HOME/.lynx/lynx.cfg
> the six-key pad works as expected, except for the key labeled "Delete,"
> which yields the action "END go to the end of the current document."

That problem should go away with the "patch" above.

> When Lynx is run with the alias:
>       /usr/local/bin/screen $HOME/.usr/bin/lynx -cfg=$HOME/.lynx/lynx.cfg
> the six-key pad works as expected, except for the key labeled "PgUp,"
> which yields the action "END go to the end of the current document."

I don't understand, but you shouldn't set "screen" terminfo and "SC"
termcap as you do.  Or teach screen to not remap those keys, its man
page seems to have enough info for doing that.

It's a complex program, and I'm not using it...  I just had a look at
the man page (of some version), and it seems nearly everything depends
on what's in the screenrc file (or whatever the name is).

> > How many users are there who have such a non-standard situation AND
> > no terminfo description for it?
> 
> Well, I sincerely hope there are enough that debugging this "non-standard
> situation" will have been worth it.

Sure.  It uncovered a real problem.

I didn't mean that your situation was unimportant.  But you seemed to
suggest changing something drastically in the keymapping department.
For that the question "how many users" is very relevant.

   Klaus


reply via email to

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