Send 'ks' sequence from first call to keypad(win, TRUE) only and not from

wgetch().  Don't send 'ke' sequence from keypad(win, FALSE) or wgetch().
This makes us compatible with Solaris.
Suggested by ITOH Yasufumi.
This commit is contained in:
jdc 2000-05-25 06:46:26 +00:00
parent 1498143bfa
commit c1ea940db9
2 changed files with 5 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getch.c,v 1.28 2000/05/17 16:23:49 jdc Exp $ */
/* $NetBSD: getch.c,v 1.29 2000/05/25 06:46:26 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: getch.c,v 1.28 2000/05/17 16:23:49 jdc Exp $");
__RCSID("$NetBSD: getch.c,v 1.29 2000/05/25 06:46:26 jdc Exp $");
#endif
#endif /* not lint */
@ -696,10 +696,6 @@ wgetch(WINDOW *win)
__save_termios();
if (win->flags & __KEYPAD) {
if (!(curscr->flags & __KEYPAD)) {
tputs(KS, 0, __cputchar);
curscr->flags |= __KEYPAD;
}
switch (win->delay)
{
case -1:
@ -717,10 +713,6 @@ wgetch(WINDOW *win)
break;
}
} else {
if (curscr->flags & __KEYPAD) {
tputs(KE, 0, __cputchar);
curscr->flags &= ~__KEYPAD;
}
switch (win->delay)
{
case -1:

View File

@ -1,4 +1,4 @@
/* $NetBSD: keypad.c,v 1.5 2000/05/17 16:23:49 jdc Exp $ */
/* $NetBSD: keypad.c,v 1.6 2000/05/25 06:46:26 jdc Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: keypad.c,v 1.5 2000/05/17 16:23:49 jdc Exp $");
__RCSID("$NetBSD: keypad.c,v 1.6 2000/05/25 06:46:26 jdc Exp $");
#endif /* not lint */
#include "curses.h"
@ -47,17 +47,10 @@ keypad(WINDOW *win, bool bf)
#endif
if (bf) {
win->flags |= __KEYPAD;
/* Be compatible with SysV curses. */
if (!(curscr->flags & __KEYPAD)) {
tputs (KS, 0, __cputchar);
curscr->flags |= __KEYPAD;
}
} else {
} else
win->flags &= ~__KEYPAD;
/* Be compatible with SysV curses. */
if (curscr->flags & __KEYPAD) {
tputs (KE, 0, __cputchar);
curscr->flags &= ~__KEYPAD;
}
}
}