fix symbol-font bug

seen here:
https://github.com/MagicSetEditorPacks/Full-Magic-Pack/issues/149
This commit is contained in:
GenevensiS
2025-07-20 07:50:02 +02:00
parent 7f6170998b
commit 51f882315a
+19 -7
View File
@@ -481,13 +481,25 @@ wxMenu* InsertSymbolMenu::makeMenu(int id, SymbolFont& font) const {
wxMenuItem* InsertSymbolMenu::makeMenuItem(wxMenu* parent, int first_id, SymbolFont& font) const {
String label = this->label.get();
// ensure that there is not actually an accelerator string,
label.Replace(_("\t "), _("\t"));
#ifdef __WXMSW__
label.Replace(_("\t"), _("\t ")); // by prepending " "
#else
label.Replace(_("\t"), _(" ")); // by simply dropping the \t
#endif
// ensure that we are not defining an accelerator...
// everything after a tab is considered to be an accelerator by wxMenuItem
int accel_pos = label.find_last_of('\t');
if (accel_pos != label.npos && accel_pos > 0) {
String accel = label.substr(accel_pos+1);
#ifdef __WXMSW__
// if there is a + or - in the accelerator, replace the tab with spaces (simply adding a space does not work)
if (accel.Contains("+") || accel.Contains("-")) {
label = label.substr(0, accel_pos) + _(" ") + accel;
}
// otherwise simply add a space after the tab if there isn't one
else {
label.Replace(_("\t "), _("\t"));
label.Replace(_("\t"), _("\t "));
}
#else
label = label.substr(0, accel_pos) + _(" ") + accel; // replace the tab with spaces
#endif
}
if (type == Type::SUBMENU) {
wxMenuItem* item = new wxMenuItem(parent, wxID_ANY, label,
wxEmptyString, wxITEM_NORMAL,