-
Notifications
You must be signed in to change notification settings - Fork 301
Prompt before closing modified buffers #264
Comments
@justinmk, in Vim, the standard way to see if any buffers are dirty would be to get all buffers and then iterate over them to see if the |
Vim has the 'confirm' option. Nvim may need to add a new UI event for this. created an issue: neovim/neovim#6201 |
Thanks @justinmk! An event is what I'm looking for. If I run |
@keforbes Yeah, instead of a 'confirm' event, we should just externalize the dialog. |
@keforbes are we looking to UI-ify this or just have the regular prompt for now At the very least we could |
I'm torn between either fetching all buffers and checking their |
At a high-level, it would be nice to have the following methods on
And then per-
For our entry points to our close-UI, we can check Also, the above methods will be useful in general for other functionality - so I believe it'd be reasonable to implement it that way. |
I was actually thinking we would need a |
This is a huge gap in our current story, and basic functionality that any text editor should have... Ideally, we'd implement the following:
|
ext_messages "msg_show" event in Nvim 0.4 should cover at least part of this use-case. Is there anything missing from it? @bryphe @Akin909 @CrossR @keforbes |
@justinmk it definitely sources a way to show the prompt which we can GUI-fy 👍. One thought I've had is that with that something like a confirm quit dialog you'd want to surface that quite differently to other As it stands currently you'd have to parse the returned messages for a matching string indicating a quit prompt message and then render that differently, since it's not a special case. This is more just a UI concern that may be too specific to what I'm thinking for Oni 2 and tbh it's much more than we had when we opened this/haven't really gotten round to thinking about this problem yet for v2. |
@Akin909 That's definitely already covered by I can imagine a future enhancement that exposes the "choices" for an input dialog, instead of sending the raw dialog text. But that is not planned for now. |
A lot of my code just went poof |
When closing a buffer from the menu (
Quit
,Close
,Split -> Close
,Close Other Split(s)
) Oni needs to prompt to save if the buffer is modified. For some operations (Close
,Split -> Close
) we just need to check if the current buffer is dirty but for other operations (Quit
,Close Other Split(s)
) we need to see if any buffer is dirty.The text was updated successfully, but these errors were encountered: