Using php ncurses, I'm curious to understand exactly what ncurses_def_shell_mode()
and ncurses_def_prog_mode()
functions do specifically. They're not documented in the PHP manual and what little I did stumble upon in man ncurses
didn't help.
If I call ncurses_def_shell_mode()
and then reset with ncurses_reset_shell_mode()
before calling ncurses_end()
, which according to the extension's source should call endwin
in ncurses, the terminal cursor is still somehow lost.
<?php
ncurses_init(); // start ncurses window
ncurses_def_shell_mode();
sleep(2); // print some stuff here
ncurses_reset_shell_mode();
ncurses_end(); // clean up and get out
exit;
?>
I tried with and without, ncurses_def_shell_mode()
and ncurses_def_prog_mode()
, but somehow the window is not reset properly on exit despite properly calling reset. Am I misunderstanding how these functions are supposed to work? I was able to dig up very little information to glean more insight into their proper usage.
I know that ncurses may be archaic, but that just makes it that much more difficult to know how to use it properly.
Expected behavior here is that after calling ncurses_reset_shell_mode()
or ncurses_reset_prog_mode()
the shell or prog window should go back to its previously saved state as it was before.
The actual behavior seems to be that the shell is an a broken state upon exiting. The cursor doesn't blink, typing does not reveal anything in the terminal. However, the terminal is receiving input properly, because typing in commands and hitting enter still works.