wez / wezterm

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

Pasting into nano strips newlines on macOS #1575

Closed ettoredn closed 2 years ago

ettoredn commented 2 years ago

Upon further tests it appears to manifest only inside nano.

Version: 20220101-133340-7edc5b5a Shell: zsh with latest oh-my-zsh and powerlevel10k

local wezterm = require 'wezterm';

return {
    audible_bell = "Disabled",
    initial_cols = 134,
    initial_rows = 30,
    enable_scroll_bar = true,
    scrollback_lines = 10000,
    -- debug_key_events = true,
    window_padding = {top = 0, bottom = 0, left = 4, right = 4},

    keys = {
        {key="k", mods="CMD", action=wezterm.action{ClearScrollback="ScrollbackAndViewport"}},
        {key="s", mods="CMD", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
        {key="s", mods="CMD|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
        {key="Enter", mods="CMD", action="ToggleFullScreen"},
        {key="l", mods="ALT", action="ShowLauncher"},
        {key="UpArrow", mods="SHIFT", action=wezterm.action{ScrollToPrompt=-1}},
        {key="DownArrow", mods="SHIFT", action=wezterm.action{ScrollToPrompt=1}},
        {key="LeftArrow", mods="CMD", action=wezterm.action{ActivatePaneDirection="Left"}},
        {key="RightArrow", mods="CMD", action=wezterm.action{ActivatePaneDirection="Right"}},
        {key="UpArrow", mods="CMD", action=wezterm.action{ActivatePaneDirection="Up"}},
        {key="DownArrow", mods="CMD", action=wezterm.action{ActivatePaneDirection="Down"}},
        {key="w", mods="CMD", action=wezterm.action{CloseCurrentPane={confirm=false}}},
        {key="w", mods="CMD|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}},
        {key="[", mods="CMD", action=wezterm.action{ActivateTabRelative=-1}},
        {key="]", mods="CMD", action=wezterm.action{ActivateTabRelative=1}},
    },

    color_scheme = "Builtin Tango Dark",

    font = wezterm.font("MesloLGS NF"), -- 13pt Line Gap S/M/L, Dotted Zero
    font_size = 13,

    inactive_pane_hsb = {
        saturation = 1.0,
        brightness = 0.85,
    },
}

https://user-images.githubusercontent.com/739903/150602570-2ebf7fde-0305-4c25-8fb0-425a4a60813b.mp4

Originally posted by @ettoredn in https://github.com/wez/wezterm/issues/1296#issuecomment-1018878626

wez commented 2 years ago

What version of nano are you using? https://github.com/wez/wezterm/issues/998 is a similar sounding issue that suggests that installing a newer version of nano may help.

ettoredn commented 2 years ago

macOS:

nano --version
 GNU nano version 2.0.6 (compiled 14:41:52, Apr 17 2020)
 Email: nano@nano-editor.org    Web: http://www.nano-editor.org/
 Compiled options: --disable-nls --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-utf8

remote Debian server via SSH:

nano --version
 GNU nano, version 3.2
 (C) 1999-2011, 2013-2018 Free Software Foundation, Inc.
 (C) 2014-2018 the contributors to nano
 Email: nano@nano-editor.org    Web: https://nano-editor.org/
 Compiled options: --disable-libmagic --disable-wrapping-as-root --enable-utf8

alpine:latest using local Docker on macOS does not manifest any issue:

 docker run -it alpine:latest
/ # nano --version
 GNU nano, version 5.9
 (C) 1999-2011, 2013-2021 Free Software Foundation, Inc.
 (C) 2014-2021 the contributors to nano
 Compiled options: --disable-libmagic --disable-nls --enable-utf8

Even if it works with the latest version of nano, I believe this should be fixed somehow because most people cannot easily update the servers they are managing (think old distros/setups). Before the latest update everything was working fine.

wez commented 2 years ago

Even if it works with the latest version of nano, I believe this should be fixed somehow because most people cannot easily update the servers they are managing (think old distros/setups).

That's fair: I've pushed some changes that allow for canonicalizing to CR characters and made that default behavior on non-Windows platforms. I'll need to evaluate this on Windows as well before figuring out what to do about that.

https://wezfurlong.org/wezterm/config/lua/config/canonicalize_pasted_newlines.html shows the available options in case the default still isn't quite right.

Before the latest update everything was working fine.

The canonicalization behavior hasn't changed in a very long time, so I wonder if there is an additional issue we need to run down here?

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.