From 5fea3d0de63fcd45c436e38ef6156b6dcc714ff5 Mon Sep 17 00:00:00 2001 From: Prathmesh Shukla Date: Mon, 16 Mar 2026 02:00:06 +0530 Subject: [PATCH 1/2] fixes #2962 --- devel/222_54.md | 17 +++++++++++++++++ src/Plugins/Qt/qt_ui_element.cpp | 5 +++-- src/Texmacs/Server/tm_config.cpp | 3 ++- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 devel/222_54.md diff --git a/devel/222_54.md b/devel/222_54.md new file mode 100644 index 0000000000..97b2550380 --- /dev/null +++ b/devel/222_54.md @@ -0,0 +1,17 @@ +# #2962 There is a problem with the display of accent shortcut keys on macOS + +## Problem +On macOS, modifier keys in accent shortcut tooltips (e.g., in the math toolbar) were displayed incorrectly instead of the corresponding macOS modifier symbols (⌘, ⌥, ⇧) + +## Solution + +This patch ensures that modifier symbols are correctly rendered in Qt tooltips on macOS through two small adjustments: + +### 1. Tooltip UTF-8 Conversion +In `src/Plugins/Qt/qt_ui_element.cpp`, tooltip text is now passed through `cork_to_utf8()` before being converted to a Qt string. This converts TeXmacs character references into their proper Unicode symbols so that Qt displays them correctly. + +### 2. macOS Shortcut Rendering Condition +In `src/Texmacs/Server/tm_config.cpp`, the `kbd_system_prevails` condition was refined to avoid applying legacy modifier substitutions when macOS fonts are already being used. This prevents conflicts with the font-based rendering of macOS modifier symbols. + +## Result +Accent shortcut tooltips on macOS now correctly display modifier keys using the expected symbols (⌘, ⌥, ⇧). diff --git a/src/Plugins/Qt/qt_ui_element.cpp b/src/Plugins/Qt/qt_ui_element.cpp index 9fce616b0e..1eb883063d 100644 --- a/src/Plugins/Qt/qt_ui_element.cpp +++ b/src/Plugins/Qt/qt_ui_element.cpp @@ -19,6 +19,7 @@ #include "qt_window_widget.hpp" #include "analyze.hpp" +#include "converter.hpp" #include "message.hpp" #include "promise.hpp" #include "scheme.hpp" @@ -513,7 +514,7 @@ qt_ui_element_rep::as_qaction () { { typedef quartet T1; T1 y= open_box (get_payload (help, text_widget)); - act->setToolTip (to_qstring (y.x1)); + act->setToolTip (to_qstring (cork_to_utf8 (y.x1))); // HACK: force displaying of the tooltip (needed for items in the // QMenuBar) QObject::connect (act, SIGNAL (hovered ()), act, SLOT (showToolTip ())); @@ -929,7 +930,7 @@ qt_ui_element_rep::as_qwidget () { typedef quartet T1; T1 y= open_box (get_payload (help, text_widget)); QWidget* w= qtw->as_qwidget (); - w->setToolTip (to_qstring (y.x1)); + w->setToolTip (to_qstring (cork_to_utf8 (y.x1))); qwid= w; } break; diff --git a/src/Texmacs/Server/tm_config.cpp b/src/Texmacs/Server/tm_config.cpp index 9310799e05..4a75977f19 100644 --- a/src/Texmacs/Server/tm_config.cpp +++ b/src/Texmacs/Server/tm_config.cpp @@ -328,7 +328,8 @@ kbd_render (tree t) { static string kbd_system_prevails (string s) { string laf= get_preference ("look and feel"); - bool mac= os_macos () && (laf == "default" || laf == "macos"); + bool mac= os_macos () && (laf == "default" || laf == "macos") && + !use_macos_fonts (); if (mac && starts (s, "A-")) { string ss= s (2, N (s)); string r = "escape " * ss; From 607ad819f6ddf2dd3b89673717b7aeb994522055 Mon Sep 17 00:00:00 2001 From: Prathmesh Shukla Date: Wed, 18 Mar 2026 09:09:55 +0530 Subject: [PATCH 2/2] [222_60] Update numbering as per review --- devel/{222_54.md => 222_60.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename devel/{222_54.md => 222_60.md} (100%) diff --git a/devel/222_54.md b/devel/222_60.md similarity index 100% rename from devel/222_54.md rename to devel/222_60.md