Fix MacVim Ctrl-C handling in Normal and Command-Line modes #856
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Vim has a
ctrl_c_interrupts
mode that gets turned on in misc modes (e.g. Normal / Command-Line mode) when<C-C>
is not mapped. In this mode, Ctrl-C has special behavior and is hard-coded (i.e. not remappable).There is an old bug in how MacVim handles Ctrl-C under this mode. It's trying to be smart and aggressively clears the input queue (even non-text-related ones) without adding anything to the input queue. Previously it kind of worked due to a coincidence in how Vim's GUI handled input logic, but it was fragile. The recent Vim refactor that changed Vim GUI's input handling broke this.
Instead, don't do any of these smart input queue clearing and just do what Vim GUI code in other platforms does and call
trash_input_buf()
, setset_int
, and then add the Ctrl-C to the input queue. MacVim still hasCmd-.
for an aggressive interrupt in case Vim is hung (which shouldn't happen to begin with).Fix #846