-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: disable mnemonic accelerator keys in menu's path labels #392
Conversation
I would prefer if you added an argument to |
New pure virtual function Platform::Menu::AddItemRaw which treats as raw text label's mnemonic accelerator keys (src/platform/gui.h). "File > Open Recent" and "New Group > Link Recent" now list paths in their integrity: AddItemRaw doesn't replace/remove label's text (i.e. guigtk.cpp '&' -> '_'), nor it activates mnemonic accelerator keys.
Ok, I'll provide an alternative way as new commit. Then, if you approve it, let's squash the commits. |
Add mnemonics argument to Platform::Menu::AddItem (src/platform/gui.h) to treat as raw text label's mnemonic accelerator keys when false. "File > Open Recent" and "New Group > Link Recent" now list paths in their integrity. With AddItem's mnemonics argument set to false, no label's text is replaced/removed (i.e. guigtk.cpp '&' -> '_'), nor mnemonic accelerator keys are activated.
f2f638d
to
48871a4
Compare
@@ -171,7 +171,8 @@ class Menu { | |||
virtual ~Menu() {} | |||
|
|||
virtual std::shared_ptr<MenuItem> AddItem( | |||
const std::string &label, std::function<void()> onTrigger = std::function<void()>()) = 0; | |||
const std::string &label, bool mnemonics = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think unless you put the mnemonics
argument after onTrigger
the default value for it is quite pointless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Add /*mnemonics=*/ in call sites. Remove mnemonics default value in src/platform/gui.h.
Pull amended as per @whitequark request. First post edited to reflect the current behavior. |
You did the opposite of what I asked. |
Thanks for the bug report and the patch. Fixed in ce0b130. |
I see... I misinterpreted your suggestion...
I'm sorry, what I got was "do not use a default value for
You're welcome. Thanks for fixing the master branch! |
Solvespace version: 3.0~46528bfc
OS: Gentoo GNU/Linux
Already signed Solvespace's Contributor License Agreement.
Bug
File > Open Recent
andNew Group > Link Recent
replace/remove strings in file paths and activate mnemonic accelerator keys.This means that on GNU/Linux the path
/tmp/_foo_&_bar_.slvs
is showed as/tmp/foo_bar.slvs
.settings.json
Proposed solution
Add
mnemonics
argument toPlatform::Menu::AddItem
to treat as raw text label's mnemonic accelerator keys when it isfalse
(src/platform/gui.h
).New pure virtual functionPlatform::Menu::AddItemRaw
which treats as raw text label's mnemonic accelerator keys (src/platform/gui.h
).AddItemRaw
doesn't replace/remove label's text (i.e.guigtk.cpp '&' -> '_'
), nor it activates mnemonic accelerator keys.Caveats
Solution tested only on Gentoo GNU/Linux.
The code in
src/platform/guiwin.cpp
andsrc/platform/guimac.mm
isn't tested and may require amendments.Does
NegateMnemonics
escape mnemonic accelerator keys correctly (src/platform/guiwin.cpp
)?Not sure ifAddItemRaw
inguiwin.cpp
shall allocate a buffer before assigning it tomii.dwTypeData
. Also, doesSetMenuItemInfoW
operate as expected updating the menu item's label?Can someone review the code, please?