sirjuddington / SLADE

It's a Doom editor
https://slade.mancubus.net
GNU General Public License v2.0
686 stars 104 forks source link

Fix mirroring actions to only apply once with keyboard shortcut #1597

Closed thezerobit closed 7 months ago

thezerobit commented 7 months ago

I noticed that if I use the keyboard shortcuts in 2D map edit mode to mirror selection, it would apply the action twice. You have to use Undo to see that it was mirrored twice, otherwise it looks like nothing happened. This doesn't happen when you use the menu. The action in either case is triggered from the MapEditContext::handleAction method, so this code in Input::handleKeyBind2d is superfluous and just causes it to be applied twice when using the shortcuts. After removing these lines, the keyboard shortcuts became usable, just triggering the action once.

sirjuddington commented 7 months ago

Closing this PR as I've fixed a different way in e542d0dabdec3f37f588453d85404a87f627977c, which should also work for any other actions that have a similar setup (or have their keybinds changed by the user to something with ctrl or alt)

Interestingly this didn't happen on Windows, as there for some reason if a keypress hits a menu item with a shortcut key, it isn't propagated further and so doesn't get to the keybind system.