toolong icon indicating copy to clipboard operation
toolong copied to clipboard

Added copy (yank) function

Open anorm opened this issue 1 year ago • 5 comments

Using the pyperclip library, I've added copying of the currently selected line in pointer mode to the system clipboard.

anorm avatar Oct 25 '24 16:10 anorm

https://textual.textualize.io/api/app/#textual.app.App.copy_to_clipboard

willmcgugan avatar Oct 25 '24 16:10 willmcgugan

Oops, didn't see that one. Not used Textual before 😃

However, this note in the documentation makes this a non-option for me:

This does not work on macOS Terminal, but will work on most other terminals.

anorm avatar Oct 25 '24 16:10 anorm

The macOS terminal hasn't been updated in many years. You get a far better experience from iTerm2 or other third party terminal.

Pyperclip won't work over shh, AFAIK, so I couldn't accept that I'm afraid.

willmcgugan avatar Oct 25 '24 16:10 willmcgugan

Ah, right. I am using iTerm2 but I read the note as "any terminal on MacOS". My bad.

I will update the PR

anorm avatar Oct 25 '24 16:10 anorm

I've updated the PR branch now.

Ideally, the copy function should be complemented by a multi-line select as I wrote in the comment on #23

I would like to extend the request to copying multiple lines at once. I currently have a stack trace of ~30 lines with several lines wider than my terminal can display. So, for me, copying individual lines is tedious.

Hence, I propose to allow a range of lines to be selected in pointer mode, and a key to copy to the system clipboard. (Similar to the following in vim: Vjjj then "+y)

anorm avatar Oct 25 '24 17:10 anorm