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

Fix MacVim Ctrl-C handling in Normal and Command-Line modes #856

Merged
merged 1 commit into from Feb 18, 2019

Conversation

ychin
Copy link
Member

@ychin ychin commented Feb 18, 2019

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(), set set_int, and then add the Ctrl-C to the input queue. MacVim still has Cmd-. for an aggressive interrupt in case Vim is hung (which shouldn't happen to begin with).

Fix #846

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()`,
set `set_int`, and then add the Ctrl-C to the input queue. MacVim still
has `Cmd-.` for an aggressive interrupt in case Vim is hung (which
shouldn't happen to begin with).

Fix macvim-dev#846
@ychin ychin merged commit 4bafe61 into macvim-dev:master Feb 18, 2019
@ychin ychin deleted the ctrl-c-interrupt-fix branch February 18, 2019 11:42
ychin added a commit to ychin/macvim that referenced this pull request Feb 18, 2019
Vim patch 8.1.950

Fixes:

- Fix Ctrl-C not working properly in Command-Line and Normal mode macvim-dev#856
- Fix scrollbar rendering artifact in macOS 10.13 or below macvim-dev#857
- matchit plugin now works again in MacVim (fixed in Vim 8.1.0875)

Targets macOS 10.8+

Script interfaces have compatibility with these versions:

- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.6
ychin added a commit that referenced this pull request Feb 18, 2019
Vim patch 8.1.950

Fixes:

- Fix Ctrl-C not working properly in Command-Line and Normal mode #856
- Fix scrollbar rendering artifact in macOS 10.13 or below #857
- matchit plugin now works again in MacVim (fixed in Vim 8.1.0875)

Targets macOS 10.8+

Script interfaces have compatibility with these versions:

- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.6
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.

None yet

1 participant