mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #557] TextView.SetText() doesn't seem to clear existing text #408
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#408
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @farzadmf on GitHub (Jan 27, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/557
Hi,
First of all, thank you for this cool package you created.
I had a question about
SetText()in aTextView; this is a minimal sample I have:If I press

1, the text is displayed in the text field:And then if I press

2, the shorter text is displayed, but the text is not replaced:You see that only
something long onis replaced bysomething shorter, and the rest of the text stays there!Is there something that I need to do that I'm not?
Thank you
@farzadmf commented on GitHub (Jan 28, 2021):
Seems like the issue here is the line where I set
PrimitiveBackgroundColorto beColorDefault. For some reason, the default background color whentviewcreates an app is a very bright grey (at least for my eyes 🙂 ), so I researched and saw the line as a solution.But from what I understand, it basically sets the background to be transparent, which creates the illusion that things are not being "cleaned up" visually.
Closing this since I found the solution.
@rivo commented on GitHub (Jan 28, 2021):
Thanks for the update. You can search for
ColorDefaultin the issues and you'll find a few conversations around the same topic. Indeed,ColorDefaultmeans "transparent". There is currently no way to use the custom colours of your terminal so you'll have to decide on specific colours. (There are also issues about this topic.)@farzadmf commented on GitHub (Jan 28, 2021):
@rivo thank you for replying to a closed issue 🙂
My go-to terminal UI framework was termui, but I wanted to also try
tviewsince it looks very promising 👍termuiseems to pick up the default terminal colors by default, so maybe the same can be done here. I think the difference is that they're based ontermbox-go, but maybe the general idea can be applied here too.Of course, I'm just speculating and I may be totally saying BS 😁
@rivo commented on GitHub (Jan 28, 2021):
This has been discussed before. Check out gdamore/tcell#292.
tviewis based ontcellso I'm dependent on whatever is possible there.@farzadmf commented on GitHub (Jan 28, 2021):
Yup, that's why I said I'm speculating since the two libraries use different underlying "frameworks".
Just one question actually: what setting controls the highlight colors? I looked at
tview.Styles, and I don't see a mention of "highlight" there, is it controlled by one of the "contrast background" ones?Also, while I have you here ;), was wondering about scrollbar support (at least displaying it), I see #396 being open, but it's almost 1 year old.
@rivo commented on GitHub (Jan 28, 2021):
I'm not sure I understand what you mean by "highlight colors". If you're referring to something like a selected item in
List, that object has its own parameters that control the colour and they're set in the constructor to something likeStyles.PrimitiveBackgroundColor.I know there are some items that have been open for a long time. I'd love to work on new features like that. Unfortunately, the little time I have to work on
tviewis spent dealing with all the new issues, which are mostly smaller additions to the package or reproducing bug reports. And those "smaller" additions often turn out to be larger efforts (e.g. anything with Unicode is usually a major undertaking).I'm trying to find ways to make more time for
tviewso hopefully by then, I'll be able to get to some of the features that have stuck around for a long time.@farzadmf commented on GitHub (Jan 28, 2021):
Thank you for the explanation.
And that's great to hear you're planning to put more time. Just to clarify, the things I said don't change the fact that you already have created an awesome framework. Kudos to you for that.