(sorry for the top post...) I am happy with either the rename of the static definition or including the state variable in _cursesi_screen which already holds the tty information anyway. Mind you, if you put the state variable into _cursesi_screen then you may get the situation that someone swtiches screens part way through a multi-character key sequence which will result in a partial escape sequence being delivered to the new screen which is unlikely but undesirable. If we stick with the static variable then the worst that happens is the assembled key code will be delivered to the new screen. To be honest, I think the screen switching scenario is so unlikely that putting the variable there would be fine. My memory is pretty creaky as to why the variable was shared between the narrow and wchar versions of inkey - I am pretty sure it was for reasons of code sharing and to allow both narrow and wide inkey functions to be called interchangably which may be a bit specious...
BTW: Congratulations on nailing this bug, it has been around for years and I did spend many hours chasing around in circles trying to work out why aspell was crashing without success. Many thanks! ----- Original Message ----- From: "Rin Okuyama" To:"Roy Marples" , "Martin Husemann" Cc:, "Ruibiao Qiu" , "NetBSD Discussion List User-Level Technical" , "Christos Zoulas" , "Valery Ushakov" Sent:Tue, 12 Mar 2019 06:55:48 +0900 Subject:Re: namespace pollution by curses On 2019/03/11 22:08, Roy Marples wrote: > On 11/03/2019 06:21, Martin Husemann wrote: >> On Mon, Mar 11, 2019 at 02:01:44PM +0900, Rin Okuyama wrote: >>> (3) Put "state" struct __window (suggested by uwe) > > Not __window .... _cursesi_screen which is __screen. Oops, yes. >> I prefer this one too. > > I prefer this also. OK, I will revise the patch soon! Thanks, rin