-
Notifications
You must be signed in to change notification settings - Fork 164
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
Replace keybinding name fromJust with maybe #511
Replace keybinding name fromJust with maybe #511
Conversation
src/Brick/Keybindings/Pretty.hs
Outdated
@@ -124,7 +124,7 @@ mkKeybindEventHelp kc h = | |||
ByKey b -> | |||
(Comment "(non-customizable key)", [Verbatim $ ppBinding b]) | |||
ByEvent ev -> | |||
let name = fromJust $ keyEventName (keyConfigEvents kc) ev | |||
let name = fromMaybe "<unnamed>" $ keyEventName (keyConfigEvents kc) ev |
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.
@jtdaugherty I don't understand why this failed for me - I do not see <unnamed>
in the output.
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.
I must have missed one event in KeyEvents
and then fixed it before creating this PR.
I deleted one, and the text is shown now:
| Keybinding | Event Name | Description |
| ---------- | ---------- | ----------- |
| `C-q` | (unnamed) | Open quit game dialog |
7c84b2c
to
7015b40
Compare
I'm a little confused - could you provide some context for this patch? The commit message does not provide a motivation for it, so I don't know what problem this is intended to solve. |
@jtdaugherty I updated the description. 👍 Simply put I run into a |
Oh, so the higher-level problem is that you had a key event in existence that was not in the |
Thanks for your patch! |
This is now released in 2.3.2. |
When I forgot a
KeyEvents
entry and tried to print all keybindings, thefromJust
failed with an error that does not show the problematic handler.Instead of erroring out, write
(unnamed)
into Event Name, so that it's easy to see which handler is missing a name.