Send, if necessary, 'ks' or 'ke' sequences from keypad() and wgetch().

Fixes PR 10116.
This commit is contained in:
jdc 2000-05-17 16:23:49 +00:00
parent 817862e208
commit 985e3d49d7
4 changed files with 36 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getch.c,v 1.27 2000/05/01 12:30:30 blymn Exp $ */
/* $NetBSD: getch.c,v 1.28 2000/05/17 16:23:49 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.27 2000/05/01 12:30:30 blymn Exp $");
__RCSID("$NetBSD: getch.c,v 1.28 2000/05/17 16:23:49 jdc Exp $");
#endif
#endif /* not lint */
@ -696,6 +696,10 @@ 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:
@ -713,6 +717,10 @@ 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.4 2000/04/24 14:09:43 blymn Exp $ */
/* $NetBSD: keypad.c,v 1.5 2000/05/17 16:23:49 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.4 2000/04/24 14:09:43 blymn Exp $");
__RCSID("$NetBSD: keypad.c,v 1.5 2000/05/17 16:23:49 jdc Exp $");
#endif /* not lint */
#include "curses.h"
@ -42,8 +42,22 @@ __RCSID("$NetBSD: keypad.c,v 1.4 2000/04/24 14:09:43 blymn Exp $");
void
keypad(WINDOW *win, bool bf)
{
if (bf)
#ifdef DEBUG
__CTRACE("keypad: win %0.2o, %s\n", win, bf ? "TRUE" : "FALSE");
#endif
if (bf) {
win->flags |= __KEYPAD;
else
/* Be compatible with SysV curses. */
if (!(curscr->flags & __KEYPAD)) {
tputs (KS, 0, __cputchar);
curscr->flags |= __KEYPAD;
}
} else {
win->flags &= ~__KEYPAD;
/* Be compatible with SysV curses. */
if (curscr->flags & __KEYPAD) {
tputs (KE, 0, __cputchar);
curscr->flags &= ~__KEYPAD;
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tstp.c,v 1.18 2000/04/27 00:27:23 jdc Exp $ */
/* $NetBSD: tstp.c,v 1.19 2000/05/17 16:23:49 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tstp.c 8.3 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: tstp.c,v 1.18 2000/04/27 00:27:23 jdc Exp $");
__RCSID("$NetBSD: tstp.c,v 1.19 2000/05/17 16:23:49 jdc Exp $");
#endif
#endif /* not lint */
@ -134,7 +134,8 @@ __stopwin(void)
if (MO != NULL)
(void) tputs(MO, 0, __cputchar);
(void) tputs(KE, 0, __cputchar);
if (curscr->flags & __KEYPAD)
(void) tputs(KE, 0, __cputchar);
(void) tputs(VE, 0, __cputchar);
(void) tputs(TE, 0, __cputchar);
(void) fflush(stdout);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.19 2000/05/01 12:30:30 blymn Exp $ */
/* $NetBSD: tty.c,v 1.20 2000/05/17 16:23:49 jdc Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.6 (Berkeley) 1/10/95";
#else
__RCSID("$NetBSD: tty.c,v 1.19 2000/05/01 12:30:30 blymn Exp $");
__RCSID("$NetBSD: tty.c,v 1.20 2000/05/17 16:23:49 jdc Exp $");
#endif
#endif /* not lint */
@ -425,7 +425,8 @@ __startwin(void)
tputs(TI, 0, __cputchar);
tputs(VS, 0, __cputchar);
tputs(KS, 0, __cputchar);
if (curscr->flags & __KEYPAD)
tputs(KS, 0, __cputchar);
}
int