chrisant996 / clink

Bash's powerful command line editing in cmd.exe
https://chrisant996.github.io/clink/
GNU General Public License v3.0
3.44k stars 135 forks source link

Problem: Copy and paste the command line (configuring Windows Terminal) #639

Closed zhefox closed 1 month ago

zhefox commented 1 month ago

When copying and pasting multiple command lines, line breaks cannot be automatically removed, resulting in only line by line when copying and pasting command lines in the terminal

chrisant996 commented 1 month ago

I don't understand the description.

Can you share more information, and a specific example?

Also, what terminal are you using? Are you sure this is a Clink issue, and not an issue with the terminal being used?

zhefox commented 1 month ago

okay,here are more information for this question,

such as QQ_1722321135363

if i copy "gflags.exe /p /enable "C:\Users\ben\Desktop\olds\scard.exe" /full" , It wraps because of the window width limit but if i copy in cmd with clink, It will be copied as a string with carriage return, as shown below gflags.exe /p /enable "C:\Users\ben\Desk top\olds\scard.exe" /full

In fact, it turned out to be a complete line of commands that could be executed

zhefox commented 1 month ago

Itself if you copy-paste in the original cmd then it would be normal, so I think it's a problem with clink

chrisant996 commented 1 month ago

You're using Windows Terminal, so unless you've deleted its CTRL-V binding, then Windows Terminal is handling the paste, not Clink.

Or have you deleted the default Windows Terminal key binding for CTRL-V to give Clink a chance to paste? If so, then what is clink.paste_crlf set to? Maybe you want ampersand?

I'm still not sure what's being described, though.

What are the specific steps for copying, and what are the specific steps for pasting? There are several different ways to do each, and the specific ways being used are important in order to be able to troubleshoot.

Is it an issue with how Copy is working? Exactly how are you copying the text? There are many different ways to copy text, and in order to troubleshoot, it's important to know exactly which way of copying is used.

Is it an issue with how Paste is working? Does pasting into Notepad work how you want? There are several ways to paste -- Windows Terminal, or conhost, or Clink could be doing the paste. It depends on specifically how you've configured the terminal and Clink. But by default, Paste is done by Windows Terminal, not by Clink.

zhefox commented 1 month ago

I've removed the ctrl+v of the terminal binding, but it still doesn't seem quite right

QQ_1722323277193 If I just use ctrl+c to copy the command line of the history that was successfully executed above and paste it, you can see that it wraps QQ_1722323307090 QQ_1722323554277 QQ_1722323569628 QQ_1722323654623

zhefox commented 1 month ago

I think I seem to have found a solution

zhefox commented 1 month ago

You're right, you need to unbind the ctrl-v binding that comes with the terminal, and then turn off some settings QQ_1722324034424

zhefox commented 1 month ago

Oh no, it seems like you just need to turn off the function of the rectangle selected above in the terminal settings, the others are not needed, it doesn't seem to be a problem with clink, I'm sorry

zhefox commented 1 month ago

There still seems to be some issues, if I use it on win10's cmd and don't have this option, he still seems to have this This doesn't seem to be a paste-in-question issue, it's the time ctrl+c is copied to the clipboard, and the line break is already there

chrisant996 commented 1 month ago

QQ_1722323654623

Clink settings are set with clink set, not with set.

zhefox commented 1 month ago

Ah, it's okay, it's still a problem with the terminal itself

chrisant996 commented 1 month ago

Right -- the difference was not Clink, the difference was Windows Terminal versus the legacy conhost terminal.