Subject: Re: bin/10116: vi somewhat easily confused by suspension
To: None <,>
From: ITOH Yasufumi <>
List: tech-userlevel
Date: 05/18/2000 09:38:09 writes:

> The cause is that we don't send the escape sequences for keypad on/keypad off
> when the keypad() function is called.  This isn't clear in the documentation
> but is what the Solaris implementation does.  It seems to me that this can be

Which version of Solaris?
I tested on Solaris 5.5.1 and see tty keypad will never be disabled
during a curses session.

#include <curses.h>


	keypad(stdscr, TRUE);
	refresh();		/* send "enable keypad" string */

	keypad(stdscr, FALSE);
	refresh();		/* do nothing */

	keypad(stdscr, TRUE);
	refresh();		/* do nothing */

	keypad(stdscr, FALSE);
	refresh();		/* do nothing */

	endwin();		/* sends "disable keypad" string */
	return 0;

Since the keypad flag belongs to the window (not to the terminal) and
may be set differently between windows, I think the "enable/disable keypad"
string should not be sent by switching the flag --- it may cause unwanted
result in switching such windows (especially for pre-typed keys).


By the way, Solaris curses doesn't send "enable" string before a keypad
flag is set to true, but it is OK and even better to send the string
in initscr(), in my opinion.

Solaris manual curs_inopts(3x) says:
	If disabled (bf is FALSE), curses does not treat function
	keys specially and the program has to interpret the escape
	sequences itself.

and if curses hasn't sent "enable" string, the sequence sent by a keypad
key is uncertain and user program cannot "interpret" the unknown sequence.
ITOH, Yasufumi