NetBSD Problem Report #10116
Received: (qmail 6347 invoked from network); 14 May 2000 05:03:49 -0000
Message-Id: <200005140503.e4E53JK00403@ebola.usanetworks.com>
Date: Sun, 14 May 2000 01:03:19 -0400 (EDT)
From: Andrew Brown <atatat@atatdot.net>
Reply-To: Andrew Brown <atatat@atatdot.net>
To: gnats-bugs@gnats.netbsd.org
Subject: vi somewhat easily confused by suspension
X-Send-Pr-Version: 3.95
>Number: 10116
>Category: bin
>Synopsis: vi somewhat easily confused by suspension
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: jdc
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 14 05:04:00 +0000 2000
>Closed-Date: Wed May 17 16:25:21 +0000 2000
>Last-Modified: Wed May 31 14:18:01 +0000 2000
>Originator: TheMan
>Release: 1.4Y as of yesterday or the day before
>Organization:
none
>Environment:
System: NetBSD ebola 1.4Y NetBSD 1.4Y (RESTON) #15: Sat May 13 22:14:42 EDT 2000 andrew@ebola:/usr/src/sys/arch/i386/compile/RESTON i386
>Description:
the arrow keys stop working in vi if i suspend it, run another
program (eg, vi or man, probably others), and then resume.
>How-To-Repeat:
% vi /tmp/foo
(hit ^z)
% man vi (or vi /tmp/bar)
(finish whichever one you picked)
% fg
(hit arrow keys and notice that it no longer works)
>Fix:
no idea. sorry. i guess i'm better with network stacks. :)
>Release-Note:
>Audit-Trail:
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
To: Andrew Brown <atatat@atatdot.net>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Sun, 14 May 2000 18:24:31 +0200 (MET DST)
On Sun, 14 May 2000, Andrew Brown wrote:
> % vi /tmp/foo
> (hit ^z)
> % man vi (or vi /tmp/bar)
> (finish whichever one you picked)
> % fg
> (hit arrow keys and notice that it no longer works)
Works for me in 1.4/i386. Seems to be a current problem (where I can
reproduce this).
Just some data points...
- Hubert
--
NetBSD - because Unix isn't just #include <linux.h>, i386, ELF, ...!
From: Andrew Brown <atatat@atatdot.net>
To: hubert.feyrer@informatik.fh-regensburg.de
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Sun, 14 May 2000 12:26:06 -0400
>> % vi /tmp/foo
>> (hit ^z)
>> % man vi (or vi /tmp/bar)
>> (finish whichever one you picked)
>> % fg
>> (hit arrow keys and notice that it no longer works)
>
>Works for me in 1.4/i386. Seems to be a current problem (where I can
>reproduce this).
also fine for me in 1.3.3 (and freebsd and solaris and linux).
>Just some data points...
of course. :)
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
andrew@crossbar.com * "information is power -- share the wealth."
From: itohy@netbsd.org (ITOH Yasufumi)
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc: atatat@atatdot.net, feyrer@rfhs8012.fh-regensburg.de
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 17 May 2000 14:38:13 +0900 (JST)
moving to tech-userlevel,
atatat@atatdot.net writes:
> the arrow keys stop working in vi if i suspend it, run another
> program (eg, vi or man, probably others), and then resume.
I think the immediate workaround is not to use curses keypad() function
(undef HAVE_CURSES_KEYPAD). Nvi version of the function is different
from that of curses.
But, hmm...,
I think the traditional curses had an exported function "tstp()",
which does suspend and all the troublesome things about it
in place of the userland programmer.
What is the correct way to suspend a process with modern curses?
__stop_signal_handler() does it, but it doesn't seem exported....
--
ITOH, Yasufumi
From: Andrew Brown <atatat@atatdot.net>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org,
feyrer@rfhs8012.fh-regensburg.de
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 17 May 2000 09:16:21 -0400
>> the arrow keys stop working in vi if i suspend it, run another
>> program (eg, vi or man, probably others), and then resume.
>
>I think the immediate workaround is not to use curses keypad() function
>(undef HAVE_CURSES_KEYPAD). Nvi version of the function is different
>from that of curses.
>
>But, hmm...,
>I think the traditional curses had an exported function "tstp()",
>which does suspend and all the troublesome things about it
>in place of the userland programmer.
>
>What is the correct way to suspend a process with modern curses?
>__stop_signal_handler() does it, but it doesn't seem exported....
please note that it's not *just* being suspended that messes up vi.
if i suspend it and then resume, i'm fine. it's only if the other
thing that i do in between also involves the "alternate" screen, which
for me is the difference between 'printf "\e[?47h"' and 'printf
"\e[?47l"' (in an xterm). i dunno what that's really called. maybe
it's actually a bug in curses...
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
andrew@crossbar.com * "information is power -- share the wealth."
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 17 May 2000 14:52:51 +0100
> >I think the immediate workaround is not to use curses keypad() function
> >(undef HAVE_CURSES_KEYPAD). Nvi version of the function is different
> >from that of curses.
> >
> >But, hmm...,
> >I think the traditional curses had an exported function "tstp()",
> >which does suspend and all the troublesome things about it
> >in place of the userland programmer.
> >
> >What is the correct way to suspend a process with modern curses?
> >__stop_signal_handler() does it, but it doesn't seem exported....
>
> please note that it's not *just* being suspended that messes up vi.
> if i suspend it and then resume, i'm fine. it's only if the other
> thing that i do in between also involves the "alternate" screen, which
> for me is the difference between 'printf "\e[?47h"' and 'printf
> "\e[?47l"' (in an xterm). i dunno what that's really called. maybe
> it's actually a bug in curses...
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
suboptimal in some cases, but in order to be compatible, I will change our
curses to do this.
The problem occurs because vi installs its own signal handler which bypasses
our curses' handler (which would send the correct escape sequences). Thus,
keypad mode is left set when vi suspends and is then unset when a curses or
termcap using program is run (e.g. vi or man). When you resume vi, the
keypad is now unset.
Fix on its way (just need to do a few more tests) ...
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 17 May 2000 16:04:41 +0100
> 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;
+ }
+ }
}
From: Andrew Brown <atatat@atatdot.net>
To: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
Cc: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 17 May 2000 12:00:19 -0400
>> Fix on its way (just need to do a few more tests) ...
>
>Can you try the following patches?
that fixes it for me. you da man! :)
>PS. What's wrong with the h, j, k and l keys anyway? ;-)
i was using those almost immediately after hitting the up arrow yields
a beep and two errors. as for general use, i just never *really* got
into a habit of using them for navigation, since everything else i use
does (or was doing) the right thing with the arrow keys. guess i'm
just not so hard core, eh?
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
andrew@crossbar.com * "information is power -- share the wealth."
State-Changed-From-To: open->closed
State-Changed-By: jdc
State-Changed-When: Wed May 17 09:23:55 PDT 2000
State-Changed-Why:
Fixed.
Responsible-Changed-From-To: bin-bug-people->jdc
Responsible-Changed-By: jdc
Responsible-Changed-When: Wed May 17 09:23:55 PDT 2000
Responsible-Changed-Why:
Fixed by jdc (agreed by Andrew Brown).
From: David Brownlee <abs@netbsd.org>
To: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
Cc: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 17 May 2000 18:17:17 +0100 (BST)
On Wed, 17 May 2000, Julian Coleman wrote:
> 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
> suboptimal in some cases, but in order to be compatible, I will change our
> curses to do this.
>
> The problem occurs because vi installs its own signal handler which bypasses
> our curses' handler (which would send the correct escape sequences). Thus,
> keypad mode is left set when vi suspends and is then unset when a curses or
> termcap using program is run (e.g. vi or man). When you resume vi, the
> keypad is now unset.
>
Doesn't vi call some kind of 'curses re-enable' function when it
resumes. If so, presumably it would be possible to detect in that
if keypad mode was supposed to be active and explicitly reinit
it. (Apologies if I'm wandering off nowhere here :)
David/absolute
-- www.netbsd.org: No hype required --
From: itohy@netbsd.org (ITOH Yasufumi)
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Thu, 18 May 2000 09:38:09 +0900 (JST)
J.D.Coleman@newcastle.ac.uk 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>
main()
{
initscr()
refresh();
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).
Thoughts?
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
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Thu, 18 May 2000 14:56:35 +0100
> Doesn't vi call some kind of 'curses re-enable' function when it
> resumes. If so, presumably it would be possible to detect in that
> if keypad mode was supposed to be active and explicitly reinit
> it. (Apologies if I'm wandering off nowhere here :)
No. Because vi installs its own tstp signal handler, it instead emulates
what libcurses would do. The problem is that we can change our keypad active
flag or send the relevant sequences in our handler, but if some program sends
those sequences itself, our view of the world is wrong. Or, if the program
with its own handler is suspended and something else sends the sequences
(i.e. another program using curses), we also lose.
vi expects the keypad() function to send the keypad enable/disable sequences
(when it calls keypad() with TRUE/FALSE respectively). I added the code to
do this yesterday. Also, I noticed that we didn't properly handle the case
where keypad(win, FALSE) is called during the program, so I added that too.
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Thu, 18 May 2000 15:50:38 +0100
> I tested on Solaris 5.5.1 and see tty keypad will never be disabled
> during a curses session.
Apologies. I should have noted this. It does, however, not send the sequence
until keypad() is called.
> 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).
>
> Thoughts?
>
> 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.
Yes, Solaris' handling of keypad() is broken. The code I added yesterday only
sends the sequence if it thinks it is necessary. For example, if you call
keypad() with TRUE or FALSE multiple times, you will only see one instance of
the escape sequence being sent [#1]. Also, the relevant sequence is sent if
you call wgetch() in a window where the keypad state differs from the previous
time you called wgetch() [#2].
We previously always sent the enable sequences when the program started - in
__startwin(), but the documentation states that the initial state is FALSE -
http://www.opengroup.org/onlinepubs/007908799/xcurses/keypad.html
- so I also changed that. Agreed, this means that a program may get an
unknown key if it calls wgetch() before it calls keypad().
I'm also not sure that the sequence should be sent when keypad() is called.
[#2] demonstrates an undesirable feature that three sequences will be sent -
on/off/on. Solutions to that are not to send the sequences from keypad(), or
to only send them when (win == stdscr). In either case, we're not compatible,
but meet the specification; in the latter we don't need to patch nvi. Of
course, if you don't bother with the
keypad(win, FALSE);
line (which is unnecessary), everything is OK. Not sure if we should worry
about this or not. My inclination was not. There are a few corner cases
where it is possible to cause curses to send unnecessary (but not harmful)
sequences. However, adding code to avoid sending the unnecessary sequences
in these instances may also prevent the correct thing happening at other
times.
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
---8<---------------------------- Cut here ---------------------------->8---
[#1]
#include <curses.h>
main()
{
initscr();
refresh();
keypad(stdscr, TRUE);
keypad(stdscr, TRUE);
printw(" %d", getch());
refresh();
keypad(stdscr, FALSE);
keypad(stdscr, FALSE);
printw(" %d", getch());
refresh();
endwin();
return 0;
}
---8<---------------------------- Cut here ---------------------------->8---
[#2]
#include <curses.h>
main()
{
WINDOW *win;
initscr();
refresh();
win = newwin (1, 2, 3, 4);
keypad(stdscr, TRUE);
keypad(win, FALSE);
printw(" %d", getch());
refresh();
printw(" %d", wgetch(win));
refresh();
endwin();
return 0;
}
From: itohy@netbsd.org (ITOH Yasufumi)
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Fri, 19 May 2000 12:45:37 +0900 (JST)
J.D.Coleman@newcastle.ac.uk writes:
> We previously always sent the enable sequences when the program started - in
> __startwin(), but the documentation states that the initial state is FALSE -
>
> http://www.opengroup.org/onlinepubs/007908799/xcurses/keypad.html
>
> - so I also changed that. Agreed, this means that a program may get an
> unknown key if it calls wgetch() before it calls keypad().
Okay, conforming the standard is more important than small local reform.
Programs can still interpret the key sequence by their own in Solaris
implementation using keypad(stdscr, TRUE); keypad(win, FALSE); pair.
> Not sure if we should worry
> about this or not. My inclination was not. There are a few corner cases
> where it is possible to cause curses to send unnecessary (but not harmful)
> sequences.
I agree they are corner cases, but
I can't conclude that no program interprets keypad char by its own.
If the "disable keypad" sequence is sent by keypad(win, FALSE),
such a program can't know the sequence sent by a keypad key.
> However, adding code to avoid sending the unnecessary sequences
> in these instances may also prevent the correct thing happening at other
> times.
Nvi depends on the behavior of old and obsolete BSD curses.
Now we have new curses. Why don't we fix nvi?
How does it work if just undef HAVE_BSD_CURSES?
(I havn't tried it, yet.)
--
ITOH, Yasufumi
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Fri, 19 May 2000 12:09:25 +0100
> I agree they are corner cases, but
> I can't conclude that no program interprets keypad char by its own.
>
> If the "disable keypad" sequence is sent by keypad(win, FALSE),
> such a program can't know the sequence sent by a keypad key.
That's true. However, that is the way the specification is written - if you
call wgetch(win) after keypad(win, FALSE), you will not get the application
keypad sequence; if you call wgetch(win) after keypad(win, TRUE), you will
get the keycode, not the sequence. I admit that this doesn't happen under
Solaris (all SysV curses?) because it doesn't comform to the specification.
However, ncurses does what our curses now does, so such a program won't work
there either.
> Nvi depends on the behavior of old and obsolete BSD curses.
> Now we have new curses. Why don't we fix nvi?
>
> How does it work if just undef HAVE_BSD_CURSES?
> (I havn't tried it, yet.)
On inspection, it calls endwin(), doesn't bother with some tcgetattr() and
tcsetattr() calls and doesn't send the ti/te sequences. We now support
restarting after endwin() and it appears to work OK without HAVE_BSD_CURSES
defined (just tried it). So, we can take out the sending of the sequences in
keypad() if we undefine HAVE_BSD_CURSES in vi. Still won't help any curses
program to interpret the keypad sequences itself but it will get rid of the
multiple sequences sent corner case. Thoughts?
I wonder if vi should use reset_shell_mode() and reset_prog_mode() instead ...
hmm, we should probably send the relevant sequences here too (Solaris curses
doesn't but ncurses does) - I'll fix that.
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
From: itohy@netbsd.org (ITOH Yasufumi)
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Mon, 22 May 2000 14:22:23 +0900 (JST)
J.D.Coleman@newcastle.ac.uk writes:
> That's true. However, that is the way the specification is written - if you
> call wgetch(win) after keypad(win, FALSE), you will not get the application
> keypad sequence; if you call wgetch(win) after keypad(win, TRUE), you will
> get the keycode, not the sequence.
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).
> I admit that this doesn't happen under
> Solaris (all SysV curses?) because it doesn't comform to the specification.
So, I don't think Solaris curses breaks the spec.
> However, ncurses does what our curses now does, so such a program won't work
> there either.
Solaris curses is the better reference implementation compared to ncurses
for SUSv2 compliant, from my experience.
One of the reasons we don't adopt ncurses is that it is buggy, isn't it? :-)
Thoughts?
For audience:)
Terminology
"keypad"
`Function (F1, F2, ...) keys' `Arrow keys' `Page Up' `Help' etc.
"enable keypad"
Some terminals need sending initialization string to enable
the "keypad" keys. If the keypad is enabled, the sequence
sent by a keypad key can be known by an application program
from termcap.
"disable keypad"
Sending a string to a terminal which cancels "enable keypad".
The sequence sent by a keypad key becomes unknown (but may be
useful for programs which doesn't recognize keypad keys).
"translation"
Conversion of the sequence of the "keypad" keys to unique
integer (keycode).
"enable translation"
Set a flag in curses to enable "translation".
The application receives a keycode for a keypad key.
"disable translation"
Clear a flag in curses to disable "translation".
The sequence of a keypad key is sent directly to the application.
Summary
sample code:
initscr();
/* (1) */
keypad(win, TRUE); refresh();
/* (2) */
keypad(win, FALSE); refresh();
/* (3) */
keypad(win, TRUE); refresh();
/* (4) */
endwin();
/* (5) */
A. ncurses and current our curses
keypad translation
(1) disabled disabled
(2) enabled enabled
(3) disabled disabled
(4) enabled enabled
(5) disabled ?
B. Solaris
keypad translation
(1) disabled disabled
(2) enabled enabled
(3) enabled disabled
(4) enabled enabled
(5) disabled ?
Julian supports A; I support B.
--
ITOH, Yasufumi
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Mon, 22 May 2000 09:52:50 +0100
> 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/
From: itohy@netbsd.org (ITOH Yasufumi)
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Tue, 23 May 2000 09:28:21 +0900 (JST)
In article <20000522095250.A20428@aire.ncl.ac.uk>
J.D.Coleman@newcastle.ac.uk writes:
> I took this to mean that the code should enable /and/ disable the keypad.
It might be possible, but the other possibility is a little more natural
with the description.
> 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 feel SUSv2 is written carefully to describe Solaris. :-)
> I think
> we should still send the disable sequence on sigtstp though (and the enable
> sequence if necessary on restart).
Yes.
endwin() should do all the clean-up works for what curses did about
the terminal and the terminal driver, including keypad state and termios(4).
Then, initscr() after endwin() restores the previous state.
endwin(); /* cleanup */
/* suspend the job or spawn sub shell */
initscr(); /* restart (with new screen size) */
However, vi requires more capability than what curses has, and some
extra work may be needed. For example, here a vi (ex) command is executed.
:!ls
CVS dist gnu local sys
Makefile distrib include regress usr.bin
Makefile.inc etc lib sbin usr.sbin
bin games libexec share
Press any key to continue [: to enter more ex commands]:
The screen should not cleared to leave the result of ls visible (initscr()
can't be called at this point) but the terminal driver should be in
raw (or cbreak) mode.
So we can't remove all the termios stuff.
> Assuming we do the above, shall I just comment the code in vi/build/config.h :
I think so.
--
ITOH, Yasufumi
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 24 May 2000 16:39:57 +0100
> However, vi requires more capability than what curses has, and some
> extra work may be needed. For example, here a vi (ex) command is executed.
>
> :!ls
> CVS dist gnu local sys
> Makefile distrib include regress usr.bin
> Makefile.inc etc lib sbin usr.sbin
> bin games libexec share
> Press any key to continue [: to enter more ex commands]:
>
> The screen should not cleared to leave the result of ls visible (initscr()
> can't be called at this point) but the terminal driver should be in
> raw (or cbreak) mode.
> So we can't remove all the termios stuff.
Looked at this. Not sure of the best solution. From vi/vs_msg.c:576, we
eventually call cl_ex_init(), which does a tcsetattr() and then sends the
'ti' sequence. To make the screen display more useful, you can do :
--- /usr/src/usr.bin/vi/vi/vs_msg.c Tue Jan 13 15:03:38 1998
+++ vi/vs_msg.c Wed May 24 16:22:59 2000
@@ -572,10 +572,7 @@
* commands will have cumulative line modification reports. That seems
* right (well, at least not wrong) to me.
*/
- if (F_ISSET(sp, SC_SCR_EXWROTE)) {
- if (sp->gp->scr_screen(sp, SC_VI))
- return (1);
- } else {
+ if (!F_ISSET(sp, SC_SCR_EXWROTE)) {
if (vip->totalcount < 2) {
if (vip->totalcount == 0) {
F_CLR(sp, SC_EX_DONTWAIT);
@@ -597,9 +594,11 @@
if (!F_ISSET(sp, SC_EX_DONTWAIT) && !INTERRUPTED(sp)) {
wtype = F_ISSET(sp, SC_EXIT | SC_EXIT_FORCE |
SC_FSWITCH | SC_SSWITCH) ? SCROLL_W : SCROLL_W_EX;
- if (F_ISSET(sp, SC_SCR_EXWROTE))
+ if (F_ISSET(sp, SC_SCR_EXWROTE)) {
vs_wait(sp, continuep, wtype);
- else
+ if (sp->gp->scr_screen(sp, SC_VI))
+ return (1);
+ } else
vs_scroll(sp, continuep, wtype);
if (*continuep)
return (0);
but we've also moved the tcsetattr(), so the terminal isn't in raw mode.
Looking at the nv-1.79 source, sending 'ti' and 'te' is not done directly
in cl_ex_init() but in cl_attr(), so the problem goes away. Is it worth
importing nvi-1.79 (wasn't there mention of this a while back?)? If not,
the bits dealing with SA_ALTERNATE need to be back-ported in order to fix
this (see also the comment in cl_attr() (cl/cl_funcs.c:91) in 1.79.
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Fri, 26 May 2000 14:47:33 +0100
> Is it worth
> importing nvi-1.79 (wasn't there mention of this a while back?)? If not,
> the bits dealing with SA_ALTERNATE need to be back-ported in order to fix
> this (see also the comment in cl_attr() (cl/cl_funcs.c:91) in 1.79.
Hmm, no comments. I've added the alternate screen handling from 1.79 to our
vi. Patches appended. One thing that I noticed is that running a command
from vi does not switch out of "keypad enable" mode. For example, type :
:!cat
and watch what the cursor keys generate. Does this matter? Also, perhaps it
would be nice to get the shell prompt back on a new line instead of :
Press any key to continue [: to enter more ex commands]: aire:njdc bash$
when vi exits and I didn't press <return> at the prompt.
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
---8<---------------------------- Cut here ---------------------------->8---
diff -ru /usr/src/usr.bin/vi/cl/cl_funcs.c ./cl/cl_funcs.c
--- /usr/src/usr.bin/vi/cl/cl_funcs.c Tue Jan 13 14:54:43 1998
+++ ./cl/cl_funcs.c Fri May 26 12:14:11 2000
@@ -85,10 +85,60 @@
{
CL_PRIVATE *clp;
+ clp = CLP(sp);
+
switch (attribute) {
+ case SA_ALTERNATE:
+ /*
+ * !!!
+ * There's a major layering violation here. The problem is that the
+ * X11 xterm screen has what's known as an "alternate" screen. Some
+ * xterm termcap/terminfo entries include sequences to switch to/from
+ * that alternate screen as part of the ti/te (smcup/rmcup) strings.
+ * Vi runs in the alternate screen, so that you are returned to the
+ * same screen contents on exit from vi that you had when you entered
+ * vi. Further, when you run :shell, or :!date or similar ex commands,
+ * you also see the original screen contents. This wasn't deliberate
+ * on vi's part, it's just that it historically sent terminal init/end
+ * sequences at those times, and the addition of the alternate screen
+ * sequences to the strings changed the behavior of vi. The problem
+ * caused by this is that we don't want to switch back to the alternate
+ * screen while getting a new command from the user, when the user is
+ * continuing to enter ex commands, e.g.:
+ *
+ * :!date <<< switch to original screen
+ * [Hit return to continue] <<< prompt user to continue
+ * :command <<< get command from user
+ *
+ * Note that the :command input is a true vi input mode, e.g., input
+ * maps and abbreviations are being done. So, we need to be able to
+ * switch back into the vi screen mode, without flashing the screen.
+ *
+ * To make matters worse, the curses initscr() and endwin() calls will
+ * do this automatically -- so, this attribute isn't as controlled by
+ * the higher level screen as closely as one might like.
+ */
+ if (on) {
+ if (clp->ti_te != TI_SENT) {
+ clp->ti_te = TI_SENT;
+ if (clp->smcup == NULL)
+ (void)cl_getcap(sp, "smcup", &clp->smcup);
+ if (clp->smcup != NULL)
+ (void)tputs(clp->smcup, 1, cl_putchar);
+ }
+ } else
+ if (clp->ti_te != TE_SENT) {
+ clp->ti_te = TE_SENT;
+ if (clp->rmcup == NULL)
+ (void)cl_getcap(sp, "rmcup", &clp->rmcup);
+ if (clp->rmcup != NULL)
+ (void)tputs(clp->rmcup, 1, cl_putchar);
+ (void)fflush(stdout);
+ }
+ (void)fflush(stdout);
+ break;
case SA_INVERSE:
if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)) {
- clp = CLP(sp);
if (clp->smso == NULL)
return (1);
if (on)
@@ -529,12 +579,7 @@
(void)keypad(stdscr, FALSE);
#ifdef HAVE_BSD_CURSES
- /* Send the terminal end sequence. */
- if (clp->rmcup == NULL)
- (void)cl_getcap(sp, "rmcup", &clp->rmcup);
- if (clp->rmcup != NULL)
- (void)tputs(clp->rmcup, 1, cl_putchar);
- (void)fflush(stdout);
+ (void)cl_attr(sp, SA_ALTERNATE, 0);
#else
(void)endwin();
#endif
@@ -557,12 +602,7 @@
if (F_ISSET(gp, G_STDIN_TTY))
(void)tcsetattr(STDIN_FILENO, TCSASOFT | TCSADRAIN, &t);
- /* Send the terminal initialization sequence. */
- if (clp->smcup == NULL)
- (void)cl_getcap(sp, "smcup", &clp->smcup);
- if (clp->smcup != NULL)
- (void)tputs(clp->smcup, 1, cl_putchar);
- (void)fflush(stdout);
+ (void)cl_attr(sp, SA_ALTERNATE, 1);
#endif
/* Put the cursor keys into application mode. */
(void)keypad(stdscr, TRUE);
diff -ru /usr/src/usr.bin/vi/cl/cl_screen.c ./cl/cl_screen.c
--- /usr/src/usr.bin/vi/cl/cl_screen.c Tue Jan 13 14:54:57 1998
+++ ./cl/cl_screen.c Fri May 26 11:44:16 2000
@@ -374,16 +374,6 @@
err: (void)cl_vi_end(sp->gp);
return (1);
}
-
- /* If not already done, send the terminal initialization sequence. */
- if (clp->ti_te == TE_SENT) {
- clp->ti_te = TI_SENT;
- if (clp->smcup == NULL)
- (void)cl_getcap(sp, "smcup", &clp->smcup);
- if (clp->smcup != NULL)
- (void)tputs(clp->smcup, 1, cl_putchar);
- (void)fflush(stdout);
- }
return (0);
}
@@ -498,15 +488,6 @@
return (1);
}
- /* If not already done, send the terminal end sequence. */
- if (clp->ti_te == TI_SENT) {
- clp->ti_te = TE_SENT;
- if (clp->rmcup == NULL)
- (void)cl_getcap(sp, "rmcup", &clp->rmcup);
- if (clp->rmcup != NULL)
- (void)tputs(clp->rmcup, 1, cl_putchar);
- (void)fflush(stdout);
- }
return (0);
}
diff -ru /usr/src/usr.bin/vi/common/gs.h ./common/gs.h
--- /usr/src/usr.bin/vi/common/gs.h Tue Jan 13 14:55:41 1998
+++ ./common/gs.h Fri May 26 11:46:15 2000
@@ -44,7 +44,7 @@
typedef enum { EX_TERM_CE, EX_TERM_SCROLL } exadj_t;
/* Screen attribute argument to scr_attr(). */
-typedef enum { SA_INVERSE } scr_attr_t;
+typedef enum { SA_ALTERNATE, SA_INVERSE } scr_attr_t;
/* Key type argument to scr_keyval(). */
typedef enum { KEY_VEOF, KEY_VERASE, KEY_VKILL, KEY_VWERASE } scr_keyval_t;
diff -ru /usr/src/usr.bin/vi/ex/ex_read.c ./ex/ex_read.c
--- /usr/src/usr.bin/vi/ex/ex_read.c Tue Jan 13 15:01:11 1998
+++ ./ex/ex_read.c Fri May 26 11:47:40 2000
@@ -162,6 +162,12 @@
ex_emsg(sp, cmdp->cmd->name, EXM_NOCANON_F);
return (1);
}
+ /*
+ * !!!
+ * Historically, the read command doesn't switch to
+ * the alternate X11 xterm screen, if doing a filter
+ * read -- don't set SA_ALTERNATE.
+ */
F_SET(sp, SC_SCR_EX | SC_SCR_EXWROTE);
}
diff -ru /usr/src/usr.bin/vi/ex/ex_shell.c ./ex/ex_shell.c
--- /usr/src/usr.bin/vi/ex/ex_shell.c Tue Jan 13 15:01:26 1998
+++ ./ex/ex_shell.c Fri May 26 12:07:19 2000
@@ -84,9 +84,12 @@
const char *msg;
int need_newline;
{
+ GS *gp;
const char *name;
pid_t pid;
+ gp = sp->gp;
+
/* We'll need a shell. */
if (opts_empty(sp, O_SHELL, 0))
return (1);
@@ -97,6 +100,7 @@
ex_emsg(sp, cmdp->cmd->name, EXM_NOCANON);
return (1);
}
+ (void)gp->scr_attr(sp, SA_ALTERNATE, 0);
F_SET(sp, SC_SCR_EX | SC_SCR_EXWROTE);
}
diff -ru /usr/src/usr.bin/vi/ex/ex_util.c ./ex/ex_util.c
--- /usr/src/usr.bin/vi/ex/ex_util.c Tue Jan 13 15:01:42 1998
+++ ./ex/ex_util.c Fri May 26 11:58:18 2000
@@ -154,8 +154,13 @@
ex_init(sp)
SCR *sp;
{
- if (sp->gp->scr_screen(sp, SC_EX))
+ GS *gp;
+
+ gp = sp->gp;
+
+ if (gp->scr_screen(sp, SC_EX))
return (1);
+ (void)gp->scr_attr(sp, SA_ALTERNATE, 0);
sp->rows = O_VAL(sp, O_LINES);
sp->cols = O_VAL(sp, O_COLUMNS);
diff -ru /usr/src/usr.bin/vi/vi/v_ex.c ./vi/v_ex.c
--- /usr/src/usr.bin/vi/vi/v_ex.c Fri Jan 8 12:14:26 1999
+++ ./vi/v_ex.c Fri May 26 12:01:05 2000
@@ -66,12 +66,17 @@
SCR *sp;
VICMD *vp;
{
+ GS *gp;
+
+ gp = sp->gp;
+
/* Try and switch screens -- the screen may not permit it. */
if (sp->gp->scr_screen(sp, SC_EX)) {
msgq(sp, M_ERR,
"207|The Q command requires the ex terminal interface");
return (1);
}
+ (void)gp->scr_attr(sp, SA_ALTERNATE, 0);
/* Save the current cursor position. */
sp->frp->lno = sp->lno;
diff -ru /usr/src/usr.bin/vi/vi/vi.c ./vi/vi.c
--- /usr/src/usr.bin/vi/vi/vi.c Tue Jan 13 15:03:17 1998
+++ ./vi/vi.c Fri May 26 11:51:27 2000
@@ -89,6 +89,7 @@
/* Initialize the vi screen. */
if (v_init(sp))
return (1);
+ (void)gp->scr_attr(sp, SA_ALTERNATE, 1);
for (vip = VIP(sp), rval = 0;;) {
/* Resolve messages. */
diff -ru /usr/src/usr.bin/vi/vi/vs_msg.c ./vi/vs_msg.c
--- /usr/src/usr.bin/vi/vi/vs_msg.c Tue Jan 13 15:03:38 1998
+++ ./vi/vs_msg.c Fri May 26 11:51:48 2000
@@ -620,6 +620,9 @@
if (F_ISSET(vip, VIP_N_EX_REDRAW))
F_SET(sp, SC_SCR_REFORMAT);
+ /* Ex may have switched out of the alternate screen, return. */
+ (void)gp->scr_attr(sp, SA_ALTERNATE, 1);
+
/*
* Whew. We're finally back home, after what feels like years.
* Kiss the ground.
From: itohy@netbsd.org (ITOH Yasufumi)
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Mon, 29 May 2000 15:17:32 +0900 (JST)
J.D.Coleman@newcastle.ac.uk writes:
> > Is it worth
> > importing nvi-1.79 (wasn't there mention of this a while back?)? If not,
doc/3RDPARTY says "Bostic says not to update from 1.66."
I don't know why.
> > the bits dealing with SA_ALTERNATE need to be back-ported in order to fix
> > this (see also the comment in cl_attr() (cl/cl_funcs.c:91) in 1.79.
>
> Hmm, no comments. I've added the alternate screen handling from 1.79 to our
> vi. Patches appended.
Seems OK....
(Sorry, I haven't tested it yet.)
> One thing that I noticed is that running a command
> from vi does not switch out of "keypad enable" mode. For example, type :
>
> :!cat
>
> and watch what the cursor keys generate. Does this matter?
I don't think it so matters, but keypad is automatically disabled
by endwin(), isn't it?
Anyway, we should re-enable the keypad on entering visual mode.
If the child process wants to use keypad keys, it takes care by itself,
and probably it will leave the terminal in "keypad disabled" state.
:!vi
> Also, perhaps it
> would be nice to get the shell prompt back on a new line instead of :
>
> Press any key to continue [: to enter more ex commands]: aire:njdc bash$
>
> when vi exits and I didn't press <return> at the prompt.
Yeah. :-)
--
ITOH, Yasufumi
From: Giles Lean <giles@nemeton.com.au>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Mon, 29 May 2000 17:45:13 +1000
On Mon, 29 May 2000 15:17:32 +0900 (JST) ITOH Yasufumi wrote:
> doc/3RDPARTY says "Bostic says not to update from 1.66."
> I don't know why.
Last time this came up on the list someone reported that Bostic
said he couldn't remember why either. (Talk about hearsay evidence!)
Anyone using 1.79? If we don't know of a problem with it, why not
update in -current? It can always be backed out and a better message
put in about why we're not updating if in fact there are problems!
Regards,
Giles
From: Simon Burge <simonb@NetBSD.ORG>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@NetBSD.ORG
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Mon, 29 May 2000 17:57:42 +1000
Giles Lean wrote:
> On Mon, 29 May 2000 15:17:32 +0900 (JST) ITOH Yasufumi wrote:
>
> > doc/3RDPARTY says "Bostic says not to update from 1.66."
> > I don't know why.
>
> Last time this came up on the list someone reported that Bostic
> said he couldn't remember why either. (Talk about hearsay evidence!)
>
> Anyone using 1.79? If we don't know of a problem with it, why not
> update in -current? It can always be backed out and a better message
> put in about why we're not updating if in fact there are problems!
I haven't been following this too closely, but perhaps put nvi 1.79 in
straight after the netbsd 1.5 is branched off. If there are problems in
nvi 1.79, at least they wont be in the release. Or does 1.79 solve a
know problem now?
Simon.
From: woods@weird.com (Greg A. Woods)
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Mon, 29 May 2000 11:28:00 -0400 (EDT)
[ On Monday, May 29, 2000 at 17:57:42 (+1000), Simon Burge wrote: ]
> Subject: Re: bin/10116: vi somewhat easily confused by suspension
>
> I haven't been following this too closely, but perhaps put nvi 1.79 in
> straight after the netbsd 1.5 is branched off. If there are problems in
> nvi 1.79, at least they wont be in the release. Or does 1.79 solve a
> know problem now?
I think waiting would be rather silly. FreeBSD has been using 1.71 for
some time now. Presumably 1.79 contains bug fixes over 1.71. Since the
licensing issues have already been adequately debated all that should
remain is for TNF to officially confirm that the 1.79 license is not a
problem and then for it to be immediately imported.
This isn't a kernel interface here -- just an application (albiet one
that's rather central to at least some folks idea of what *BSD is! ;-)
It's not even a matter of the new release introducing incompatabilities
(at least not so far as I know). NVI-1.79 should be considered to be
very stable by now -- it's been out for over a year and there have been
no subsequent releases that I know of.
I doubt most people (i.e. the ones who haven't experienced any bugs)
would even notice the difference (I've not noticed any differences on
FreeBSD with the little work I've done using their 1.71 vi). Meanwhile
those who have had issues will finally be able to know if proper
integration of the current NVI release into NetBSD will solve their
problems or not.
--
Greg A. Woods
+1 416 218-0098 VE3TCP <gwoods@acm.org> <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 31 May 2000 15:03:20 +0100
> I don't think it so matters, but keypad is automatically disabled
> by endwin(), isn't it?
Yes ... but vi doesn't use endwin() here!
> Anyway, we should re-enable the keypad on entering visual mode.
> If the child process wants to use keypad keys, it takes care by itself,
> and probably it will leave the terminal in "keypad disabled" state.
>
> :!vi
>
Agreed. As you surmise, ":!vi" leaves the original vi in "keypad disabled"
state. This also happens in 1.79. I'll look into this.
> > Also, perhaps it
> > would be nice to get the shell prompt back on a new line instead of :
> >
> > Press any key to continue [: to enter more ex commands]: aire:njdc bash$
> >
> > when vi exits and I didn't press <return> at the prompt.
>
> Yeah. :-)
I think this is simple to do, so I'll do it too.
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
To: gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org
Cc:
Subject: Re: bin/10116: vi somewhat easily confused by suspension
Date: Wed, 31 May 2000 15:17:53 +0100
> I haven't been following this too closely, but perhaps put nvi 1.79 in
> straight after the netbsd 1.5 is branched off. If there are problems in
> nvi 1.79, at least they wont be in the release. Or does 1.79 solve a
> know problem now?
The only problem that seems to be biting people is the changing the screen
before the "press any key" prompt after a shell command is executed. I have
patches for that, so I'll put those into our tree. However, the nvi
changelog shows a fair number of bug fixes, so it seems worthwhile to go to
1.79 at some point. We can merge any changes we make now into 1.79 later.
J
--
My other computer also runs NetBSD
http://www.netbsd.org/
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.