On 2019/03/09 1:12, Ruibiao Qiu wrote:
On Fri, Mar 8, 2019 at 7:36 AM Rin Okuyama <[email protected] <mailto:[email protected]>> wrote:On 2019/03/08 22:53, Martin Husemann wrote: > On Fri, Mar 08, 2019 at 10:41:51PM +0900, Rin Okuyama wrote: > >> I've found that this is because curses uses a global variable "state": >> https://nxr.netbsd.org/xref/src/lib/libcurses/getch.c#50 >> https://nxr.netbsd.org/xref/src/lib/libcurses/get_wch.c#52 > > Can both variants of inkey() co-exist? > I would just make both decalarations static. Hmm, I could not find a description in SUSv4 on what happens if both single- and wide-character interfaces are used in the same terminal. I suppose that it is not a best practice, but the question is whether there are applications depending on the current behavior. "state" was turned into global when wide curses was merged: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libcurses/getch.c#rev1.48 Brett, Ruibiao, do you remember why? Thanks, rin I can't remember if we had discussed the situation in which we have both single- and wide-characters in the same terminal. If we are certain that it won't happen, I agree that we can go ahead with removing the references of "state" in the wide-character code, and making it static in getch.c
Thank you everyone for your comment, and sorry for the late reply. I would like to wait for a while responses from Brett and Roy: (1) Change "state" into "_cursesi_state" (appy the patch as is) or (2) Make "state" static (suggested by Martin) or (3) Put "state" struct __window (suggested by uwe) or (4) Something else Thanks, rin
