From f3ad23fce2ee80b44806d28607660c3132c0a288 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 31 May 2023 00:10:22 -0400 Subject: [PATCH] first character of message window special outside putmixed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- include/wintty.h | 1 + win/tty/topl.c | 2 +- win/tty/wintty.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/wintty.h b/include/wintty.h index ad7f7ce05..8d272cf56 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -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 */ diff --git a/win/tty/topl.c b/win/tty/topl.c index 3bc266516..fe7417cfa 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -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++); diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 27f171001..d27d542b9 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -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; } /*