WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
43.94k stars 1.92k forks source link

[Bug] Keyboard shortcuts in editor for macOS no long work in 1.34.0 #1757

Open neutron-ice opened 3 months ago

neutron-ice commented 3 months ago

Operating System

MacOS

What's the issue you encountered?

In the Pattern Editor keyboard shortcuts, like CMD+C or CMD+V and some rest no longer work.

Downgraded to the previous version 1.33.2 – everything is okey.

How can the issue be reproduced?

When in settings assign new shortcut, e.g. press "CMD+V" instead I see "CTRL+V". When press CTRL+V instead I see "CMD+V".

But anyway nothing work in editor, irrelevant it is "cmd+v" or "ctrl+v" – work only nowhere else defined Alt+V. Undo (CMD+Z) work like nowhere else defined "CMD+Backspace/Del".

https://github.com/WerWolv/ImHex/assets/149683770/a80f7093-8712-4619-a305-d99c04daa774

ImHex Version

1.34.0

ImHex Build Type

Installation type

Portable

Additional context?

Apple M1, macOS 12.6

paxcut commented 3 months ago

There seems to be two separate errors reported. One is about the pattern editor where the mac shortcuts no longer work. The pattern editor is undergoing a transition where the shortcuts will be part of the shortcuts manager and will be editable like all the other shortcuts, but only the part that removed the old shortcut code made it to the release. Once the pr that adds the new shortcuts is merged then it should work again. The other issue is about editing shortcuts in the hex editor and I know nothing about that.

sisco0 commented 3 months ago

Regarding the cmd vs ctrl inconvenience, @neutron-ice Could you kindly check if keys are properly interpreted at other applications/websites? e.g. https://en.key-test.ru

neutron-ice commented 3 months ago

Could you kindly check if keys are properly interpreted at other applications/websites?

Yep, everything is properly interpreted. At same time in same environment previous version (1.33.2) works correctly, something happened with new version:

https://github.com/WerWolv/ImHex/assets/149683770/b8dfca6f-8f5f-4ae5-be09-4c52ee0d17dd

root670 commented 3 months ago

It seems Cmd and Ctrl have been swapped. For example undo should be Cmd-Z but only works with Ctrl-Z now. When pressing cmd or ctrl in the shortcut screen they appear swapped (i.e. press Cmd and it shows up as Ctrl)

paxcut commented 3 months ago

There has been a recent commit that seems to be aimed at this issue but it is missing two important details 1) The pattern editor shortcut code has been moved to be part of the shortcut manager so the changes made in the commit will not be relevant if pr #1700 is merged. 2) The main issue becomes that the shortcuts for Mac are done incorrectly for the entire Imhex and not only for the pattern editor. Searching for changes that affect mac shortcuts point to pr #889 but that code has been in place since Jan 2023 so there must be more recent changes that are causing the the issue as it is reported that 1.33.2 works fine.

gkpln3 commented 3 months ago

It appears that each time i press CMD it interprets it as CTRL instead, and CTRL is interpreted as CMD.

paxcut commented 3 months ago

Does that swapping of keys happen everywhere on Imhex? The pattern editor and the hax editor have independent mappings for keys.In fact if you check the shortcut tab in settings you'll see all the different places where mappings could be different which of course includes the shortcut tab window itself.

KevinCCucumber commented 1 month ago

M2 Max Macbook user here. For me, sometimes control is accepted instead of cmd, but not really reproducible. Using CMD does neither work in the pattern editor nor in the imhex window. Checking in the shortcut settings, control and cmd are indeed swapped for me. Version 1.34.0

zakkhoyt commented 1 day ago

Same issue here (cmd and ctrl keys are reversed)/.

M2 max here. I took a video for you to demo.

https://github.com/user-attachments/assets/1e222ab8-1235-414c-8ad7-70a863f43355

paxcut commented 1 day ago

This is probably an issue with how imgui handles mac keys because afaik imhex uses imgui to obtain keys in any os. The strange think is that it used to work and now it doesn't, yet there has been no changes to the key handling code in quite some time. I did find older issues in imgui that mention how ctrl and cmd were swapped twice and then one of the swaps was removed. but that should have been fixed by now.

Having re-definable shortcuts means you can still define the shortcuts to be exactly what you prefer. Until we can figure out why keys are swapped now (and for that we need mac users to debug imhex) Define the shortcuts how you prefer (recently the shortcuts for the pattern editor were added to the list of re-definable shortcuts) and wait for a mac user that can debug imhex to figure it out.