Improve keybindings#191
Open
ymcx wants to merge 14 commits into
Open
Conversation
Contributor
Author
|
Apparently this branch I was holding onto was based on the old fix of #190, so this contains some regressions I need to fix before this can be merged, sorry. I was certain I updated it to match the approach of the merged PR, but apparently not. I'll check this tomorrow, since I'm quite tired right now and have work the next morning. |
added 3 commits
May 21, 2026 16:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR completely changes how keybinds are handled by dividing the actions into their own files, organized by the screen/state. Before we had a global function that handled all keybinds in all states. This approach, however, is quite prone to errors, since it's not exactly clear which actions will work and in which states, especially considering the state matching is dependend on the sorting of the keybinds in the match operation in the keybind function. This separation will mean that fewer actions are shared between states by default unless explicitly defined.
I've tried to compile a comprehensive list of the changed keybindings. Most keybindings should match the old behavior 1:1, but there might be small deviances. Most notably I added some alternative keybindings to already existing actions, like using the VIM keybindings for moving in all screens that support moving (Even though this was already partly addressed in #185). I've attached a table containing all of the changed keybindings to the bottom of this comment.
The second big change is how selection is handled. With this change we're now able to see the selected stock in the summary view as well. The title of the highlighted entry is colored orange and it can be changed using the exact same keybindings as in the stock screen. Scrolling the view using the mouse in place of the arrow keys doesn't control the selection, but the reverse doesn't apply. Selecting a stock that isn't on the screen will scroll the view as far back as is necessary to show the item on the screen. When adding a new stock, the view scrolls to the very bottom in order to show the newly added item.
The third and perhaps the most noticable change is that from now on stocks can be selected using the arrow right/down and up/left keys rather than the tab key. The tab key on the other hand now modifies the time frame. I would've liked to keep the shortcuts as unchanged as possible, but I decided to make this compromise in order to align stock switching with stock moving. Previously stock switching was done using the tab key, but stock moving was done with the arrow keys while holding down the control key. Now both utilize the arrow keys with the same modifiers.
Just like what was done in #185, the original stock removal key 'k' was once again changed, this time to 'r'. K can't be used since it's colliding with the VIM movement-keys. R is the initial character of the word 'remove' and as such it should be intuitive for new users.