prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.21k stars 715 forks source link

multi line command gets copied and pasted as several lines, not as one line #1475

Open jerabaul29 opened 3 years ago

jerabaul29 commented 3 years ago

This issue is opened here following the discussion taking place at https://github.com/xonsh/xonsh/issues/4348 .

Basically, it seems like, when copying a long line that is broken over several terminal "render lines", the result is obtained as if being several lines, and copied as several lines, instead of one. This is quite annoying when using, for example, Xonsh, as breaking a long line into two smaller lines confuses the python interpreter (and guess there are many more possible similar issues possible across user cases).

@anki-code @yaxollum , continuation of our previous discussion on the Xonsh issue.

jonathanslenders commented 3 years ago

@jerabaul29,

Thanks for reporting! I think this has been mentioned before, although I forgot which issue exactly. In any case, it's not obvious how to fix it due to the way the rendering engine works. Probably it can be done, but I haven't spend a lot of time thinking it through. The problem is that we never let the terminal "soft wrap" by itself. There's a chance that fixing this will cause other glitches, for instance when resizing the terminal, but I'm not sure.

msopko81 commented 3 years ago

This issue also affects the ipython shell. I downgraded to version 3.0.19.

paugier commented 2 years ago

This is really an annoying issue with xonsh (https://github.com/xonsh/xonsh/issues/4348#issuecomment-1058109736).

With bash, terminal resizing is not as good but at least copy-pasting in long lines works like a charm.