Subject: Re: bin/10116: vi somewhat easily confused by suspension
To: None <gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org>
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
List: tech-userlevel
Date: 05/22/2000 09:52:50
> The specification says
> <http://www.opengroup.org/onlinepubs/007908799/xcurses/keypad.html>:
> 
> |	If the terminal in use requires a command to enable it to transmit
> |	distinctive codes when a function key is pressed, then after keypad
> |	translation is first enabled, the implementation transmits this
> |	command to the terminal before an affected input function tries to
> |	read any characters from that terminal.
> 
> the keypad is enabled when translation is first enabled,
> it does NOT say the keypad is disabled when translation is disabled.
> 
> I think the "first" imply that the "keypad enable" sequence is not
> sent on the second time and later.
> If the keypad is disabled when translation is disabled, the "first"
> was not necessary (enable keypad every time).

> So, I don't think Solaris curses breaks the spec.

> Solaris curses is the better reference implementation compared to ncurses
> for SUSv2 compliant, from my experience.

Hmm, I was also looking at the wgetch() specification :

  "If keypad()  is  enabled, these functions respond to the pressing of a
   function  key  by returning the corresponding KEY_ value defined in
   <curses.h>."

and also the Solaris curs_inopts(3X) page :

  "The keypad() option enables the keypad of the user's  termi-
   nal.  If enabled (bf is TRUE), the user can press a function
   key (such as an arrow key) and  wgetch()  returns  a  single
   value  representing  the   function  key, as in KEY_LEFT. If
   disabled (bf is FALSE), curses does not treat function  keys
   specially  and  the  program  has  to  interpret  the escape
   sequences itself. If the  keypad  in  the  terminal  can  be
   turned on (made to transmit) and off (made to work locally),
   turning on this option causes  the  terminal  keypad  to  be
   turned  on  when  wgetch() is called.  The default value for
   keypad is false."

I took this to mean that the code should enable /and/ disable the keypad.
However, as it doesn't explicitly state this, I'm willing to back out the
change and only send the sequence once when keypad is first called. I think
we should still send the disable sequence on sigtstp though (and the enable
sequence if necessary on restart).

Assuming we do the above, shall I just comment the code in vi/build/config.h :

  /* Define if you have a BSD version of curses. */
+ /*
  #ifndef __SVR4
  #define HAVE_BSD_CURSES 1
  #endif
+ */

> Julian supports A; I support B.

;-)

J

-- 
                    My other computer also runs NetBSD
                          http://www.netbsd.org/