[GH-ISSUE #307] textview selecting wrapped text copies with newline #232

Closed
opened 2026-03-04 01:03:11 +03:00 by kerem · 1 comment
Owner

Originally created by @rsbondi on GitHub (Jun 14, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/307

If I have a long line that wraps to 2 lines, and I select with the mouse it pastes with the line up to the wrap, new line/carriage return, then the wrapped text

ex

text_in_view...RIGTH_OF_SCREENrest_of_line

it wraps like

text_in_view...RIGTH_OF_SCREEN
rest_of_line

which is as expected, but when I select and copy it copies as 2 lines, how can I preserve the single line when I copy?

I tried to find a way to capture the paste event(inputfield) and just strip the "\n"s, but I don't see Ctrl-shift-v in the key enumerations, can this be captured? Any other work around?

Originally created by @rsbondi on GitHub (Jun 14, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/307 If I have a long line that wraps to 2 lines, and I select with the mouse it pastes with the line up to the wrap, new line/carriage return, then the wrapped text ex ``` text_in_view...RIGTH_OF_SCREENrest_of_line ``` it wraps like ``` text_in_view...RIGTH_OF_SCREEN rest_of_line ``` which is as expected, but when I select and copy it copies as 2 lines, how can I preserve the single line when I copy? I tried to find a way to capture the paste event(inputfield) and just strip the "\n"s, but I don't see Ctrl-shift-v in the key enumerations, can this be captured? Any other work around?
kerem closed this issue 2026-03-04 01:03:11 +03:00
Author
Owner

@rivo commented on GitHub (Jun 18, 2019):

To my knowledge, copy+paste functionality with selections (especially with the mouse) is a matter of how your terminal program handles it. On a Mac (using iTerm2), for example, this is done with Cmd-C which cannot be captured by a tview program. Unless I misunderstand your question (in which case, please let me know), this cannot be influenced by the application.

You may be able to place text into the clipboard using some other library but I suppose it will be OS-dependent.

<!-- gh-comment-id:503021063 --> @rivo commented on GitHub (Jun 18, 2019): To my knowledge, copy+paste functionality with selections (especially with the mouse) is a matter of how your terminal program handles it. On a Mac (using iTerm2), for example, this is done with Cmd-C which cannot be captured by a `tview` program. Unless I misunderstand your question (in which case, please let me know), this cannot be influenced by the application. You may be able to place text into the clipboard using some other library but I suppose it will be OS-dependent.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#232
No description provided.