first character of message window special outside putmixed

Issue #1042 states the following:
> Steps to reproduce:
> *name pet so that first (or only) character is non-ascii: example Ä or emoji.
> Most of the time the name is correctly shown.
> If new row starts with pet's name then character is not printed correctly.

The kludge for handling mixed glyphs and text shouldn't have been engaging
the special handling of the first character for anything outside of putmixed().
This should resolve that.
This commit is contained in:
nhmall
2023-05-31 00:10:22 -04:00
parent dea25c73c2
commit f3ad23fce2
3 changed files with 6 additions and 1 deletions

View File

@@ -103,6 +103,7 @@ struct DisplayDesc {
winid lastwin; /* last window used for I/O */
char dismiss_more; /* extra character accepted at --More-- */
int topl_utf8; /* non-zero if utf8 in str */
int mixed; /* we are processing mixed output */
};
#endif /* WINDOW_STRUCTS */

View File

@@ -125,7 +125,7 @@ redotoplin(const char *str)
home();
if (!ttyDisplay->topl_utf8) {
if (*str & 0x80) {
if (ttyDisplay->mixed && (*str & 0x80)) {
/* kludge for the / command, the only time we ever want a */
/* graphics character on the top line */
g_putch((int) *str++);

View File

@@ -501,6 +501,8 @@ tty_init_nhwindows(int *argcp UNUSED, char **argv UNUSED)
ttyDisplay->color = NO_COLOR;
#endif
ttyDisplay->attrs = 0;
ttyDisplay->topl_utf8 = 0;
ttyDisplay->mixed = 0;
/* set up the default windows */
BASE_WINDOW = tty_create_nhwindow(NHW_BASE);
@@ -3746,6 +3748,7 @@ tty_putmixed(winid window, int attr, const char *str)
tty_raw_print(str);
return;
}
ttyDisplay->mixed = 1;
#ifdef ENHANCED_SYMBOLS
if ((windowprocs.wincap2 & WC2_U_UTF8STR) && SYMHANDLING(H_UTF8)) {
mixed_to_utf8(buf, sizeof buf, str, &utf8flag);
@@ -3757,6 +3760,7 @@ tty_putmixed(winid window, int attr, const char *str)
/* now send it to the normal tty_putstr */
tty_putstr(window, attr, buf);
ttyDisplay->topl_utf8 = 0;
ttyDisplay->mixed = 0;
}
/*