Subject: Re: bin/10116: vi somewhat easily confused by suspension
To: None <gnats-bugs@gnats.netbsd.org, tech-userlevel@netbsd.org>
From: ITOH Yasufumi <itohy@netbsd.org>
List: tech-userlevel
Date: 05/23/2000 09:28:21
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