wez / wezterm

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

Copy on selection across multiple words does not work #6285

Closed liberiulx closed 4 weeks ago

liberiulx commented 1 month ago

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

Linux X11

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

X.Org X Server 1.20.14 X Protocol Version 11, Revision 0 Build Operating System: 6.7.11-200.fc39.x86_64 Current Operating System: Linux bmfdr 6.10.12-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Sep 30 21:38:25 UTC 2024 x86_64

WezTerm version

20240922-151228-2b76c63b

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

When selecting across multiple words with mouse, the selected words cannot be copied automatically to clipboard, like below:

image

It works well while double-clicking on single word, though.

To Reproduce

No response

Configuration

-- Pull in the wezterm API local wezterm = require 'wezterm'

local act = wezterm.action -- This will hold the configuration. local config = wezterm.config_builder() -- local config = {}

wezterm.on('gui-startup', function(cmd) local tab, pane, window = wezterm.mux.spawn_window(cmd or {}) window:gui_window():maximize() end)

-- This is where you actually apply your config choices config = { color_scheme = "Abernathy", selection_word_boundary = ",: \t\n{[}]()\"'", enable_scroll_bar = true, pane_focus_follows_mouse = true, use_fancy_tab_bar = true, --hide_tab_bar_if_only_one_tab = true, -- enable_tab_bar = false, window_decorations = "NONE", -- window_background_opacity = 0.9, window_background_image = '/usr/share/backgrounds/f40/default/f40-01-night.png', text_background_opacity = 0.1, window_frame = { active_titlebar_bg = "rgba(0 0 0 0)", }, -- background = { -- { -- source = { -- Color = "#282c35", -- }, -- opacity = 0.55 -- } -- }, window_padding = { left = 0, right = 0, top = 0, bottom = 0, }, mouse_bindings = { -- Righ click to paste { event = { Down = { streak = 1, button = "Right" } }, mods = "NONE", action = wezterm.action_callback(function(window, pane) window:get_selection_text_for_pane(pane) window:perform_action(act({ PasteFrom = "Clipboard" }), pane) end), }, -- Disable the default click behavior { event = { Up = { streak = 1, button = "Left"} }, mods = "NONE", action = wezterm.action.DisableDefaultAssignment, }, -- Ctrl-click will open the link under the mouse cursor { event = { Up = { streak = 1, button = "Left" } }, mods = "CTRL", action = wezterm.action.OpenLinkAtMouseCursor, }, -- Disable the Ctrl-click down event to stop programs from seeing it when a URL is clicked { event = { Down = { streak = 1, button = "Left" } }, mods = "CTRL", action = wezterm.action.Nop, }, }, keys = { { key = "q", mods = "ALT", action = wezterm.action_callback(function(window, pane) window:perform_action(wezterm.action.ActivateTabRelative(-1), pane) end), }, { key = "w", mods = "ALT", action = wezterm.action_callback(function(window, pane) window:perform_action(wezterm.action.ActivateTabRelative(1), pane) end), }, { key = "h", mods = "ALT", action = wezterm.action_callback(function(window, pane) local tab = window:mux_window():active_tab() if tab:get_pane_direction("Left") ~= nil then window:perform_action(wezterm.action.ActivatePaneDirection("Left"), pane) else window:perform_action(wezterm.action.ActivateTabRelative(-1), pane) end end), }, { key = "Insert", mods = "SHIFT", action = act.PasteFrom("Clipboard") }, { key = "j", mods = "ALT", action = wezterm.action.ActivatePaneDirection("Down") }, { key = "k", mods = "ALT", action = wezterm.action.ActivatePaneDirection("Up") }, { key = "l", mods = "ALT", action = wezterm.action_callback(function(window, pane) local tab = window:mux_window():active_tab() if tab:get_pane_direction("Right") ~= nil then window:perform_action(wezterm.action.ActivatePaneDirection("Right"), pane) else window:perform_action(wezterm.action.ActivateTabRelative(1), pane) end end) } } }

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

Expected Behavior

No response

Logs

No response

Anything else?

No response

bew commented 1 month ago

Can you try while pressing the Shift key?

liberiulx commented 1 month ago

Select while pressing the Shift key does work.

bew commented 1 month ago

When that happens is because the current terminal application is capturing mouse events (to place the cursor, or resize/scroll windows/...) Neovim does that automatically, see :h mouse for more info.

And in Wezterm, you can bypass the this capture with Shift by default. You can configure this using bypass_mouse_reporting_modifiers config

liberiulx commented 4 weeks ago

Thank you all for the info.