Kermit FAQ - My Arrow Keys Don't Work

(Home) (Prev) (Next)

23 My Arrow Keys Don't Work

Newsgroups: comp.protocols.kermit.misc
Date: Mon Apr 24 10:24:29 1995
From: Frank da Cruz <fdc@columbia.edu>
Subject: Re: arrow keys and www?
Organization: Columbia University

In article <3n2s56$rb4@news-2.csn.net>,
Gideon Weisz <gweisz@csn.net> wrote:
>
> This has to be a very simple problem, so apologies in advance, but I
> am stuck.  In www, using lynx, with mskermit 3.14 and vt220 (and
> HEBREW macro) the arrow keys do not work right.  To move among
> highlighted links, one is supposed to use the up/down arrows and to
> move among levels the left/right keys.  However, if I use
> right-arrow, I get "do you wish to send a comment"; if I use
> left-arrow it is taken as a command to download down-arrow moves me
> up! (up the screen to the last highlight).
>
Kermit is emulating a real VT220 terminal.

The VT220 cursor (arrow) keypad can be in one of two modes: cursor mode and application mode. These keys send different escape sequences depending on which mode they are in. When a VT220 is turned on (and when Kermit is started), the arrow keys are in cursor mode.

By default (that is, unless you give SET KEY commands to change things), MS-DOS Kermit uses the IBM keyboard arrow keys as the VT220 arrow keys. Each key has a "verb" assigned to it:

  Up arrow      \Kuparr
  Down arrow    \Kdnarr
  Right arrow   \Krtarr
  Left arrow    \Klfarr
These verbs track the cursor keypad mode automatically, and send the following escape sequences:
               Cursor Mode   Application Mode

  \Kuparr        CSI A           SS3 A
  \Kdnarr        CSI B           SS3 B
  \Krtarr        CSI C           SS3 C
  \Klfarr        CSI D           SS3 D
where CSI is ESC followed by left bracket ([) on a 7-bit connection or decimal 155 on an 8-bit connection, and SS3 is ESC followed by O (uppercase letter O) on a 7-bit connection and decimal 143 on an 8-bit connection.

How does the cursor keypad mode change? The host can change it by sending special escape sequences, or you can change it yourself by using the command:

  SET TERMINAL ARROW-KEYS { CURSOR, APPLICATION }
So why do the arrow keys not work in Lynx? Or, in general, in any particular application:
  1. Because the application expects the keypad to be in one mode when it is in the other mode. This is a deficiency on the part of the application. Applications should never ASSUME which mode the cursor keypad is in, but rather, they should PUT the keypad in the desired mode, or else they should accept arrow-key codes from either mode. Workaround: tell Kermit to SET TERM ARROW CURSOR (or APPLICATION).
  2. Because of a terminal-type mismatch. Lynx, in particular, does not seem to use the termcap database (it uses only terminfo), and so therefore might not understand Kermit's VT220 or VT320 terminal type (this kind of confusion typically occurs when a terminal type is in the termcap database but not the terminfo one, and therefore works with EMACS or vi, but not with Lynx). Solution: tell Kermit to SET TERM TYPE VT100 and also tell the host your terminal type is VT100, before starting Lynx, and ask you system administrator to add missing terminfo entries.
  3. Because of a character-size mismatch. If you have been using a VMS-based VT220 or VT320 fullscreen application (such as ALEPH, EVE, etc), you might find that your arrow keys are sending 8-bit codes rather than 7-bit codes, and then when switching to another application like Lynx, the new application might not understand the 8-bit codes. Again, this is a deficiency of the application. Workaround: tell Kermit to SET TERM CONTROLS 7.
I put MS-DOS Kermit into Hebrew mode, accessed the ALEPH software, tried the arrow keys and they worked OK. Then I left ALEPH and started Lynx and got the same symptoms you reported. The three steps above fixed the problem.

[NOTE: In Kermit 95, the arrow keys, along with all other keys, are set up automatically whenever you give a SET TERMINAL TYPE command.]

- Frank


Kermit FAQ / Columbia University / kermit@kermitproject.org