From c4d4bafb44fdb6adcc0fdb0b637aa4f8e252010c Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 2 Apr 2024 14:30:16 +0300 Subject: [PATCH] Fix NO_TERMS compile, rename func ... to match others, from tty_curs_set to term_curs_set --- include/wintty.h | 2 +- win/tty/getline.c | 4 ++-- win/tty/termcap.c | 20 ++++++++++---------- win/tty/wintty.c | 15 +++++++++++---- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/include/wintty.h b/include/wintty.h index 4d4057c46..87183708e 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -191,6 +191,7 @@ extern void term_start_color(int color); extern void term_start_bgcolor(int color); extern void term_start_extracolor(uint32, uint16); extern void term_end_extracolor(void); /* termcap.c, consoletty.c */ +extern void term_curs_set(int); /* ### topl.c ### */ @@ -255,7 +256,6 @@ extern void tty_raw_print_bold(const char *); extern int tty_nhgetch(void); extern int tty_nh_poskey(coordxy *, coordxy *, int *); extern void tty_nhbell(void); -extern void tty_curs_set(int); extern int tty_doprev_message(void); extern char tty_yn_function(const char *, const char *, char); extern void tty_getlin(const char *, char *); diff --git a/win/tty/getline.c b/win/tty/getline.c index 3bf66aef5..53a1465bd 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -79,9 +79,9 @@ hooked_tty_getlin( for (;;) { (void) fflush(stdout); Strcat(strcat(strcpy(gt.toplines, query), " "), obufp); - tty_curs_set(1); + term_curs_set(1); c = pgetchar(); - tty_curs_set(0); + term_curs_set(0); if (c == '\033' || c == EOF) { if (c == '\033' && obufp[0] != '\0') { obufp[0] = '\0'; diff --git a/win/tty/termcap.c b/win/tty/termcap.c index 7f4e2c9a7..1830fffad 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -747,16 +747,6 @@ tty_nhbell(void) (void) fflush(stdout); } -/* hide or show cursor */ -void -tty_curs_set(int visibility) -{ - if (!visibility && nh_VI) - xputs(nh_VI); - else if (visibility && nh_VE) - xputs(nh_VE); -} - #ifdef ASCIIGRAPH void graph_on(void) @@ -1495,6 +1485,16 @@ term_start_bgcolor(int color) xputs(tmp); } +/* hide or show cursor */ +void +term_curs_set(int visibility) +{ + if (!visibility && nh_VI) + xputs(nh_VI); + else if (visibility && nh_VE) + xputs(nh_VE); +} + #ifndef SEP2 #define tcfmtstr "\033[38;2;%ld;%ld;%ldm" #ifdef UNIX diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 37b8e5b22..92bef9dfc 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -542,7 +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); + term_curs_set(0); /* set up tty descriptor */ ttyDisplay = (struct DisplayDesc *) alloc(sizeof (struct DisplayDesc)); @@ -808,7 +808,7 @@ tty_exit_nhwindows(const char *str) { winid i; - tty_curs_set(1); + term_curs_set(1); tty_suspend_nhwindows(str); /* * Disable windows to avoid calls to window routines. @@ -3934,6 +3934,13 @@ term_start_bgcolor(int color) /* placeholder for now */ } #endif /* !MSDOS && !WIN32 */ + +void +term_curs_set(int visibility UNUSED) +{ + /* nothing */ +} + #endif /* NO_TERMS */ void @@ -3987,7 +3994,7 @@ tty_nhgetch(void) HUPSKIP_RESULT('\033'); print_vt_code1(AVTC_INLINE_SYNC); - tty_curs_set(1); + term_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 @@ -4021,7 +4028,7 @@ tty_nhgetch(void) } #endif } - tty_curs_set(0); + term_curs_set(0); if (!i) i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ else if (i == EOF)