macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.51k stars 683 forks source link

<C-H> Mapping has stopped working in MacVim GUI, but still works in TUI #1370

Closed SirVer closed 1 year ago

SirVer commented 1 year ago

Steps to reproduce

  1. Open a file in TUI mode vim /tmp/blub.txt
  2. Ensure something is imapped to <c-h>.
  3. Typing <c-h> actually triggers this trigger
  4. :gui
  5. Now <c-h> is deleting the last character.

Expected behaviour

<c-h> should not be the same as <backspace>. I am aware that in traditional terminal emulators, there is no difference between <c-h> and <backspace>, however on another computer with an older mac VIM, this behaved differently: both the TUI and the GUI accept <c-h> as a mapping that is not interpreted as backspace. On my new computer (with Vim 9) and a recent macvim from homebrew, the TUI still accepts it, but not the GUI. Of note is that this happens most of the time, but sometimes the GUI also accepts <c-h>.

I made a screen capture to show the behavior, here <c-h> is mapped to https://github.com/SirVer/ultisnips expand command. You can see that it expands lorem<c-h> always in TUI mode, but only sometimes in GUI mode.

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 01 2021 08:32:44) macOS version - x86_64 Included patches: 1-2681

Version of Vim and architecture

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Feb 07 2023 11:35:56) macOS version - arm64 Included patches: 1-1276 Compiled by Homebrew Huge version with MacVim GUI.

Environment

OS: Ventura, arm64 terminal: same behavior for iTerm2 & Terminal.app TERM: xterm-256color SHELL: zsh 5.8.1 (x86_64-apple-darwin22.0)

How MacVim was installed

homebrew

Logs and stack traces

-

Vim configuration where issue is reproducable

No response

Issue has been tested with given configuration

Issue has been tested with no configuration

Other conditions

eirnym commented 1 year ago

tested with my and clean (--clean) configuration (I have no <c-h> binded).

Entered manually following configuration :nmap <c-h> i

pressed <c-h> and mode has been changed to INSERT.

Same behavior in TUI and GUI. Few times pressed Cmd instead of Ctrl (obviously, cmd-h won't work).

@SirVer Could you confirm that minimal example I provided is working or not?

ychin commented 1 year ago

I'm also having some issues reproducing this. @SirVer here are some suggestions:

  1. Can you try to launch MacVim without the terminal by directly clicking on the app or something like open /Applications/MacVim.app? When you do :gui sometimes it can bring in some of the terminal emulator environment so it's useful to launch the GUI fresh to see if it reproduces.
  2. When the issue happens, you can do <C-V><Backspace> and <C-V><C-H> to see if Vim is indeed interpreting those keys as <BS> and ^H correctly.
  3. Launch Vim in --clean as @eirnym suggested for testing.

Some questions:

  1. What does set t_kb? in your terminal Vim report?
SirVer commented 1 year ago

I am very impressed with this very fast turnaround of replies. However, after a(nother) reboot, the problem seems to have disappeared. This is frustrating, since I spent at least a few hours trying to get to the bottom of it myself, but as long as its gone I should be satisfied.

I am going to close this, should it reappear I will post more information on this ticket. Thank you both again for your quick reaction looking into this!

SirVer commented 1 year ago

This problem has vanished entirely. I am not sure what changed. Thank you very much again!

ychin commented 1 year ago

FWIW I found some weirdness with MacVim after updating my stable build right after installation as well. The scrolling was quite stuttery and I thought I introduced a bug. But for some reason it went away, and I'm still not sure if it's a bug somewhere or an OS thing or whatnot. Oh well I can't reproduce now anyway.