Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy-pastable line wrap #226

Closed
tigrawap opened this issue Jun 6, 2020 · 2 comments
Closed

Copy-pastable line wrap #226

tigrawap opened this issue Jun 6, 2020 · 2 comments
Assignees

Comments

@tigrawap
Copy link

tigrawap commented Jun 6, 2020

When splitting long line into several lines (and filling content cell by cell) it is not copy-paste friendly

There is always new line copy-pasted
Is there a way to actually line wrap when needed?

If not, directions on how/where to implement it in termbox itself are welcomes

@nsf
Copy link
Owner

nsf commented Jun 8, 2020

It's not possible in termbox. Just because of abstractions used. Termbox doesn't preserve info about lines of text as it's just an array of 2d cells. And I believe similar libs have a similar problem, but maybe I'm wrong about that.

Solution: avoid using terminals. Terminals suck.

@scrouthtv
Copy link
Collaborator

Sorry for the late answer, but let me get this right:
You want to be able to select a multi-line text but not the entire lines and you don't want the line breaks to be in the selection?
So this is your problem:
termselection

If you're still looking for a solution, here's something I hacked together:
clipboard

Here is the source file in case you're interested: clipboard.go.txt

This basically consists of three things:

  • Any mouse press is recorded and added to a selection rectangle.
  • The selection rectangle is highlighted in the inverted style.
  • When the user presses the enter key, that region is copied to the clipboard.

With this technique, you still cannot intercept C-Ins (although you can intercept C-S-c. Also, keep in mind that what I'm doing here is not a real terminal selection but just a highlighted area.

Let me know if this helped you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants