Skip to content

Fix overwriting of custom shortcuts

Nathan Lee requested to merge nathanal/inkscape:inkscape2453 into master

The primary shortcut (which is displayed in menus) shouldn't be removed when removing another shortcut.

This checks that the removed shortcut is the same as the primary shortcut, before removing the primary shortcut attached to the verb.

Fix #2384 (closed) Fix #2453 (closed)


Old todoI'd like to also tackle the addition of extraneous shortcuts (taken from the system shortcuts, and added to the user shortcuts) that revealed this problem before merging, so marking as Draft (though testing the steps to replicate, both problems are already fixed).

I believe the remaining problem is that user_set mapping is defined for the primary shortcut (so we know to mark it in blue in the Preferences dialog), but we use that value when writing out all shortcuts that share that verb.

Simplest solution for me is to map user_set by shortcut instead of by verb (takes up more space though).

Update:

Done! I did the simplest solution to prevent extraneous shortcuts from being written into user shortcuts. (extraneous refers to system shortcuts that are unintentionally added),

user_set now tracks every verb's shortcut, instead of every verb.

This allows for the fix in Shortcuts::write, which previously went through each shortcut, and wrote it to the user file if the shortcut's verb's primary shortcut was user set.

sizeof(Gtk::accelkey) is 40, so 10000 or so shortcuts would be about 400 kb. That's an acceptable size increase (system shortcuts comes to about 300 shortcuts atm).

Edited by Nathan Lee

Merge request reports