[GH-ISSUE #312] Clear previously-drawn text on screen. #236

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

Originally created by @iwasaki-kenta on GitHub (Jun 17, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/312

I noticed using a scrollable TextView that scrolled-over text is not cleared off of the screen once text I have written to the TextView exceeds the scrollable area.

image

Is there any way to forcefully clear the screen before drawing new text?

The view in particular is set to have a default color background.

view := tview.NewTextView()
view.SetBackgroundColor(tcell.ColorDefault)
Originally created by @iwasaki-kenta on GitHub (Jun 17, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/312 I noticed using a scrollable TextView that scrolled-over text is not cleared off of the screen once text I have written to the TextView exceeds the scrollable area. ![image](https://user-images.githubusercontent.com/8392982/59606238-30dae900-9143-11e9-968e-fa0949430d03.png) Is there any way to forcefully clear the screen before drawing new text? The view in particular is set to have a default color background. ```go view := tview.NewTextView() view.SetBackgroundColor(tcell.ColorDefault) ```
kerem closed this issue 2026-03-04 01:03:13 +03:00
Author
Owner

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

@iwasaki-kenta
This seems related with #270
I think tview has problem when BackgroundColor to set tcell.ColorDefault.

<!-- gh-comment-id:502905090 --> @eu81273 commented on GitHub (Jun 18, 2019): @iwasaki-kenta This seems related with #270 I think tview has problem when BackgroundColor to set tcell.ColorDefault.
Author
Owner

@iwasaki-kenta commented on GitHub (Jun 18, 2019):

@iwasaki-kenta
This seems related with #270
I think tview has problem when BackgroundColor to set tcell.ColorDefault.

That worked well, thanks 😄. Clearing the entire screen buffer is pretty expensive though; would be good for tview to perhaps manually clear tcell views where the background is tcell.ColorDefault?

<!-- gh-comment-id:502951808 --> @iwasaki-kenta commented on GitHub (Jun 18, 2019): > @iwasaki-kenta > This seems related with #270 > I think tview has problem when BackgroundColor to set tcell.ColorDefault. That worked well, thanks :smile:. Clearing the entire screen buffer is pretty expensive though; would be good for tview to perhaps manually clear tcell views where the background is `tcell.ColorDefault`?
Author
Owner

@rivo commented on GitHub (Jul 10, 2019):

@eu81273 is right. This is `tcell.ColorDefault´'s description:

ColorDefault is used to leave the Color unchanged from whatever system or teminal default may exist.

I don't see why clearing the screen buffer should be very expensive. It's just a virtual buffer and the real bottleneck is more likely in sending the characters to the terminal. But my understanding is that tcell optimizes for that, thus we have a lot of freedom to do with the buffer what we want.

<!-- gh-comment-id:510025736 --> @rivo commented on GitHub (Jul 10, 2019): @eu81273 is right. This is `tcell.ColorDefault´'s description: > ColorDefault is used to leave the Color unchanged from whatever system or teminal default may exist. I don't see why clearing the screen buffer should be very expensive. It's just a virtual buffer and the real bottleneck is more likely in sending the characters to the terminal. But my understanding is that `tcell` optimizes for that, thus we have a lot of freedom to do with the buffer what we want.
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#236
No description provided.