encounter / objdiff

A local diffing tool for decompilation projects
Apache License 2.0
122 stars 21 forks source link

objdiff-gui: Implement keyboard shortcuts #139

Open LagoLunatic opened 2 days ago

LagoLunatic commented 2 days ago

Keyboard-only navigation demonstration:

https://github.com/user-attachments/assets/6abf4824-ca4d-490a-b259-650a9a096e3e

This PR implements the following keyboard shortcuts:

Symbol list view:

Function/data/extab diff view:

Function diff view only:

I also wanted to add a shortcut to open the context menus via the keyboard, but I don't think it's possible in egui :/

Most of these are pretty self-explanatory, but the shortcuts to select the symbol above/below the current one in the listing required a few changes to how objdiff handles the highlighted symbols. The short version is that the highlighted symbols pair is now treated more like a permanent cursor that you can use to navigate around without the mouse. Long version:

Also, the "split view" where half the window is the function view and the other half is the symbol list view is supported. The symbol list's shortcuts work normally here, while the function diff half has the up/down shortcuts disabled so it doesn't scroll accidentally while navigating the symbol list, but the PageUp/PageDown/Home/End shortcuts are still enabled in case you do want to scroll the function diff in the split view.

Let me know if anything could be improved!