Subject: Arrow keys on Non-ANSI terminals

From: [email-masked] (Tim Rice)
Date: 5 Aug 1996 21:09:26 -0700

I just tried pine (unix 3.95) yesterday on a non ANSI terminal (wyse 150)
and noticed that the arrow keys did not work in the main menu like
they do with ANSI type terminals.
Shouldn't it work?
Are the arrow keys hard coded or does it get the info from the curses library?
I've been using pine since var 3.91 and I just realized that's 
the first tim I tried it on a non ANSI terminal.

-- 
-----
Tim Rice	Multitalents		707 887-1469
[email-masked]

---

From: Knute Snortum <[email-masked]>
Date: Thu, 08 Aug 1996 11:34:37 -0700

> the first tim I tried it on a non ANSI terminal.

Pine and Wyse terminals.  [sigh]  Can we get this is a FAQ? ;-)

I'm not the expert on this, but since no one's answered you yet, I'll
give you the basics.  Yes, I believe pine "hard codes" the arrow keys
(someone please correct me if I'm wrong.)  It just has a "list" of
escape sequences that it knows are all arrow keys.

The problem with Wyse terminals is that the arrow keys send control
characters that Pine uses for other functions, such as ^K.  You can
compile Pine so that it uses the arrow keys, but then you lose those
functions.

Solutions?  Several.  One is to use the termcap to turn your terminal
into an ANSI terminal.  Sounds magical, huh?  I believe it uses the "is"
keyword.  Don't know the details.

The other is to reprogram the arrow keys before you go into pine and
reset them when you come out.  I've got a script to do that, but not on
me.  You'll have to wait til Monday for that.  (E-mail me if you want
it.  Oh, and the script is for Wyse 60 terminals, so you might have to
rewrite it.)

Sorry I'm short on specifics, but if you yell loud enough, the experts
will ccome out of the woodwork.  ;-)

---Knute ([email-masked])

---

From: Michael Schuyler <[email-masked]>
Date: Fri, 9 Aug 1996 08:35:01 -0700 (PDT)

> the first tim I tried it on a non ANSI terminal.

