From 9212ae75f823fca8e8435e0337dec47d1ab510a6 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 30 Jun 2023 12:55:33 -0700 Subject: [PATCH] tentative fix for issue #1026 - Enhanced1 Issue reported by ostrosablin (and mentioned previously but I still I haven't remembered where): loading a roguesymset removes any utf8 data that has been set up for primary symset. The curses interface explicitly initializes roguesymset to the default set and if config file has specified OPTIONS=symset:Enhanced1 (or some other uft8 set if someone adds such), that stays the active set but no longer gets rendered with the intended symbols. I have no idea whether having symset and roguesymset both use uft8 with different symbols and/or colors works at all and if so whether it will still work after this revision, but this prevents loading one set with non-utf8 while the other still uses utf8 from clearing out the cached utf8 data. Closes #1026 --- doc/fixes3-7-0.txt | 2 ++ src/symbols.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 6f845b803..ab4c8605c 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1668,6 +1668,8 @@ curses: with window borders on and align_status:left, restoring brought up a curses: after changing curses_mark_synch() to do something, making a menu selection by entering a count that uses more than 1 digit caused the menu to vanish +curses: setting up default roguesymset at startup clobbered primary symset if + config file picked Enhanced1 for primary (core bug exposed by curses) Qt: at Xp levels above 20 with 'showexp' On, the combined status field "Level:NN/nnnnnnnn" was too big and truncated by a char at each end Qt: searching a text window for something that wasn't found and then searching diff --git a/src/symbols.c b/src/symbols.c index 5ce5ed101..c277c76ab 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -321,6 +321,11 @@ update_rogue_symset(const struct symparse* symp, int val) void clear_symsetentry(int which_set, boolean name_too) { +#ifdef ENHANCED_SYMBOLS + int other_set = (which_set == PRIMARYSET) ? ROGUESET : PRIMARYSET; + enum symset_handling_types old_handling = gs.symset[which_set].handling; +#endif + if (gs.symset[which_set].desc) free((genericptr_t) gs.symset[which_set].desc); gs.symset[which_set].desc = (char *) 0; @@ -337,7 +342,10 @@ clear_symsetentry(int which_set, boolean name_too) gs.symset[which_set].name = (char *) 0; } #ifdef ENHANCED_SYMBOLS - free_all_glyphmap_u(); + /* if 'which_set' was using UTF8, it isn't anymore; if the other set + isn't using UTF8, discard the data for that */ + if (old_handling == H_UTF8 && gs.symset[other_set].handling != H_UTF8) + free_all_glyphmap_u(); purge_custom_entries(which_set); #endif }