wez / wezterm

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

Copypaste mangling in nano #998

Closed EvelynSubarrow closed 3 years ago

EvelynSubarrow commented 3 years ago

If you try to copy and paste multiple lines within the terminal, you'll find that the lines end up between each other in ways which aren't very helpful. It's possible that this is intended functionality and this is an enhancement ticket, I drew a blank when searching the documentation for this anyway.

Environment (please complete the following information):

To Reproduce

Open two instances of wezterm, with nano open in both, and the contents of two files as follows:

File A:

#!/usr/bin/env python3
if __name__=="__main__":

    fizzbuzz = lambda x: "Fizz"*(x and not x%3)+"Buzz"*(x and not x%5) or str(x)
    print([fizzbuzz(n) for n in range(16)])

File B:

We're no strangers to love
You know the rules, and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy

Select the text in file B with the mouse cursor, from the first to the final character, copy the text using the set keyboard shortcut, switch to file A, put the terminal cursor on the blank line, and paste. You'll end up with something like:

#!/usr/bin/env python3
if __name__=="__main__": We're no strangers to love You know the rules, and so do I fizzbuzz = lambda x: "Fizz"*(x and not
x%3)+"Buzz"*(x and not x%5) or str(x) A full commitment's what I'm thinking of print([fizzbuzz(n) for n in range(16)])
You wouldn't get this from any other guy

Configuration

local wezterm = require 'wezterm';
return {
    color_scheme = "Builtin Tango Dark",
    hide_tab_bar_if_only_one_tab = true,
    font = wezterm.font_with_fallback({
        "JetBrains Mono", "Twemoji Mozilla"
    }),
}

Expected behaviour

The text should be intact when pasted, similar to some other terminals. If there's a good reason this behaviour should not be a default, it could be configurable

wez commented 3 years ago

What version of nano are you using?

wez commented 3 years ago

Relevant background information; nano has historically had problems with paste: https://savannah.gnu.org/bugs/?49176 Nano 4.8 includes support for bracketed paste which should help alleviate those problems (https://savannah.gnu.org/bugs/?40060)

EvelynSubarrow commented 3 years ago

aha, I hadn't considered it might be nano, I'm quite far pre-4.8, I'll see if upgrading resolves this

EvelynSubarrow commented 3 years ago

Tested with my shiny new copy of nano, and can confirm that resolves it, thank you for the pointer!

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.