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:25:32 +03:00
parent de69dd750b
commit 7030b0b9fe
5 changed files with 28 additions and 0 deletions

View File

@@ -79,7 +79,9 @@ hooked_tty_getlin(
for (;;) {
(void) fflush(stdout);
Strcat(strcat(strcpy(gt.toplines, query), " "), obufp);
tty_curs_set(1);
c = pgetchar();
tty_curs_set(0);
if (c == '\033' || c == EOF) {
if (c == '\033' && obufp[0] != '\0') {
obufp[0] = '\0';