-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
keymapping: Add new 'a' key for all messages. #805
keymapping: Add new 'a' key for all messages. #805
Conversation
@neiljp As written above, both 'Esc' and 'a' are working right now and will display all messages. Please let me know if this needs to change. Also, I could not find if any tests need to be added or updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adwait-thattey Thanks for working on this :) This gets a good way there according to the original issue 👍
While this does keep the original behavior, this is by hardcoding it as an option, whereas it is more flexible if we can rely upon extending the keybindings, ie. adding to the set of keys for a command.
I should note that there is limited space next to each 'button' to show one shortcut key, otherwise we could show both keys, which is why it's fine for the help and the [a]
to differ.
The other thing mentioned in the issue is adding this to the README, as we have these hotkeys listed there too.
Regarding tests, this passes ones we currently have. If you do want to investigate improving them with this, you could check if there are any hard-coded 'esc' in the tests as that could indicate how they could be broadened to use your new ALL_MESSAGES
token.
@neiljp I made the changes. This may cause some indentation issues... In all my test runs, always 'esc' appeared. But I don't think we can rely on that? |
Just to note here: I responded elsewhere today that we should likely move to a list for the external interface for the keys, for more reproducible behavior generally - this would be a good commit to have before the existing one. |
Yes. On it |
@neiljp I have added 2 commits. 2nd one adds the 'a' key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adwait-thattey This looks good 👍 I've left some comments inline.
There's one mention of set
in another test (docstring) which you could update.
My only other concern is that we do use keys_for_command
in many places (git grep keys_for_command
) and that something may fall through the gaps.
Once you've updated the commits, I'd suggest checking out gitlint and our style in git log, for matching our existing style, though we could also do this before merging.
@@ -324,12 +324,12 @@ def is_command_key(command: str, key: str) -> bool: | |||
raise InvalidCommand(command) | |||
|
|||
|
|||
def keys_for_command(command: str) -> Set[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the commit text it would be useful to describe why this is useful.
The changes in this commit do start to resolve the ordering issue, but only via sorting - I suspect we'll want to follow up this PR with a larger migration of the internal data to allow specifying eg. the first entry in the keymap to be one that is shown in the UI.
This is needed as set can return an arbitary element on pop() but in some instances we may require a particular key. Appropriate test methods are also modified
A New Keymapping 'ALL_MESSAGES' is added. This maps to 'a' key. This replaces the 'GO_BACK' ('ESC') key currently being used for displaying all messages. Currently both 'GO_BACK' and 'ALL_MESSAGES' work. Fixes #804
@neiljp I made the changes. pop is used in many other places and I wonder if they will need to be changed to pop(0) too... considering if more than 1 keys are added to those actions later |
@adwait-thattey Thanks! I've merged these two commits with minor changes to the commit text 🎉 |
@adwait-thattey As I mentioned, a good follow-up would be to migrate the system to take a standard element (first, or last?) from lists of keys for each command (and document that in the file), and then ensure that the UI treats that in the correct way. |
@neiljp Thanks a lot :)
Yes, I will try this. Should I open another issue for this? |
@adwait-thattey If you plan to work on it, you can just open a PR when you're ready :) |
A New Keymapping 'ALL_MESSAGES' is added.
This maps to 'a' key.
This replaces the 'GO_BACK' ('ESC') key currently
being used for displaying all messages.
Currently both 'GO_BACK' and 'ALL_MESSAGES' work.
Fixes #804
Signed-off-by: Adwait Thattey coderdude1999@gmail.com
Screenshot: