[GRASS5] grass-5.0.0 on SGI IRIX 6.5 (fwd)

On Tue, 10 Dec 2002, Glynn Clements wrote:

Markus Neteler wrote:

> > The only problem is the Escape and Return keys not working when run from
> > an IRIX winterm. I at least should have proposed a change to the README on
> > the ftp server to mention this; sorry. The partial fix for this has now been
> > merged into the release branch, but still it means the arrow keys don't work
> > now. I was waiting until we got this sorted out before compiling another binary
> > package.
>
> The arrow keys are also broken for me: Linux, HEAD, at least in
> the startup script. Broken in xterm as well as KDE-term. This is a bit
> odd, because it was working and I like the keys. I can report that
> for Suse 7.3 and Redhat 7.1 (with updates).
> Does it have to do with the recent TERMLIB changes?

Possibly. There are two different databases of terminal descriptions:
termcap (typically /etc/termcap) and terminfo (typically
/usr/lib/terminfo/* or /usr/share/terminfo/*).

/usr/lib/terminfo on IRIX 6.2 as I am using

Basically, you need to ensure that both databases accurately describe
the behaviour of the terminal when in "application keypad" mode. (If
you look at xterm's middle-button menu both normally and when using a
vask-based input form; in the latter situation, both the "Enable
Application Cursor Keys" and "Enable Application Keypad" options
should have tick (check) marks).

For GRASS 4.3:
Neither option ticked, arrow keys don't work, but Esc and Return do work

For GRASS 5.0.0:
"Enable Application Cursor Keys" is ticked, arrow keys do work, but Esc
and Return don't work

For latest CVS version:
Neither option ticked, arrow keys don't work, but Esc and Return do work
(back to GRASS 4.3 behaviour)

Here is some info from my system:

Variations on 'iris' terminfo entry:

iris
iris-ansi
iris-ansi-24
iris-ansi-24-net
iris-ansi-66
iris-ansi-66-net
iris-ansi-net
iris-tp
iris40

Output of 'infocmp iris':

# Reconstructed via infocmp from file:
/usr/share/lib/terminfo/i/iris-ansi
iris-ansi|IRIS emulating 40 line ANSI terminal (almost VT100),
  am,
  cols#80, it#8, lines#40,
  bel=^G, bold=\E[1m, clear=\E[H\E[2J,
  cnorm=\E[9/y\E[12/y\E[=6l, cr=\r, cub=\E[%p1%dD,
  cub1=\E[D, cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC,
  cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA,
  cuu1=\E[A, cvvis=\E[10/y\E[=1h\E[=2l\E[=6h,
  dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K,
  home=\E[H, ht=\t, hts=\EH, il=\E[%p1%dL, il1=\E[L,
  ind=\ED, is2=\E[?1l\E>\E[?7h\E[100g\E[0m\E7\E[r\E8,
  kDC=\E[P, kEND=\E[147q, kHOM=\E[143q, kLFT=\E[158q,
  kPRT=\E[210q, kRIT=\E[167q, kSPD=\E[218q, kbs=\b,
  kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C,
  kcuu1=\E[A, kdch1=^?, kend=\E[146q, kent=\r,
  kf1=\E[001q, kf10=\EOQ, kf11=\EOR, kf12=\EOS,
  kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, kf5=\E[005q,
  kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, kf9=\EOP,
  khome=\E[H, kich1=\E[139q, knp=\E[154q, kpp=\E[150q,
  kprt=\E[209q, krmir=\E[146q, kspd=\E[217q, nel=\EE,
  pfkey=\EP101;%p1%d.y%p2%s\E\\, rc=\E8, rev=\E[7m,
  ri=\EM, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m,
  smso=\E[1;7m, smul=\E[4m, tbc=\E[3g,

I hope some of this might be useful.

  key t'info t'cap sequence
  up kcuu1 ku \EOA
  down kcud1 kd \EOB
  right kcuf1 kr \EOC
  left kcub1 kl \EOD
  home khome kh \EOH
  end kend @7 \EOF

When not in application keypad mode, the arrow keys generate the
cursor motion codes (the ones which an application sends to the
terminal to move the cursor).

Also, if the terminal requires a specific sequence to enable
application mode, that must be specified directly; for xterm, it is:

    smkx ks \E[?1h\E=

More information on terminal capabilities can be obtained from the
termcap, terminfo and ncurses manpages. More information on xterm can
be obtained from the xterm manpage.

--
Glynn Clements <glynn.clements@virgin.net>

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Paul Kelly wrote:

> > > The only problem is the Escape and Return keys not working when run from
> > > an IRIX winterm. I at least should have proposed a change to the README on
> > > the ftp server to mention this; sorry. The partial fix for this has now been
> > > merged into the release branch, but still it means the arrow keys don't work
> > > now. I was waiting until we got this sorted out before compiling another binary
> > > package.
> >
> > The arrow keys are also broken for me: Linux, HEAD, at least in
> > the startup script. Broken in xterm as well as KDE-term. This is a bit
> > odd, because it was working and I like the keys. I can report that
> > for Suse 7.3 and Redhat 7.1 (with updates).
> > Does it have to do with the recent TERMLIB changes?
>
> Possibly. There are two different databases of terminal descriptions:
> termcap (typically /etc/termcap) and terminfo (typically
> /usr/lib/terminfo/* or /usr/share/terminfo/*).

/usr/lib/terminfo on IRIX 6.2 as I am using

> Basically, you need to ensure that both databases accurately describe
> the behaviour of the terminal when in "application keypad" mode. (If
> you look at xterm's middle-button menu both normally and when using a
> vask-based input form; in the latter situation, both the "Enable
> Application Cursor Keys" and "Enable Application Keypad" options
> should have tick (check) marks).

For GRASS 4.3:
Neither option ticked, arrow keys don't work, but Esc and Return do work

For GRASS 5.0.0:
"Enable Application Cursor Keys" is ticked, arrow keys do work, but Esc
and Return don't work

For latest CVS version:
Neither option ticked, arrow keys don't work, but Esc and Return do work
(back to GRASS 4.3 behaviour)

Look for HAVE_KEYPAD in src/include/config.h; if it isn't defined,
look for an appropriate error message in config.log; search for the
string "checking for keypad".

The most significant change between 5.0.0 and CVS is that configure
checks for the existence of keypad(), and the vask library only uses
it if it's detected.

The problems with Esc-Return suggest a bug in the curses library.
Calling keypad() causes the curses input routines to trap sequences
beginning with the ESC character and to return extended codes upon
receipt of a sequence which corresponds to an extended key. However,
the curses library is supposed to implement a timeout, and any
unrecognised sequences should be passed on as-is.

The curs_inopts(3) manpage says:

       While interpreting an input escape sequence, wgetch sets a
       timer while waiting for the next character. If notime­
       out(win, TRUE) is called, then wgetch does not set a
       timer. The purpose of the timeout is to differentiate
       between sequences received from a function key and those
       typed by a user.

If your version of curses provides notimeout(), it may be worth adding
notimeout(win, FALSE) to see if that helps.

--
Glynn Clements <glynn.clements@virgin.net>

On Wed, 11 Dec 2002, Glynn Clements wrote:

Paul Kelly wrote:

> > > > The only problem is the Escape and Return keys not working when run from
> > > > an IRIX winterm. I at least should have proposed a change to the README on

Look for HAVE_KEYPAD in src/include/config.h; if it isn't defined,
look for an appropriate error message in config.log; search for the
string "checking for keypad".

Yes, the line
#define HAVE_KEYPAD 1
is present in src/include/config.h

The most significant change between 5.0.0 and CVS is that configure
checks for the existence of keypad(), and the vask library only uses
it if it's detected.

This seems a bit obvious, but neither of the files V_init.c nor V_exit.c
in src/libes/vask include the line
#include "config.h"

The problems with Esc-Return suggest a bug in the curses library.
Calling keypad() causes the curses input routines to trap sequences
beginning with the ESC character and to return extended codes upon
receipt of a sequence which corresponds to an extended key. However,
the curses library is supposed to implement a timeout, and any
unrecognised sequences should be passed on as-is.

The curs_inopts(3) manpage says:

       While interpreting an input escape sequence, wgetch sets a
       timer while waiting for the next character. If notime­
       out(win, TRUE) is called, then wgetch does not set a
       timer. The purpose of the timeout is to differentiate
       between sequences received from a function key and those
       typed by a user.

If your version of curses provides notimeout(), it may be worth adding
notimeout(win, FALSE) to see if that helps.

Where should this go? I tried adding
notimeout(stdscr, FALSE);
above the statement
newchar=getch();
in V_call.c but there was no change in behaviour (of course I first
re-enabled the calls to keypad(), and also tried changing getch() to
wgetch(stdscr)). Just looks like a bug in IRIX curses then. I suppose we
can do without the arrow keys.

Paul

Paul Kelly wrote:

This seems a bit obvious, but neither of the files V_init.c nor V_exit.c
in src/libes/vask include the line
#include "config.h"

Yep, that's the problem.

> The problems with Esc-Return suggest a bug in the curses library.
> Calling keypad() causes the curses input routines to trap sequences
> beginning with the ESC character and to return extended codes upon
> receipt of a sequence which corresponds to an extended key. However,
> the curses library is supposed to implement a timeout, and any
> unrecognised sequences should be passed on as-is.
>
> The curs_inopts(3) manpage says:
>
> While interpreting an input escape sequence, wgetch sets a
> timer while waiting for the next character. If notime­
> out(win, TRUE) is called, then wgetch does not set a
> timer. The purpose of the timeout is to differentiate
> between sequences received from a function key and those
> typed by a user.
>
> If your version of curses provides notimeout(), it may be worth adding
> notimeout(win, FALSE) to see if that helps.

Where should this go? I tried adding
notimeout(stdscr, FALSE);
above the statement
newchar=getch();
in V_call.c but there was no change in behaviour (of course I first
re-enabled the calls to keypad(), and also tried changing getch() to
wgetch(stdscr)). Just looks like a bug in IRIX curses then. I suppose we
can do without the arrow keys.

The problem there is that if configure detects that you have a
keypad() function, V_init() will use it, and then Esc-Enter won't
work. There probably isn't any practical way to make configure detect
that keypad() is broken in this regard.

--
Glynn Clements <glynn.clements@virgin.net>