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/17/2000 16:04:41
> Fix on its way (just need to do a few more tests) ...
Can you try the following patches?
J
PS. What's wrong with the h, j, k and l keys anyway? ;-)
--
My other computer also runs NetBSD
http://www.netbsd.org/
---8<---------------------------- Cut here ---------------------------->8---
--- ../cvs/basesrc/lib/libcurses/tty.c Wed May 3 09:37:09 2000
+++ tty.c Wed May 17 15:40:31 2000
@@ -425,7 +425,8 @@
tputs(TI, 0, __cputchar);
tputs(VS, 0, __cputchar);
- tputs(KS, 0, __cputchar);
+ if (curscr->flags & __KEYPAD)
+ tputs(KS, 0, __cputchar);
}
int
--- ../cvs/basesrc/lib/libcurses/getch.c Wed May 3 09:37:08 2000
+++ getch.c Wed May 17 12:41:54 2000
@@ -696,6 +696,10 @@
__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 @@
break;
}
} else {
+ if (curscr->flags & __KEYPAD) {
+ tputs(KE, 0, __cputchar);
+ curscr->flags &= ~__KEYPAD;
+ }
switch (win->delay)
{
case -1:
--- ../cvs/basesrc/lib/libcurses/tstp.c Thu Apr 27 01:39:24 2000
+++ tstp.c Wed May 17 15:40:43 2000
@@ -134,7 +134,8 @@
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);
--- ../cvs/basesrc/lib/libcurses/keypad.c Wed Apr 26 14:30:54 2000
+++ keypad.c Wed May 17 15:27:58 2000
@@ -1,4 +1,4 @@
-/* $NetBSD: keypad.c,v 1.4 2000/04/24 14:09:43 blymn Exp $ */
+/* $NetBSD: keypad.c,v 1.4 2000/04/24 14:09:43 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
@@ -42,8 +42,22 @@
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;
+ }
+ }
}