edit icon indicating copy to clipboard operation
edit copied to clipboard

Copy & Paste misses terminal line break

Open bersbersbers opened this issue 6 months ago • 9 comments

  • Open edit
  • Type 1
  • Press Return
  • Ctrl-A
  • Ctrl-C
  • Ctrl-V a few times

Ctrl-V should add a new line every time, but instead appends to the first line.

bersbersbers avatar May 26 '25 08:05 bersbersbers

This issue has been fixed recently and you can try it in the next release.

Ride-A-Pig avatar May 26 '25 08:05 Ride-A-Pig

I have not fixed any such issues, to my knowledge.

What I believe is happening here is that your terminal is stripping the newline from the end of the copied contents. Can you try to use the "Edit" menu for copy and paste? That will use the application's internal clipboard and will circumvent the terminal.

lhecker avatar May 26 '25 15:05 lhecker

Can you try to use the "Edit" menu for copy and paste? That will use the application's internal clipboard and will circumvent the terminal.

Yes, this is working fine.

Essentially,

  • Ctrl+C works.
  • Edit - Paste works.
  • Ctrl+V has the bug.

bersbersbers avatar May 26 '25 17:05 bersbersbers

What terminal are you using?

lhecker avatar May 26 '25 17:05 lhecker

What terminal are you using?

Windows Terminal Version: 1.22.11141.0 on Windows 11 24H2 (26100.4061)

bersbersbers avatar May 26 '25 18:05 bersbersbers

I have not fixed any such issues, to my knowledge.

What I believe is happening here is that your terminal is stripping the newline from the end of the copied contents. Can you try to use the "Edit" menu for copy and paste? That will use the application's internal clipboard and will circumvent the terminal.

My bad, it works fine on the vscode's powershell terminal, but doesn't work on the standalone terminal

Ride-A-Pig avatar May 27 '25 03:05 Ride-A-Pig

@lhecker

Hi Everyone 👋, I am new to Rust and Rust tools so I didn't analysed on a deeper level but I observed few things:

Observation 1: If I put extra empty lines before the sample that was provided in the comments eg:



1

And now I do CTRL+C, CTRL+V ==> It works as expected.

Observation 2: When doing CTRL+V, it does not hit the key match tui.rs for CTRL+V (line 2668), rather it hits handle_bracketed_paste in input.rs. It should hit the same method as found in the dropdown menu, at least that's what my assumption is. Powershell might be translating the CTRL+V to an escaped paste?

Context:

Terminal: Windows PowerShell 7.5.1

amritpandey23 avatar May 29 '25 17:05 amritpandey23

Powershell might be translating the CTRL+V to an escaped paste?

This is definitely what's happening. Your terminal emulator is catching Ctrl+V before it goes into the app.

You can probably change that setting if you need to debug ^V behavior.

DHowett avatar May 29 '25 18:05 DHowett

I'm on Windows 11 (24H2) and I can confirm that this behavior is due to a setting in the Windows terminal. You can change this behavior here:

Image

Image

I turned off the "Remove trailing white-space when pasting", and now the CTRL+V is working as expected.

maxgit2 avatar Jun 19 '25 19:06 maxgit2