Paste swallows newlines from the web... Gitlab #7933

Closed
opened 2026-01-31 01:16:10 +00:00 by claunia · 9 comments
Owner

Originally created by @FossPrime on GitHub (May 4, 2020).

I'm pasting some code from gitlab, but the new lines are missing... ending up is a garbled mess.... what's going on?

When I paste from the notepad, everything works as expected

Reproduction:

  1. Go to: https://gitlab.com/olaris/ffmpeg-static/-/blob/master/build.sh
  2. Copy the first 10 lines, in view or edit mode
  3. paste into nano

Watch a garbled mess

Originally created by @FossPrime on GitHub (May 4, 2020). I'm pasting some code from gitlab, but the new lines are missing... ending up is a garbled mess.... what's going on? When I paste from the notepad, everything works as expected Reproduction: 1. Go to: https://gitlab.com/olaris/ffmpeg-static/-/blob/master/build.sh 2. Copy the first 10 lines, in view or edit mode 3. paste into nano Watch a garbled mess
claunia added the Resolution-Duplicate label 2026-01-31 01:16:10 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 4, 2020):

What version of the Terminal are you running?

What application are you running in the Terminal that you're trying to paste into?

Could you share some screenshots perhaps?

@zadjii-msft commented on GitHub (May 4, 2020): What version of the Terminal are you running? What application are you running in the Terminal that you're trying to paste into? Could you share some screenshots perhaps?
Author
Owner

@DHowett-MSFT commented on GitHub (May 4, 2020):

In addition, do you mean “when I paste it into notepad and then copy it again and paste it into Terminal”?

I’ve never had good luck pasting content directly from GitHub or GitLab.

@DHowett-MSFT commented on GitHub (May 4, 2020): In addition, do you mean “when I paste it into notepad and then copy it again and paste it into Terminal”? I’ve never had good luck pasting content directly from GitHub or GitLab.
Author
Owner

@DHowett-MSFT commented on GitHub (May 4, 2020):

(In any application.)

@DHowett-MSFT commented on GitHub (May 4, 2020): (In any application.)
Author
Owner

@FossPrime commented on GitHub (May 4, 2020):

Updated my reproduction in original post... I'm used to it working pretty well under Ubuntu/mac/Fedora. with iTerm, Gnome terminal and Terminator. Looks like a workaround is to show the raw file.

@FossPrime commented on GitHub (May 4, 2020): Updated my reproduction in original post... I'm used to it working pretty well under Ubuntu/mac/Fedora. with iTerm, Gnome terminal and Terminator. Looks like a workaround is to show the raw file.
Author
Owner

@DHowett-MSFT commented on GitHub (May 4, 2020):

So, I copied this from here:

image

to here...

image

So I've got to ask for more info: what version of nano? are you using WSL? gow? cygwin?

@DHowett-MSFT commented on GitHub (May 4, 2020): So, I copied this from here: ![image](https://user-images.githubusercontent.com/14316954/80993438-e9f3f180-8def-11ea-96b7-b13a083b7026.png) to here... ![image](https://user-images.githubusercontent.com/14316954/80993411-e06a8980-8def-11ea-8c62-25f71cb94288.png) So I've got to ask for more info: _what version of nano?_ _are you using WSL? gow? cygwin?_
Author
Owner

@FossPrime commented on GitHub (May 4, 2020):

WSL Debian, I don't recall ever using terminal for any other shell. Not sure how WSL works, but Ubuntu 20.04 and Debian should be near identical, as 20.04 is an LTS release which are based on the latest Debian distro release... main difference being the GUI, which WSL lacks anyway

@FossPrime commented on GitHub (May 4, 2020): WSL Debian, I don't recall ever using terminal for any other shell. Not sure how WSL works, but Ubuntu 20.04 and Debian should be near identical, as 20.04 is an LTS release which are based on the latest Debian distro release... main difference being the GUI, which WSL lacks anyway
Author
Owner

@DHowett-MSFT commented on GitHub (May 5, 2020):

Okay, this one doesn't have a great resolution. When we take text off the clipboard, we replace \r\n with \r. This is correct (and this is how a bunch of other terminal emulators do paste manipulation as well.)

There's an additional wrinkle, though.

nano interprets \r as the [J]ustify (^J) command.

It looks like this works on other terminals because nano also requests "bracketed paste" mode. When bracketed paste is supported, it can know that content is coming in off the clipboard and suppress the justify action.

This'll be a /dupe of #395 with a little bit of nano flair thrown in.

@DHowett-MSFT commented on GitHub (May 5, 2020): Okay, this one doesn't have a great resolution. When we take text off the clipboard, we replace `\r\n` with `\r`. This is correct (and this is how a bunch of other terminal emulators do paste manipulation as well.) There's an additional wrinkle, though. _nano interprets `\r` as the **[J]ustify (^J)** command._ It looks like this works on other terminals because nano also requests "bracketed paste" mode. When bracketed paste is supported, it can know that content is coming in off the clipboard and suppress the justify action. This'll be a /dupe of #395 with a little bit of nano flair thrown in.
Author
Owner

@ghost commented on GitHub (May 5, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (May 5, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@ghost commented on GitHub (May 5, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (May 5, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7933