[GH-ISSUE #565] Display large texts #414

Closed
opened 2026-03-04 01:04:46 +03:00 by kerem · 2 comments
Owner

Originally created by @inmylo on GitHub (Feb 10, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/565

From the issues I see, that it is not recommended to use a textView to display large texts, especially with colors. For example: #451

Is there a fast & efficient way to display large texts? I could use terminal's native escape codes for colors.
There could be a way to simply display a scrollable text without any kind of parsing/processing, except mandatory things to not break a layout.

Originally created by @inmylo on GitHub (Feb 10, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/565 From the issues I see, that it is not recommended to use a `textView` to display large texts, especially with colors. For example: #451 Is there a fast & efficient way to display large texts? I could use terminal's native escape codes for colors. There could be a way to simply display a scrollable text without any kind of parsing/processing, except mandatory things to not break a layout.
kerem closed this issue 2026-03-04 01:04:46 +03:00
Author
Owner

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

#451 was just updated. Does this help you?

Using escape codes won't help speed things up. tview is built on top of tcell which uses a buffer for the characters to be displayed on screen. While escape codes are used by tcell in the last step to sync that buffer with the screen, tview cannot bypass that buffer. So TextView will always use color tags to achieve colorization, which means parsing them etc.

Maybe writing a more efficient parser and keeping a better internal data structure for texts can help. But that's a big project and therefore in the far future (if at all). There are requests to add an editable widget (basically a text editor). I suppose that if I tackle that, I'll use the opportunity to think about how to deal with large texts there. (Good text editors are big projects by themselves, though, so that's a big "if".)

<!-- gh-comment-id:780125474 --> @rivo commented on GitHub (Feb 16, 2021): #451 was just updated. Does this help you? Using escape codes won't help speed things up. `tview` is built on top of `tcell` which uses a buffer for the characters to be displayed on screen. While escape codes are used by `tcell` in the last step to sync that buffer with the screen, `tview` cannot bypass that buffer. So `TextView` will always use color tags to achieve colorization, which means parsing them etc. Maybe writing a more efficient parser and keeping a better internal data structure for texts can help. But that's a big project and therefore in the far future (if at all). There are requests to add an editable widget (basically a text editor). I suppose that if I tackle that, I'll use the opportunity to think about how to deal with large texts there. (Good text editors are big projects by themselves, though, so that's a big "if".)
Author
Owner

@inmylo commented on GitHub (Feb 21, 2021):

Looks better. At least RAM and CPU usage stays more or less the same

<!-- gh-comment-id:782865425 --> @inmylo commented on GitHub (Feb 21, 2021): Looks better. At least RAM and CPU usage stays more or less the same
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#414
No description provided.