tty: hide cursor unless waiting for user input

Use vi (cursor_invisible) and ve (cursor_normal) to hide and show
cursor, if the terminal supports those.  This way on a slower
connection the cursor doesn't jump all over the place when doing
map or menu updates.
This commit is contained in:
Pasi Kallinen
2024-04-02 10:28:20 +03:00
parent de69dd750b
commit 7030b0b9fe
5 changed files with 28 additions and 0 deletions
+4
View File
@@ -542,6 +542,7 @@ tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
/* to port dependant tty setup */
tty_startup(&wid, &hgt);
setftty(); /* calls start_screen */
tty_curs_set(0);
/* set up tty descriptor */
ttyDisplay = (struct DisplayDesc *) alloc(sizeof (struct DisplayDesc));
@@ -807,6 +808,7 @@ tty_exit_nhwindows(const char *str)
{
winid i;
tty_curs_set(1);
tty_suspend_nhwindows(str);
/*
* Disable windows to avoid calls to window routines.
@@ -3985,6 +3987,7 @@ tty_nhgetch(void)
HUPSKIP_RESULT('\033');
print_vt_code1(AVTC_INLINE_SYNC);
tty_curs_set(1);
(void) fflush(stdout);
/* Note: if raw_print() and wait_synch() get called to report terminal
* initialization problems, then wins[] and ttyDisplay might not be
@@ -4018,6 +4021,7 @@ tty_nhgetch(void)
}
#endif
}
tty_curs_set(0);
if (!i)
i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */
else if (i == EOF)