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
This commit is contained in:
PatR
2023-06-30 12:55:33 -07:00
parent 52dcd101e4
commit 9212ae75f8
2 changed files with 11 additions and 1 deletions

View File

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