wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.28k stars 781 forks source link

CTRL-6 doesn't emit the same keypress as CTRL-SHIFT-6 #236

Closed krishnakumarg1984 closed 4 years ago

krishnakumarg1984 commented 4 years ago

Description

In vim normal mode, C-^ key combination incorrectly enters the visual-block mode. This is incorrect behaviour. visual block mode is to be entered only upon C-v, whereas C-^ is meant to switch to alternate buffer.

Environment

To Reproduce

  1. start vim with all plugins disabled and no rc files, vim -u NONE
  2. Now do :set hidden
  3. Open two files, say file1 and file2 from disk. :e file1 followed by :e file2.
  4. Edit file2 for a bit.
  5. Ensure that we are in normal mode by pressing esc or C-[.
  6. Now press C-^
  7. vim unexpectedly enters visual block mode!

Configuration

Wezterm was started with the default configuration (wezterm -n), and hence not relevant.

Expected behavior

The vim buffer shall switch to the alternate file, in the above case file 2.

wez commented 4 years ago

Please compare the raw key output in wezterm vs. your iterm configuration:

Share the output; on my linux system in both xterm and wezterm I get 1e0a. On my macOS system in both iterm and wezterm I also get 1e0a

In all four of those environments, that key press toggles the alternate buffer in vim.

I cannot reproduce the behavior that you've described, so this sounds like a local configuration issue.

krishnakumarg1984 commented 4 years ago

Well. This is what I got for the xxd string.

^M00000000: 0d0a

Weirdly, there are two additional observations.

  1. Pressing return/enter causes a ^M to appear
  2. I had to press C-d twice to terminate xxd.
krishnakumarg1984 commented 4 years ago

Okay, I found something. iterm2 by default provides the following i.e. I am not doing anything specific to get everything working as expected in iterm2. The default settings of iterm2 send the correct keystrokes already. Have a look at C-^ keycode in the screenshot of the default iterm settings shown below.

Screenshot 2020-06-29 at 03 03 49
krishnakumarg1984 commented 4 years ago

@wez any thoughts?

wez commented 4 years ago

Are you pressing CTRL-6 or CTRL+SHIFT+6?

wez commented 4 years ago

Closing due to lack of feedback

krishnakumarg1984 commented 3 years ago

@wez can you please reopen and look into this issue? I have exactly the same issue on my linux workstation as well. Pressing CTRL + 6 just makes vim go into visual block mode (which is incorrect). Just like macOS, I need to force the alternate buffer action using CTRL + SHIFT + 6

wez commented 3 years ago

CTRL 6 is not the same thing as CTRL SHIFT 6. They send different sequences.

iTerm treating those the same is not a behavior that I plan to emulate; it's the only terminal I've tried that does that, and the behavior is ambiguous.

If you want your particular wezterm to treat CTRL 6 as CTRL SHIFT 6 then you can configure a key assignment for that key press to mirror the configuration you see in your iterm settings screenshot.

local wezterm = require 'wezterm';

return {
  keys = {
    {key="6", mods="CTRL", action=wezterm.action{SendString="\x1e"}},
  }
}
krishnakumarg1984 commented 3 years ago

@wez My wording in the previous comment was not clear, which I think led to your incorrect understanding.

Hope I made it clear that there exists a bug in wezterm wherein Ctrl + 6 is not working correctly. This has nothing to do with iterm.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.