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

Windows 10 - CTRL + SHIFT + v pastes blank into WSL2 but fine if to Powershell #5368

Open
erfianugrah opened this issue May 4, 2024 · 0 comments
Labels
bug Something isn't working Windows Issue applies to Microsoft Windows

Comments

@erfianugrah
Copy link

erfianugrah commented May 4, 2024

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

wezterm 20240429-102818-0184e88e

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

Copy pasting issues. Happens with both Ditto and Windows Clipboard, when trying to paste into WSL2 from the system, clipboard creates a blank entry instead, so I need to delete that entry and force the initial entry to paste the actual values, but it'll paste with CRLF instead of LF, so I forced LF for now, but the blank pasting is still a problem. Also tried to disable win32 input just to see, but same thing

To Reproduce

Normal copy paste to reproduce

Configuration

-- Pull in the wezterm API
local wezterm = require("wezterm")

-- This will hold the configuration.
local config = wezterm.config_builder()
local gpus = wezterm.gui.enumerate_gpus()
local act = wezterm.action
-- Theme
config.color_scheme = "lovelace"

-- Window Size
config.initial_rows = 40
config.initial_cols = 160

-- Cursor
config.default_cursor_style = "BlinkingBar"

-- FPS
config.animation_fps = 120

-- GPU Acceleration
config.front_end = "WebGpu"
config.webgpu_preferred_adapter = gpus[1]

--Scrollback
config.scrollback_lines = 5000
config.debug_key_events = true

-- Windows
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
	-- Paste Action
	config.keys = {
		-- paste from the clipboard
		{ key = "V", mods = "CTRL", action = act.PasteFrom("Clipboard") },
		-- paste from the primary selection
		{ key = "V", mods = "CTRL", action = act.PasteFrom("PrimarySelection") },
		-- test
		{ key = "v", mods = "CTRL", action = act.Nop },
	}
	config.canonicalize_pasted_newlines = "LineFeed"
	config.allow_win32_input_mode = false

	-- GPU
	config.front_end = "WebGpu"
	config.webgpu_preferred_adapter = gpus[1]

	-- WSL
	config.default_domain = "WSL:Ubuntu"
	config.default_cwd = "/home/erfi"
	config.launch_menu = {
		{
			label = "PowerShell",
			domain = { DomainName = "local" },
			args = { "powershell.exe", "-NoLogo" },
		},
	}
end

-- Keybind for launch_menu
config.keys = {
	{ key = "l", mods = "ALT", action = wezterm.action.ShowLauncher },
}
-- Fonts
config.font = wezterm.font({ family = "IosevkaTerm NF", weight = "Regular" })
config.font_size = 11.5
config.line_height = 1

-- Window Close Prompt
config.window_close_confirmation = "NeverPrompt"

-- and finally, return the configuration to wezterm
return config

Expected Behavior

On MacOS and SteamDeck, the copy paste functionality is as intended, CTRL-C or CMD-C then CTRL-SHIFT-v/CMD-SHIFT-v just pastes the content

Logs

13:07:24.792 INFO wezterm_gui::termwindow::keyevent > win32: Encoded input as "\u{1b}[17;29;0;1;8;1_"
13:07:24.837 INFO wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftShift), modifiers: SHIFT | CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), phys_code: Some(LeftShift), raw_code: 16, scan_code: 42, repeat_count: 1, key_is_down: true, handled: Handled(false) }
13:07:24.837 INFO wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftShift, modifiers: SHIFT | CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftShift), modifiers: SHIFT | CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), phys_code: Some(LeftShift), raw_code: 16, scan_code: 42, repeat_count: 1, key_is_down: true, handled: Handled(false) }), win32_uni_char: Some('\0') }
13:07:24.837 INFO wezterm_gui::termwindow::keyevent > win32: Encoded input as "\u{1b}[16;42;0;1;24;1_"
13:07:25.054 INFO wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(L), modifiers: SHIFT | CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), phys_code: Some(L), raw_code: 76, scan_code: 38, repeat_count: 1, key_is_down: true, handled: Handled(false) }
13:07:25.055 INFO wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('L'), modifiers: CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(L), modifiers: SHIFT | CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), phys_code: Some(L), raw_code: 76, scan_code: 38, repeat_count: 1, key_is_down: true, handled: Handled(false) }), win32_uni_char: Some('\u{c}') }
13:07:25.055 INFO wezterm_gui::termwindow::keyevent > Char('L') CTRL | LEFT_CTRL | LEFT_SHIFT -> perform ShowDebugOverlay
13:07:25.136 INFO wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(L), modifiers: SHIFT | CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), phys_code: Some(L), raw_code: 76, scan_code: 38, repeat_count: 1, key_is_down: false, handled: Handled(false) }
13:07:25.136 INFO wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('L'), modifiers: CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(L), modifiers: SHIFT | CTRL | LEFT_CTRL | LEFT_SHIFT, leds: (empty), phys_code: Some(L), raw_code: 76, scan_code: 38, repeat_count: 1, key_is_down: false, handled: Handled(false) }), win32_uni_char: Some('\u{c}') }
13:07:25.136 INFO wezterm_gui::termwindow::keyevent > send to pane UP key=Char('L') mods=CTRL | LEFT_CTRL | LEFT_SHIFT

Anything else?

I digged a little more, and it seems to do with the usage of Tmux, however I have no clue as to why tmux would interfere, also it does interfere with wezterm settings like the cursor style, BlinkingBar for instance never persists once I got from terminal to editing things on nvim, then back out, it goes back to block. And this only seems reproducible for windows, Window Terminal has a different copy-paste shortcut, so it's just CTRL-V and that works with Tmux

set -as terminal-features ",xterm-256color:RGB"

# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'catppuccin/tmux'

# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on

# Set mouse and term colors
set -g mouse on
set -g default-terminal "screen-256color"
set -g prefix ^a
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'clip.exe'

# Run TPM
run '~/.tmux/plugins/tpm/tpm'

If relevant, here are my dotfiles: https://github.com/erfianugrah/dotfiles

@erfianugrah erfianugrah added the bug Something isn't working label May 4, 2024
@wez wez added the Windows Issue applies to Microsoft Windows label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows Issue applies to Microsoft Windows
Projects
None yet
Development

No branches or pull requests

2 participants