Fix NO_TERMS compile, rename func

... to match others, from tty_curs_set to term_curs_set
This commit is contained in:
Pasi Kallinen
2024-04-02 14:30:16 +03:00
parent 7030b0b9fe
commit c4d4bafb44
4 changed files with 24 additions and 17 deletions

View File

@@ -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 *);

View File

@@ -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';

View File

@@ -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

View File

@@ -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)