New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANSIWriter doesn't support SGR 2;37;0m #320
Comments
This sequence is turned into |
Thank you for your reply! Sorry rivo, I have some problems with this GitHub account, I re-describe this issue with another account( |
In my environment, In other environments I have used, like In fact, As can be seen from the above figure, the background color of the character on the right side of the portrait is contaminated. And below is the expected effect: In fact, in order to get the above effect, I not only processed |
In order to figure out what happened when
According to the above point of view, most of the code in
|
In your example, here is the part that I don't understand:
You have a black background. Why would you see any text if its foreground colour is also set to "black"? It should be invisible, shouldn't it? Are you sure this is a And in fact, |
Thank you for your reply. I took a vacation last week and I didn't see your reply in time. I understand what you mean. But in fact I have observed several popular terminal emulators, such as iTerm2 and Terminal.app, which both render bold black to gray. So although I can't find the basis for doing so (except for one Chinese page on zh.wikipedia.org), I believe they do justifiably. |
So I'm not sure if this was different before. But this sequence appears to be displayed correctly. Check this out: package main
import (
"github.com/rivo/tview"
)
func main() {
box := tview.NewBox().
SetTitle(tview.TranslateANSI("\x1b[1;30;40mbold black")).
SetBorder(true)
if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil {
panic(err)
}
} This is what it looks like in iTerm: If you have some (brief) code that illustrates how it doesn't work in your case, please post it here. |
You are right, I really should reproduce my problem with shorter code. I will give some other examples below. All examples are based on the latest tview code. I wrote a piece of code to display my test case in the TextView. package main
import (
"io"
"os"
"github.com/rivo/tview"
)
func main() {
textView := tview.NewTextView()
textView.SetBorder(true)
textView.SetTitle(" tview.TextView ")
textView.SetDynamicColors(true)
colorView := tview.ANSIWriter(textView)
file, _ := os.Open("color-test.txt")
io.Copy(colorView, file)
if err := tview.NewApplication().SetRoot(textView, true).Run(); err != nil {
panic(err)
}
} And here is my test cases (all
Then I tested with iTerm2, Terminal.app and tview respectively, the effect is as follows: (iTerm2, without tmux/screen, TERM=xterm-256color, zsh 5.6.2, all the blinks are correct) (Terminal.app, without tmux/screen, TERM=xterm-256color, zsh 5.6.2, all the blinks are correct) (rivo/tview@master, commit ID=f8bc69b, iTerm2 and Terminal.app have the same effect) I also wrote a patch that can display correctly(all the blinks are correct): |
* SGR code 21/22/23/24/25/27 should not turn off all attributes. * turn on/off one of bold/dim/underline/blink should not turn off other attributes. This should fix rivo#320
* SGR code 21/22/23/24/25/27 should not turn off all attributes. * turn on/off one of bold/dim/underline/blink should not turn off other attributes. This should fix rivo#320
The patch above is a phased result of my recent research on this issue. Since I don't know enough about tview, there may still be a lot of deficiencies, you can talk to me. I hope this patch can help you solve this problem. |
I haven't had time yet to look at the details of your patch. But I've tried your code example. The "bold black" examples look the same directly in the terminal as well as in the application. The blinks also do. I tried iTerm2 and Terminal. There were differences in how these two terminal apps render the codes, though. Terminal actually renders "bold black" as black. You can hardly see it. And iTerm2 doesn't show blinking text but that's just my setting. Here's an example for iTerm2: Direct: tview: There are some differences, though. Some of them are due to But the partial attribute reset is actually a bug which I need to fix. I hope to be able to resolve this soon. |
* SGR code 21/22/23/24/25/27 should not turn off all attributes. * turn on/off one of bold/dim/underline/blink should not turn off other attributes. This should fix rivo#320
* SGR code 21/22/23/24/25/27 should not turn off all attributes. * turn on/off one of bold/dim/underline/blink should not turn off other attributes. This should fix rivo#320
Sorry it took so long. I believe the latest commit fixes these issues. Your test file looks like it's supposed to in |
ANSIWriter
doesn't support SGRESC [2;37;0m
. This is a very popular sequence (sorry for can't give the standard which it follows).The text was updated successfully, but these errors were encountered: