qvacua / vimr

VimR — Neovim GUI for macOS in Swift
https://twitter.com/VimRefined
MIT License
6.64k stars 218 forks source link

Esc to dismiss unsaved buffer confirmation dialog #881

Closed jasonm closed 2 years ago

jasonm commented 2 years ago

When closing the VimR application with open unsaved buffers, a confirmation dialog lets the user "Discard and Quit" or "Cancel".

Also, when closing a buffer with unsaved changes, a similar confirmation dialog appears.

This PR adds a keyboard modifier to allow using the escape key to cancel. (This is the behavior in MacVim.)

I have not compiled these changes to verify the behavior. I'm on macOS 10.14.6 and can't install a newer XCode to support Swift 5.3.0 right now. (At least I think that's the issue... I've never done Swift or XCode development 🙈 ).

I found the escape key modifier string literal here: https://stackoverflow.com/questions/28541517/how-to-assign-escape-as-key-equivalent-to-a-button-in-swift/28541684

I hope this PR is useful!

image

image

qvacua commented 2 years ago

Thanks, works nicely!