Skip to content

Commit

Permalink
Show correct shortcut text on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Feb 12, 2025
1 parent 08d0186 commit eda749d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Telegram/SourceFiles/settings/settings_shortcuts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ struct Labeled {
};
}

[[nodiscard]] QString ToString(const QKeySequence &key) {
auto result = key.toString();
#ifdef Q_OS_MAC
result = result.replace(u"Ctrl+"_q, QString() + QChar(0x2318));
result = result.replace(u"Meta+"_q, QString() + QChar(0x2303));
result = result.replace(u"Alt+"_q, QString() + QChar(0x2325));
result = result.replace(u"Shift+"_q, QString() + QChar(0x21E7));
#endif // Q_OS_MAC
return result;
}

[[nodiscard]] Fn<void()> SetupShortcutsContent(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> content) {
Expand Down Expand Up @@ -233,9 +244,9 @@ struct Labeled {
? TextWithEntities()
: removed
? Ui::Text::Wrapped(
TextWithEntities{ key.toString() },
TextWithEntities{ ToString(key) },
EntityType::StrikeOut)
: TextWithEntities{ key.toString() });
: TextWithEntities{ ToString(key) });
keys->setTextColorOverride((recording == raw)
? st::boxTextFgGood->c
: removed
Expand Down

0 comments on commit eda749d

Please sign in to comment.