Skip to content
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

Warn when closing window with unsaved changes #1230

Merged
merged 8 commits into from
Jan 21, 2020

Conversation

glennsl
Copy link
Member

@glennsl glennsl commented Jan 20, 2020

2020-01-20-124655_413x233_scrot

Fixes #610

The message is a bit unbalanced, both visually and in terms of "scanability". It would be better to lead with a very short question summarizing the decision to be made, and then expand on it. We can tweak this later though, but it would be nice to have rich text support to be able to more easily to so.

A neat keyboard interface is planned for a subsequent PR.

@glennsl glennsl requested a review from bryphe January 20, 2020 11:53

let message = [
padding(20),
paddingBottom(30) // I don't know why this is needed, but it is
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some bugginess with the content size calculation here which causes the content to overflow unless adding some extra padding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the text wrapping is what's causing the issue here. If the text doesn't wrap then everything measures as expected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ya, it sounds like from our conversation there may be a bug with the measure method of the TextNode 🤔

@@ -54,6 +54,7 @@ type t = {
pane: Pane.t,
searchPane: Feature_Search.model,
focus: Focus.stack,
modal: option(Modal.t),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to combine the modal and context menu model, so that a modal and context menu can't both be visible at the same time. Have to merge the context menu PR before doing that though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I think the context menu should be unblocked now (#1232 brought in the boxShadow styling)

Comment on lines +130 to +131
| WindowCloseDiscardConfirmed
| WindowCloseSaveAllConfirmed
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are a bit awkward as they're essentially user intents. I also don't think it's necessarily a problem to have "action-like" messages, and with feature projects the encapsulation and lack of granularity might sometimes make event-like messages difficult. But enforcing event-like names is still very useful to stop thinking of them as functions.

This is also a reason why I'm leaning more towards using msg instead of event. Another reason being that the term is established and familiar from the Elm architecture.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! It seems like we're converging towards a very Elm-like architecture (ie, updater, subscription, and msg).

let applyBufferUpdate = bufferUpdate =>
ofBufferOpt(buffer => Buffer.update(buffer, bufferUpdate));
Option.map(buffer => Buffer.update(buffer, bufferUpdate));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice, thanks for cleaning this up!

@bryphe
Copy link
Member

bryphe commented Jan 21, 2020

Cool to see this in action! Thanks for all the work on this, @glennsl

@glennsl glennsl merged commit c5437d8 into onivim:master Jan 21, 2020
@glennsl glennsl deleted the feature/ux/unsaved-changes branch January 21, 2020 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows: No warning about unsaved changes
2 participants