Perhaps this is related: Ever since we went to 3.95 several of our users
report screen emulation problems that they had not had prior to 3.95.
There is no mention of screen changes in the update docs. BUT did
something change in 3.95 vis-a-vis VT-100 emulation?

      o o o o o o o . . .   _~~~~~~~~~~~~~~~~~~~~~\_ _/~~~~~~~~~~~~~~~~~~\_
    o      _____            |   Kitsap Regional    | |   LinkNet Support  |
  .][__n_n_|DD[  ====_____  |      Library         | |   'least we try!   |
 >(________|__|_[_________]_|______________________|_|____________________|_
 _/oo OOOOO oo`  ooo   ooo  'o^o^o            o^o^o` 'o^o              o^o`
============================================================================
Support: (360) 405-9131 Fax:(360) 405-9128 [email-masked]
Michael Schuyler:     Voice:(360) 405-9139 [email-masked]

---

From: [email-masked] (Mark Jenks)
Date: 9 Aug 1996 12:47:14 GMT

Aaron M. Scarisbrick ([email-masked]) wrote:
: Aaron M. Scarisbrick ([email-masked]) wrote:
: : a couple others, because Wyse stupidly uses control characters not escape
: : sequences for its arrow keys. This compile option must be put in pico's

: I received some constructive abuse about labeling Wyse's control scheme as
: being "stupid".  I am now enlightened about the bad ol' days when people 
: used 2400 baud and (horrors!) 300 baud modems, and when DEC VT100 terminals
: were new fangled expensive toys.  Please excuse my ignorance as I was in
: elementary school in the very early eighties.  

: I retract my calling Wyse "stupid", and wish to rephrase it as "innovative
: challenged" when compared to more modern schemes.

: ---------------------------------------------------------------------------
: Aaron M. Scarisbrick                    "Yes, this is correct." -Larry Wall
: ---------------------------------------------------------------------------
: [email-masked]                           http://www.xmission.com/~aaron
: ---------------------------------------------------------------------------

Hey, I still have my 110 acoustic-coupler at home (for posperity)..  God, do I
feel old now.

Mark

---

From: Richard Gering <[email-masked]>
Date: Fri, 9 Aug 1996 17:10:45 +0100 (WET)

> > they do with ANSI type terminals.
  [ snip ]
> escape sequences that it knows are all arrow keys.

Pine does indeed maintain a list of ANSI based edit keys that will always
be recognized (arrows, home, end, etc...), but as of version 3.92 this
list just functions as a default.  Starting from this version, Pine will
also obtain a list of valid key sequences from either termcap or terminfo
(depending on the default for your platform). 

> characters that Pine uses for other functions, such as ^K.

To avoid a potential change in behavior when upgrading from a Pine release
prior to 3.92, any sequence that attempts to redefine one of Pine's
default "hard coded" keys is ignored (because termcap/terminfo are
notorious for being incomplete or incorrect). Also, any sequence from
termcap/terminfo that doesn't start with an escape is ignored.

> You can compile Pine so that it uses the arrow keys, but then you lose
> those functions. 

Indeed. By adding "-DTERMCAP_WINS" to the STDCFLAGS definition in the
makefiles pine/makefile.<platform> and pico/makefile.<platform>, any
sequence defined in termcap/terminfo will take precedence over the
defaults of Pine, even if it doesn't start with an escape. As a result,
the arrow keys will now work on any Wyse terminal. 

However, any key that returns a value identical to a Ctrl-<key> function
of Pine or Pico will now have precedence over that function. For example,
if you press Ctrl-K in an attempt to Cut Text in the composer, a cursor up
action will be performed instead (on a Wyse terminal).

You can still access the overlapped functions by using the feature of
Pine/Pico that allows Ctrl-<key> to be entered as ESC ESC <key>, but it
requires a different action on the part of the user.

> keyword.  Don't know the details.

Exactly! On SCO, for example, most of the Wyse terminals are also support
by a terminal entry that ends in "ak" (for ANSI Keys). When you select
these terminal entries, all edit keys will be programmed with ANSI-like
values (indeed using "is" for termcap and "is2" for terminfo). At the same
time, the "interpret sequence X as key Y" values are changed to match the
new ANSI sequences. Pine would have recognized the ANSI keys anyway using
its hard coded list of keys, but it is necessary to support "vi" & co.

On such systems, specifying TERM as "wy150ak" before calling Pine should
make your edit keys work (it might also require a "tput init" command).

> me.

This is indeed the solution to go for if you are lacking the previously
mentioned "ak" entries. Be sure that you DON'T have TERMCAP_WINS enabled
when you are using these scripts. If you do, termcap/terminfo will still
report that certain Ctrl values are to be mapped to keys. Even though Pine
will recognize the reprogrammed ANSI values using its hard coded key list,
pressing an overlapped Ctrl-<key> function would still act like pressing
the key it is "officially" mapped to (gaining nothing over the situation
with just TERMCAP_WINS enabled). 

In general, having TERMCAP_WINS enabled only is a problem if you have
defective termcap/terminfo files or if you are using scripts that will
reprogram your keys. What you gain by enabling it, is right out-of-the-box
support for Wyse terminals (with the forementioned limitations) and (full)
support for a number of other terminals (MAI terminals, anyone?). It
should also be the only way to get the cursor keys of a Wyse 50 to work
because, as far as I know, these keys cannot be reprogrammed. 

I hope this adds some background to the information Knute was kind enough
to supply. I also like to second his idea of putting this information in a
FAQ of some sort. 

Kind regards,

- Richard Gering.

+-----------------------------------------------------------------------------+
| Richard Gering ([email-masked]) | Let me make one thing perfectly clear:  |
| CI International B.V. Netherlands | I never explain anything! (Mary Poppins)| 
+-----------------------------------------------------------------------------+

---

From: Alex Schwallbach <[email-masked]>
Date: Sun, 11 Aug 1996 16:22:35 -0400

I can't get Pine to draw the screen correctly on a Wyse 60. Everything
works fine, except pine. When you get main menu, it doesn't show anything.
However, as you hit the arrow keys to scroll, it shows the highlighted
line and then when you go to the next line, it leaves the one behind...
like it should. 

My question is how to I get pine to write to the screen properly.

>  _/oo OOOOO oo`  ooo   ooo  'o^o^o            o^o^o` 'o^o              o^o`

----------------------------------------
Alexander G. Schwallbach
On-Line Exchange, Inc.
[email-masked]
810-445-2133