wez / wezterm

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

paste with middle button is very slow #585

Closed marryton007 closed 3 years ago

marryton007 commented 3 years ago

Describe the bug

I use wezterm connect to wsl2, when I want to copy something outside of wezterm, and paste it to wsl2 terminal by press middle button, it copy chars one bye one

Environment (please complete the following information):

To Reproduce

  1. Open browser or anything else and copy something to clipboard
  2. Open wezterm and connect to wsl in a new tab
  3. Press the middle button, paste to wsl terminal

Configuration

local wezterm = require 'wezterm';

local launch_menu = {}

if wezterm.target_triple == "x86_64-pc-windows-msvc" then
  table.insert(launch_menu, {
    label = "PowerShell",
    args = {"powershell.exe", "-NoLogo"},
  })

  -- Find installed visual studio version(s) and add their compilation
  -- environment command prompts to the menu
  for _, vsvers in ipairs(wezterm.glob("Microsoft Visual Studio/20*", "C:/Program Files (x86)")) do
    local year = vsvers:gsub("Microsoft Visual Studio/", "")
    table.insert(launch_menu, {
      label = "x64 Native Tools VS " .. year,
      args = {"cmd.exe", "/k", "C:/Program Files (x86)/" .. vsvers .. "/BuildTools/VC/Auxiliary/Build/vcvars64.bat"},
    })
  end

  -- Enumerate any WSL distributions that are installed and add those to the menu
  local success, wsl_list, wsl_err = wezterm.run_child_process({"wsl.exe", "-l"})
  -- `wsl.exe -l` has a bug where it always outputs utf16:
  -- https://github.com/microsoft/WSL/issues/4607
  -- So we get to convert it
  wsl_list = wezterm.utf16_to_utf8(wsl_list)

  for idx, line in ipairs(wezterm.split_by_newlines(wsl_list)) do
    -- Skip the first line of output; it's just a header
    if idx > 1 then
      -- Remove the "(Default)" marker from the default line to arrive
      -- at the distribution name on its own
      local distro = line:gsub(" %(默认%)", "")

      -- Add an entry that will spawn into the distro with the default shell
      table.insert(launch_menu, {
        label = distro .. " (WSL default shell)",
        args = {"wsl.exe", "--distribution", distro},
      })

      -- Here's how to jump directly into some other program; in this example
      -- its a shell that probably isn't the default, but it could also be
      -- any other program that you want to run in that environment
      -- table.insert(launch_menu, {
        -- label = distro .. " (WSL zsh login shell)",
        -- args = {"wsl.exe", "--distribution", distro, "--exec", "/bin/zsh", "-l"},
      -- })
    end
  end
end
return {
  font = wezterm.font_with_fallback({"JetBrains Mono","DengXian"}),
  color_scheme = "Blue Matrix",
  default_prog = {"D:\\programe\\powershell6\\7\\pwsh.EXE"},
  font_size = 14.0,
  term = "xterm-256color",
  scrollback_lines = 35000,
  add_wsl_distributions_to_launch_menu = false,
  -- window_background_image = "D:\\jiaxi\\.config\\wezterm\\wezbg.jpg",
  -- window_background_image_hsb = {
    -- -- Darken the background image by reducing it to 1/3rd
    -- brightness = 0.3,

    -- -- You can adjust the hue by scaling its value.
    -- -- a multiplier of 1.0 leaves the value unchanged.
    -- hue = 1.0,

    -- -- You can adjust the saturation also.
    -- saturation = 1.0,
  -- },
  launch_menu = launch_menu,
  window_close_confirmation = 'NeverPrompt'
}

Expected behavior

Finish it As soon as possible, the waiting time is too long.

Screenshots

Session Recording

Additional context

wez commented 3 years ago

I can't reproduce this, but I don't know if what I'm trying exactly matches what you're trying. wezterm sends pastes in chunks of ~1KB at a time, not a single character at a time. What application is active when you paste?

marryton007 commented 3 years ago

I have removed wsl2 from my computer, But I remember that running ubuntu 20.04 server edition inside wsl2, and outside wsl2, I copy some text from Google Chrome browser.

Maybe help.

wez commented 3 years ago

Let's close this for now; if someone runs into this again in the future, we can investigate it then!

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.