-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Use bracket pattern in XMonad.Prompt #287
Conversation
6566975
to
6e137ad
Compare
Thanks @mgsloan ! This certainly seems reasonable on its face, but I feel like I have no way to really verify whether this works as advertised. Anyone else have any thoughts? |
Thanks for reviewing @byorgey ! The issue described in #180 can be reproduced by causing an error after the xprompt has initialized:
Then, having a keybinding bound to
I'm actually in favor of deleting this use of catch, or at the very least, display the error to stderr. It could be fairly befuddling why completion isn't working if it's just silently throwing an exception. If it aids in review, I could split this into two commits - one to extract out the commonality between |
If you're willing to do that I think it would be really helpful. I was having trouble even figuring out what I was looking at when trying to parse the diff. |
Also, note that I didn't encounter this issue in the wild, but I have encountered cases where I could not exit the prompt (#290), and so I'm interested in making the prompt more reliable |
Come to think of it, I have experienced the behavior in #290 too. |
6e137ad
to
1a19002
Compare
Yep, the same occurred to me now that I'm looking at the diff a while after writing it. Pretty inscrutable! I've pushed separate commits that make it a bit clearer |
XMonad/Prompt.hs
Outdated
io $ destroyWindow d w | ||
destroyComplWin | ||
io $ sync d False | ||
destroyComplWin) |
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.
Ideally, destroying the completion window would be in a finally
, but unfortunately that resource is tracked via StateT
. Handling that properly would be a larger change.
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.
While reproducing #217 , I found that it was pretty gnarly if the completion window wasn't destroyed. So I've added a commit resolving that.
Admittedly the IORef solution feels pretty hacky, but the only alternatives I can think of are equivalent to adding such an IORef in some other way, and those alternatives require a lot more plumbing than just adding it to the StateT.
5560293
to
b9603a0
Compare
@byorgey I've rebased this atop master. Is this splitting up of the change sufficient for review? |
@mgsloan Thanks, that was helpful! Sorry for the delay. |
@byorgey No problem, thanks for merging :)
…On Tue, Feb 12, 2019, 07:14 Brent Yorgey ***@***.*** wrote:
@mgsloan <https://github.com/mgsloan> Thanks, that was helpful! Sorry for
the delay.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#287 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABYKn_1TFVCEcBPjLzth6tiqpAeGaHYks5vMtpVgaJpZM4ZkWTR>
.
|
Also deduplicates some code shared by mkXPromptWithReturn and
mkXPromptWithModes.
Description
See issue #180. I noticed 3 obvious places where Prompt can benefit from the bracket pattern, and this PR implements that. This should help avoid failure modes like the keyboard being grabbed forever, or leaving a prompt window open forever.
Checklist
I've read CONTRIBUTING.md
I tested my changes with xmonad-testing
I updated the
CHANGES.md
file