[GH-ISSUE #1062] pasting to the TextArea #770

Closed
opened 2026-03-04 01:07:37 +03:00 by kerem · 3 comments
Owner

Originally created by @GrailFinder on GitHub (Dec 16, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1062

Hello.
Pasting text to the TextArea has some unpleasant moments:

  • text is inserted by char (with delay);
  • formatting is broken (at least whitespaces are (\n \t));

video example (linux; xorg; neovim):
https://github.com/user-attachments/assets/7e498f8b-a739-422c-b3f0-553d8ef625bb

Is there a better way to paste?

Originally created by @GrailFinder on GitHub (Dec 16, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/1062 Hello. Pasting text to the `TextArea` has some unpleasant moments: - text is inserted by char (with delay); - formatting is broken (at least whitespaces are (\n \t)); video example (linux; xorg; neovim): https://github.com/user-attachments/assets/7e498f8b-a739-422c-b3f0-553d8ef625bb Is there a better way to paste?
kerem closed this issue 2026-03-04 01:07:37 +03:00
Author
Owner

@rivo commented on GitHub (Dec 16, 2024):

This is explicitly addressed in TextArea's documentation:

https://pkg.go.dev/github.com/rivo/tview#hdr-Navigation_and_Editing-TextArea

Note that using your terminal's / operating system's key bindings for copy+paste functionality may not have the expected effect as tview will not be able to handle these keys. Pasting text using your operating system's or terminal's own methods may be very slow as each character will be pasted individually. However, some terminals support pasting text blocks which is supported by the text area, see Application.EnablePaste for details.

<!-- gh-comment-id:2545952334 --> @rivo commented on GitHub (Dec 16, 2024): This is explicitly addressed in `TextArea`'s documentation: https://pkg.go.dev/github.com/rivo/tview#hdr-Navigation_and_Editing-TextArea > Note that using your terminal's / operating system's key bindings for copy+paste functionality may not have the expected effect as tview will not be able to handle these keys. Pasting text using your operating system's or terminal's own methods may be very slow as each character will be pasted individually. However, some terminals support pasting text blocks which is supported by the text area, see [Application.EnablePaste](https://pkg.go.dev/github.com/rivo/tview#Application.EnablePaste) for details.
Author
Owner

@ivoGanev commented on GitHub (Feb 16, 2025):

Application.EnablePaste doesn’t seem to work on a Windows terminal, so I was wondering if there can be anything else done about totally disabling paste in a TextArea. I was able to redirect the key bindings to use other keys for pasting, but I am worried about what kind of experience it is going to be for a user who is used to using the 'Ctrl+V' shortcut. I imagine they will assume the app has a terrible copy/paste experience and quit using it.

<!-- gh-comment-id:2661394306 --> @ivoGanev commented on GitHub (Feb 16, 2025): `Application.EnablePaste` doesn’t seem to work on a Windows terminal, so I was wondering if there can be anything else done about totally disabling paste in a TextArea. I was able to redirect the key bindings to use other keys for pasting, but I am worried about what kind of experience it is going to be for a user who is used to using the 'Ctrl+V' shortcut. I imagine they will assume the app has a terrible copy/paste experience and quit using it.
Author
Owner

@rivo commented on GitHub (Feb 16, 2025):

I don't think there is a way to change the settings of a terminal application from within. At least I'm not aware of one.

<!-- gh-comment-id:2661451041 --> @rivo commented on GitHub (Feb 16, 2025): I don't think there is a way to change the settings of a terminal application from within. At least I'm not aware of one.
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#770
No description provided.