-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command, window mode, and keybinding logic #315
Conversation
Most hardcoded shortcuts were replaced with a mode-dependent configurable shortcuts, which are mapped to abstract commands handled for easier handling. The concept of window modes was introduced to allow conditioning bindings on e.g. whether the help mode is active or whether a message is selected. Most bindings were moved to `WindowMode.Normal`, which has the lowest priority and does not get considered when the help popup or the channel modal is shown. `WindowMode.Anywhere` takes precedence over all other modes. The remaining modes are usually inserted in between if they are active (`Multiline, MessageSelected, Normal`). Keybindings are serialised from toml at startup. The default keybinding is active by default and can be overwritten via the configuration, e.g. default_keybindings = true [keybinding.anywhere] ctrl-c = "" ctrl-q = "quit" Future tasks - [ ] Show configured keybindings in the help menu - [ ] List all commands in the help menu
This would fix #307. |
Very nice! Thank you for your contribution! This is a big step forward. LGTM |
Use strum to do most of the parsing and conversion to usage/description strings of commands. TODO: - [ ] Rerender after scrolling in help mode - [ ] Add default shortcuts for scrolling in help mode
I've reworked some parts to use on strum's traits and macros for handling enums; I hope this makes sense. This is my first more sizable contribution to a rust project, so you might want to take a closer look. I've updated the most obvious tasks in the top comment. |
|
I'm unsure whether #315 caused operations like changing channels while downloading messages (especially shortly after startup) to be less responsive or whether this was an issue before. I'm going to test a non-async |
The main offender was Line 90 in 3caaad6
|
The problem is that we do blocking IO there and therefore block the async executor. |
Just to be clear, are you referring to the storage backend or to |
I am referring to A side note about the json backend: I plan to remove it completely. |
Most hardcoded shortcuts were replaced with a mode-dependent configurable shortcuts, which are mapped to abstract commands handled for easier handling.
The concept of window modes was introduced to allow conditioning bindings on e.g. whether the help mode is active or whether a message is selected. Most bindings were moved to
WindowMode.Normal
, which has the lowest priority and does not get considered when the help popup or the channel modal is shown.WindowMode.Anywhere
takes precedence over all other modes. The remaining modes are usually inserted in between if they are active (Multiline, MessageSelected, Normal
).Keybindings are serialised from toml at startup. The default keybinding is active by default and can be overwritten via the configuration, e.g.
Suggested tasks
App
or if there's a better wayREADME.md
Enter
to be passed throughI'd appreciate your feedback on these changes.