[GH-ISSUE #320] ANSIWriter doesn't support SGR 2;37;0m #242

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

Originally created by @flw-cn on GitHub (Jul 2, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/320

ANSIWriter doesn't support SGR ESC [2;37;0m. This is a very popular sequence (sorry for can't give the standard which it follows).

Originally created by @flw-cn on GitHub (Jul 2, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/320 `ANSIWriter` doesn't support SGR `ESC [2;37;0m`. This is a very popular sequence (sorry for can't give the standard which it follows).
kerem closed this issue 2026-03-04 01:03:16 +03:00
Author
Owner

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

This sequence is turned into [white::d] which looks correct to me (2 = "faint (decreased intensity)", 37 = "foreground white"). I'm just not sure why the 0 is added as it is a reset code. Do you mean the fact that the background colour is not reset? Can you elaborate what you are expecting here?

<!-- gh-comment-id:510432838 --> @rivo commented on GitHub (Jul 11, 2019): This sequence is turned into `[white::d]` which looks correct to me (2 = "faint (decreased intensity)", 37 = "foreground white"). I'm just not sure why the `0` is added as it is a reset code. Do you mean the fact that the background colour is not reset? Can you elaborate what you are expecting here?
Author
Owner

@flw-cn commented on GitHub (Jul 14, 2019):

Thank you for your reply!

Sorry rivo, I have some problems with this GitHub account, I re-describe this issue with another account(dzpao <danzipao@gmail.com>), and another problem I just discovered. If possible, I am going to provide a patch.

<!-- gh-comment-id:511167069 --> @flw-cn commented on GitHub (Jul 14, 2019): Thank you for your reply! Sorry rivo, I have some problems with this GitHub account, I re-describe this issue with another account(`dzpao <danzipao@gmail.com>`), and another problem I just discovered. If possible, I am going to provide a patch.
Author
Owner

@dzpao commented on GitHub (Jul 14, 2019):

In my environment, ESC [2;37;0m resets the foreground and background color to normal color. I use iTerm2 on my MacBook. Here's what I see on my computer:

image

In other environments I have used, like putty/xshell, they have similar display effects.

In fact, tview does not reset the background color when rendering this code, causing some applications that rely on this code to display errors, like this:

image

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:

image

In fact, in order to get the above effect, I not only processed SGR 2;37;0m, but also modified a piece of code related to bold attribute. If I don't process that bold attribute, I actually see something like this:
(some of the text marked as bold black(SGR 1;30m) is invisible):

image

<!-- gh-comment-id:511179087 --> @dzpao commented on GitHub (Jul 14, 2019): In my environment, `ESC [2;37;0m` resets the foreground and background color to normal color. I use iTerm2 on my MacBook. Here's what I see on my computer: <img width="932" alt="image" src="https://user-images.githubusercontent.com/5546718/61178344-c459e980-a61d-11e9-8820-ce7c92d142e8.png"> In other environments I have used, like `putty/xshell`, they have similar display effects. In fact, `tview` does not reset the background color when rendering this code, causing some applications that rely on this code to display errors, like this: ![image](https://user-images.githubusercontent.com/52447680/61180308-fa5f9380-a646-11e9-9487-9af1e0a0dae1.png) 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**: ![image](https://user-images.githubusercontent.com/52447680/61180335-575b4980-a647-11e9-9644-1eb6494c0156.png) In fact, in order to get the above effect, I not only processed `SGR 2;37;0m`, but also modified a piece of code related to bold attribute. If I don't process that bold attribute, I actually see something like this: (some of the text marked as bold black(`SGR 1;30m`) is invisible): ![image](https://user-images.githubusercontent.com/52447680/61180444-f03e9480-a648-11e9-8e56-f79b008ec503.png)
Author
Owner

@dzpao commented on GitHub (Jul 14, 2019):

In order to figure out what happened when 2;37;0m, I carefully studied the ANSI code, especially the CSI/SGR related specifications (I mainly rely on google.com and Wikipedia, and www.vt100.net), and iTerm2+zsh did the experiment, and I finally came up with the following points:

  • All properties are composed of only one number, except 38/48
  • Any SGR attribute can appear with other attributes
  • Allows multiple attributes to be specified for text at once (such as blinking, bold, italic underlined, like this foo)
  • Multiple attributes do not care about the order between each other, that is to say there is no fixed format (although it is customary to properties; foreground color; background color order)
  • The final visual effect is determined by the combined values of all the attributes. If a conflict is encountered, the attribute that appears later overrides the attribute that previously conflicted with it.

According to the above point of view, most of the code in ansi.go about SGR processing needs to be modified. include:

  • SGR 1 should be able to highlight the foreground color, similar to the effect of SGR 90~97.
  • SGR 21~27 should be able to properly close the corresponding properties set previously.
  • SGR 38/48 should not terminate FieldLoop, and should not be considered to have any code behind them.
  • Added support for italics.
<!-- gh-comment-id:511184738 --> @dzpao commented on GitHub (Jul 14, 2019): In order to figure out what happened when `2;37;0m`, I carefully studied the ANSI code, especially the CSI/SGR related specifications (I mainly rely on google.com and Wikipedia, and www.vt100.net), and iTerm2+zsh did the experiment, and I finally came up with the following points: > * All properties are composed of only one number, except `38`/`48` > * Any SGR attribute can appear with other attributes > * Allows multiple attributes to be specified for text at once (such as blinking, bold, italic underlined, like this ***foo***) > * Multiple attributes do not care about the order between each other, that is to say there is no fixed format (although it is customary to `properties; foreground color; background color` order) > * The final visual effect is determined by the combined values of all the attributes. If a conflict is encountered, the attribute that appears later overrides the attribute that previously conflicted with it. According to the above point of view, most of the code in `ansi.go` about SGR processing needs to be modified. include: * `SGR 1` should be able to highlight the foreground color, similar to the effect of `SGR 90~97`. * `SGR 21~27` should be able to properly close the corresponding properties set previously. * `SGR 38/48` should not terminate `FieldLoop`, and should not be considered to have any code behind them. * Added support for italics.
Author
Owner

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

In your example, here is the part that I don't understand:

some of the text marked as bold black(SGR 1;30m) is invisible

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 SGR 1;30m code?

And in fact, tview translates this to [black::b] so it's according to the specification.

<!-- gh-comment-id:513553400 --> @rivo commented on GitHub (Jul 21, 2019): In your example, here is the part that I don't understand: > some of the text marked as bold black(`SGR 1;30m`) is invisible 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 `SGR 1;30m` code? And in fact, `tview` translates this to `[black::b]` so it's according to the specification.
Author
Owner

@dzpao commented on GitHub (Jul 31, 2019):

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.

iTerm2
image

Terminal.app
image

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.

<!-- gh-comment-id:516786894 --> @dzpao commented on GitHub (Jul 31, 2019): 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**. > iTerm2 ![image](https://user-images.githubusercontent.com/52447680/62202446-e5f7f680-b3bb-11e9-94ab-c190037bf6fc.png) > Terminal.app ![image](https://user-images.githubusercontent.com/52447680/62202483-f3ad7c00-b3bb-11e9-954c-515863779a53.png) 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.
Author
Owner

@rivo commented on GitHub (Aug 29, 2019):

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:

image

If you have some (brief) code that illustrates how it doesn't work in your case, please post it here.

<!-- gh-comment-id:526214731 --> @rivo commented on GitHub (Aug 29, 2019): So I'm not sure if this was different before. But this sequence appears to be displayed correctly. Check this out: ```go 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: ![image](https://user-images.githubusercontent.com/480930/63949513-d3381680-ca7a-11e9-8c2b-9f22f3fe2ea8.png) If you have some (brief) code that illustrates how it doesn't work in your case, please post it here.
Author
Owner

@dzpao commented on GitHub (Sep 12, 2019):

I tried the example you gave with the latest version of the code, and the effect is different from yours. It is not correct.

Below is the process of my testing.

image

<!-- gh-comment-id:530698434 --> @dzpao commented on GitHub (Sep 12, 2019): I tried the example you gave with the latest version of the code, and the effect is different from yours. It is not correct. Below is the process of my testing. ![image](https://user-images.githubusercontent.com/52447680/64762130-26789180-d570-11e9-8a11-2d5e7d6b1d18.png)
Author
Owner

@dzpao commented on GitHub (Sep 12, 2019):

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 \x1b are replaced with <ESC>, or you can download the file directly):
color-test.txt

<ESC>[0mCase  0.1: <ESC>[1;30;40mbold black on black<ESC>[0m

<ESC>[0mCase  1.1: <ESC>[1;33;44mbold<ESC>[0m
<ESC>[0mCase  1.2: <ESC>[2;33;44mdim<ESC>[0m
<ESC>[0mCase  1.3: <ESC>[4;33;44munderline<ESC>[0m
<ESC>[0mCase  1.4: <ESC>[5;33;44mblink<ESC>[0m

<ESC>[0mCase  2.1: <ESC>[1;33;44mbold + underline<ESC>[4m = bold + underline<ESC>[0m
<ESC>[0mCase  2.2: <ESC>[4;33;44munderline + bold<ESC>[1m = bold + underline<ESC>[0m
<ESC>[0mCase  2.3: <ESC>[1;33;44mbold + blink<ESC>[5m = bold + blink<ESC>[0m
<ESC>[0mCase  2.4: <ESC>[5;33;44mblink + bold<ESC>[1m = bold + blink<ESC>[0m
<ESC>[0mCase  2.5: <ESC>[2;33;44mdim + underline<ESC>[4m = dim + underline<ESC>[0m
<ESC>[0mCase  2.6: <ESC>[4;33;44munderline + dim<ESC>[2m = dim + underline<ESC>[0m
<ESC>[0mCase  2.7: <ESC>[2;33;44mdim + blink<ESC>[5m = dim + blink<ESC>[0m
<ESC>[0mCase  2.8: <ESC>[5;33;44mblink + dim<ESC>[2m = dim + blink<ESC>[0m
<ESC>[0mCase  2.9: <ESC>[4;33;44munderline + blink<ESC>[5m = underline + blink<ESC>[0m
<ESC>[0mCase 2.10: <ESC>[5;33;44mblink + underline<ESC>[4m = underline + blink<ESC>[0m

<ESC>[0mCase  3.1: <ESC>[4;5;33;44m(underline + blink) + bold<ESC>[1m = bold + underline + blink<ESC>[0m
<ESC>[0mCase  3.2: <ESC>[1;5;33;44m(bold + blink) + underline<ESC>[4m = bold + underline + blink<ESC>[0m
<ESC>[0mCase  3.3: <ESC>[1;4;33;44m(bold + underline) + blink<ESC>[5m = bold + underline + blink<ESC>[0m
<ESC>[0mCase  3.4: <ESC>[1;33;44mbold + (underline + blink)<ESC>[4;5m = bold + underline + blink<ESC>[0m
<ESC>[0mCase  3.5: <ESC>[4;33;44munderline + (bold + blink)<ESC>[1;5m = bold + underline + blink<ESC>[0m
<ESC>[0mCase  3.6: <ESC>[5;33;44mblink + (bold + underline)<ESC>[1;4m = bold + underline + blink<ESC>[0m
<ESC>[0mCase  3.7: <ESC>[4;5;33;44m(underline + blink) + dim<ESC>[2m = dim + underline + blink<ESC>[0m
<ESC>[0mCase  3.8: <ESC>[2;5;33;44m(dim + blink) + underline<ESC>[4m = dim + underline + blink<ESC>[0m
<ESC>[0mCase  3.9: <ESC>[2;4;33;44m(dim + underline) + blink<ESC>[5m = dim + underline + blink<ESC>[0m
<ESC>[0mCase 3.10: <ESC>[2;33;44mdim + (underline + blink)<ESC>[4;5m = dim + underline + blink<ESC>[0m
<ESC>[0mCase 3.11: <ESC>[4;33;44munderline + (dim + blink)<ESC>[2;5m = dim + underline + blink<ESC>[0m
<ESC>[0mCase 3.12: <ESC>[5;33;44mblink + (dim + underline)<ESC>[2;4m = dim + underline + blink<ESC>[0m

<ESC>[0mCase  4.1: <ESC>[1;4;33;44m(bold + underline) - bold<ESC>[22m = underline<ESC>[0m
<ESC>[0mCase  4.2: <ESC>[1;4;33;44m(bold + underline) - underline<ESC>[24m = bold<ESC>[0m
<ESC>[0mCase  4.3: <ESC>[1;5;33;44m(bold + blink) - bold<ESC>[22m = blink<ESC>[0m
<ESC>[0mCase  4.4: <ESC>[1;5;33;44m(bold + blink) - blink<ESC>[25m = bold<ESC>[0m
<ESC>[0mCase  4.5: <ESC>[2;4;33;44m(dim + underline) - dim<ESC>[22m = underline<ESC>[0m
<ESC>[0mCase  4.6: <ESC>[2;4;33;44m(dim + underline) - underline<ESC>[24m = dim<ESC>[0m
<ESC>[0mCase  4.7: <ESC>[2;5;33;44m(dim + blink) - dim<ESC>[22m = blink<ESC>[0m
<ESC>[0mCase  4.8: <ESC>[2;5;33;44m(dim + blink) - blink<ESC>[25m = dim<ESC>[0m
<ESC>[0mCase  4.9: <ESC>[4;5;33;44m(underline + blink) - underline<ESC>[24m = blink<ESC>[0m
<ESC>[0mCase 4.10: <ESC>[4;5;33;44m(underline + blink) - blink<ESC>[25m = underline<ESC>[0m

<ESC>[0mCase  5.1: <ESC>[1;4;5;33;44m(bold + underline + blink) - bold<ESC>[22m = underline + blink<ESC>[0m
<ESC>[0mCase  5.2: <ESC>[1;4;5;33;44m(bold + underline + blink) - underline<ESC>[24m = bold + blink<ESC>[0m
<ESC>[0mCase  5.3: <ESC>[1;4;5;33;44m(bold + underline + blink) - blink<ESC>[25m = bold + underline<ESC>[0m
<ESC>[0mCase  5.4: <ESC>[1;4;5;33;44m(bold + underline + blink) - underline - blink<ESC>[24;25m = bold<ESC>[0m
<ESC>[0mCase  5.5: <ESC>[1;4;5;33;44m(bold + underline + blink) - bold - blink<ESC>[22;25m = underline<ESC>[0m
<ESC>[0mCase  5.6: <ESC>[1;4;5;33;44m(bold + underline + blink) - bold - underline<ESC>[22;24m = blink<ESC>[0m
<ESC>[0mCase  5.7: <ESC>[2;4;5;33;44m(dim + underline + blink) - dim<ESC>[22m = underline + blink<ESC>[0m
<ESC>[0mCase  5.8: <ESC>[2;4;5;33;44m(dim + underline + blink) - underline<ESC>[24m = dim + blink<ESC>[0m
<ESC>[0mCase  5.9: <ESC>[2;4;5;33;44m(dim + underline + blink) - blink<ESC>[25m = dim + underline<ESC>[0m
<ESC>[0mCase 5.10: <ESC>[2;4;5;33;44m(dim + underline + blink) - underline - blink<ESC>[24;25m = dim<ESC>[0m
<ESC>[0mCase 5.11: <ESC>[2;4;5;33;44m(dim + underline + blink) - dim - blink<ESC>[22;25m = underline<ESC>[0m
<ESC>[0mCase 5.12: <ESC>[2;4;5;33;44m(dim + underline + blink) - dim - underline<ESC>[22;24m = blink<ESC>[0m

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)
image

(Terminal.app, without tmux/screen, TERM=xterm-256color, zsh 5.6.2, all the blinks are correct)
image

(rivo/tview@master, commit ID=f8bc69b, iTerm2 and Terminal.app have the same effect)
image

I also wrote a patch that can display correctly(all the blinks are correct):
image

<!-- gh-comment-id:530880024 --> @dzpao commented on GitHub (Sep 12, 2019): 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. ```golang 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 `\x1b` are replaced with `<ESC>`, or you can download the file directly): [color-test.txt](https://github.com/rivo/tview/files/3606129/color-test.txt) ``` <ESC>[0mCase 0.1: <ESC>[1;30;40mbold black on black<ESC>[0m <ESC>[0mCase 1.1: <ESC>[1;33;44mbold<ESC>[0m <ESC>[0mCase 1.2: <ESC>[2;33;44mdim<ESC>[0m <ESC>[0mCase 1.3: <ESC>[4;33;44munderline<ESC>[0m <ESC>[0mCase 1.4: <ESC>[5;33;44mblink<ESC>[0m <ESC>[0mCase 2.1: <ESC>[1;33;44mbold + underline<ESC>[4m = bold + underline<ESC>[0m <ESC>[0mCase 2.2: <ESC>[4;33;44munderline + bold<ESC>[1m = bold + underline<ESC>[0m <ESC>[0mCase 2.3: <ESC>[1;33;44mbold + blink<ESC>[5m = bold + blink<ESC>[0m <ESC>[0mCase 2.4: <ESC>[5;33;44mblink + bold<ESC>[1m = bold + blink<ESC>[0m <ESC>[0mCase 2.5: <ESC>[2;33;44mdim + underline<ESC>[4m = dim + underline<ESC>[0m <ESC>[0mCase 2.6: <ESC>[4;33;44munderline + dim<ESC>[2m = dim + underline<ESC>[0m <ESC>[0mCase 2.7: <ESC>[2;33;44mdim + blink<ESC>[5m = dim + blink<ESC>[0m <ESC>[0mCase 2.8: <ESC>[5;33;44mblink + dim<ESC>[2m = dim + blink<ESC>[0m <ESC>[0mCase 2.9: <ESC>[4;33;44munderline + blink<ESC>[5m = underline + blink<ESC>[0m <ESC>[0mCase 2.10: <ESC>[5;33;44mblink + underline<ESC>[4m = underline + blink<ESC>[0m <ESC>[0mCase 3.1: <ESC>[4;5;33;44m(underline + blink) + bold<ESC>[1m = bold + underline + blink<ESC>[0m <ESC>[0mCase 3.2: <ESC>[1;5;33;44m(bold + blink) + underline<ESC>[4m = bold + underline + blink<ESC>[0m <ESC>[0mCase 3.3: <ESC>[1;4;33;44m(bold + underline) + blink<ESC>[5m = bold + underline + blink<ESC>[0m <ESC>[0mCase 3.4: <ESC>[1;33;44mbold + (underline + blink)<ESC>[4;5m = bold + underline + blink<ESC>[0m <ESC>[0mCase 3.5: <ESC>[4;33;44munderline + (bold + blink)<ESC>[1;5m = bold + underline + blink<ESC>[0m <ESC>[0mCase 3.6: <ESC>[5;33;44mblink + (bold + underline)<ESC>[1;4m = bold + underline + blink<ESC>[0m <ESC>[0mCase 3.7: <ESC>[4;5;33;44m(underline + blink) + dim<ESC>[2m = dim + underline + blink<ESC>[0m <ESC>[0mCase 3.8: <ESC>[2;5;33;44m(dim + blink) + underline<ESC>[4m = dim + underline + blink<ESC>[0m <ESC>[0mCase 3.9: <ESC>[2;4;33;44m(dim + underline) + blink<ESC>[5m = dim + underline + blink<ESC>[0m <ESC>[0mCase 3.10: <ESC>[2;33;44mdim + (underline + blink)<ESC>[4;5m = dim + underline + blink<ESC>[0m <ESC>[0mCase 3.11: <ESC>[4;33;44munderline + (dim + blink)<ESC>[2;5m = dim + underline + blink<ESC>[0m <ESC>[0mCase 3.12: <ESC>[5;33;44mblink + (dim + underline)<ESC>[2;4m = dim + underline + blink<ESC>[0m <ESC>[0mCase 4.1: <ESC>[1;4;33;44m(bold + underline) - bold<ESC>[22m = underline<ESC>[0m <ESC>[0mCase 4.2: <ESC>[1;4;33;44m(bold + underline) - underline<ESC>[24m = bold<ESC>[0m <ESC>[0mCase 4.3: <ESC>[1;5;33;44m(bold + blink) - bold<ESC>[22m = blink<ESC>[0m <ESC>[0mCase 4.4: <ESC>[1;5;33;44m(bold + blink) - blink<ESC>[25m = bold<ESC>[0m <ESC>[0mCase 4.5: <ESC>[2;4;33;44m(dim + underline) - dim<ESC>[22m = underline<ESC>[0m <ESC>[0mCase 4.6: <ESC>[2;4;33;44m(dim + underline) - underline<ESC>[24m = dim<ESC>[0m <ESC>[0mCase 4.7: <ESC>[2;5;33;44m(dim + blink) - dim<ESC>[22m = blink<ESC>[0m <ESC>[0mCase 4.8: <ESC>[2;5;33;44m(dim + blink) - blink<ESC>[25m = dim<ESC>[0m <ESC>[0mCase 4.9: <ESC>[4;5;33;44m(underline + blink) - underline<ESC>[24m = blink<ESC>[0m <ESC>[0mCase 4.10: <ESC>[4;5;33;44m(underline + blink) - blink<ESC>[25m = underline<ESC>[0m <ESC>[0mCase 5.1: <ESC>[1;4;5;33;44m(bold + underline + blink) - bold<ESC>[22m = underline + blink<ESC>[0m <ESC>[0mCase 5.2: <ESC>[1;4;5;33;44m(bold + underline + blink) - underline<ESC>[24m = bold + blink<ESC>[0m <ESC>[0mCase 5.3: <ESC>[1;4;5;33;44m(bold + underline + blink) - blink<ESC>[25m = bold + underline<ESC>[0m <ESC>[0mCase 5.4: <ESC>[1;4;5;33;44m(bold + underline + blink) - underline - blink<ESC>[24;25m = bold<ESC>[0m <ESC>[0mCase 5.5: <ESC>[1;4;5;33;44m(bold + underline + blink) - bold - blink<ESC>[22;25m = underline<ESC>[0m <ESC>[0mCase 5.6: <ESC>[1;4;5;33;44m(bold + underline + blink) - bold - underline<ESC>[22;24m = blink<ESC>[0m <ESC>[0mCase 5.7: <ESC>[2;4;5;33;44m(dim + underline + blink) - dim<ESC>[22m = underline + blink<ESC>[0m <ESC>[0mCase 5.8: <ESC>[2;4;5;33;44m(dim + underline + blink) - underline<ESC>[24m = dim + blink<ESC>[0m <ESC>[0mCase 5.9: <ESC>[2;4;5;33;44m(dim + underline + blink) - blink<ESC>[25m = dim + underline<ESC>[0m <ESC>[0mCase 5.10: <ESC>[2;4;5;33;44m(dim + underline + blink) - underline - blink<ESC>[24;25m = dim<ESC>[0m <ESC>[0mCase 5.11: <ESC>[2;4;5;33;44m(dim + underline + blink) - dim - blink<ESC>[22;25m = underline<ESC>[0m <ESC>[0mCase 5.12: <ESC>[2;4;5;33;44m(dim + underline + blink) - dim - underline<ESC>[22;24m = blink<ESC>[0m ``` 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) ![image](https://user-images.githubusercontent.com/52447680/64795666-0cab6e80-d5b1-11e9-8958-311528498d18.png) (Terminal.app, without tmux/screen, TERM=xterm-256color, zsh 5.6.2, all the blinks are correct) ![image](https://user-images.githubusercontent.com/52447680/64797265-b8ee5480-d5b3-11e9-98d1-30580f63e9de.png) (rivo/tview@master, commit ID=f8bc69b, iTerm2 and Terminal.app have the same effect) ![image](https://user-images.githubusercontent.com/52447680/64795902-6ca21500-d5b1-11e9-9fb8-afeb7bde0908.png) I also wrote a patch that can display correctly(all the blinks are correct): ![image](https://user-images.githubusercontent.com/52447680/64797587-30bc7f00-d5b4-11e9-988f-4cf0b8e1927a.png)
Author
Owner

@dzpao commented on GitHub (Sep 12, 2019):

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.

<!-- gh-comment-id:530961762 --> @dzpao commented on GitHub (Sep 12, 2019): 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.
Author
Owner

@dzpao commented on GitHub (Sep 13, 2019):

Here are two new cases to reveal the two bugs I just discovered:

Case 6.1: <ESC>[32mhello<ESC>[m world
Case 6.2: <ESC>[32mhello
    ...   world

image

In 6.1, <ESC>[m should be able to reset the current color attributes, but it doesn't.
In 6.2, the color attributes should affect the next line, but it doesn't.

<!-- gh-comment-id:531190508 --> @dzpao commented on GitHub (Sep 13, 2019): Here are two new cases to reveal the two bugs I just discovered: ``` Case 6.1: <ESC>[32mhello<ESC>[m world Case 6.2: <ESC>[32mhello ... world ``` ![image](https://user-images.githubusercontent.com/52447680/64857108-379bce00-d656-11e9-90d8-57336c3c34cb.png) In 6.1, `<ESC>[m` should be able to reset the current color attributes, but it doesn't. In 6.2, the color attributes should affect the next line, but it doesn't.
Author
Owner

@rivo commented on GitHub (Oct 17, 2019):

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:

image

tview:

image

There are some differences, though. Some of them are due to tcell requiring specific colours (there is no colour such as "use the terminal's default color", see also gdamore/tcell#292).

But the partial attribute reset is actually a bug which I need to fix. I hope to be able to resolve this soon.

<!-- gh-comment-id:543089384 --> @rivo commented on GitHub (Oct 17, 2019): 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: ![image](https://user-images.githubusercontent.com/480930/66995717-c2e20680-f0cf-11e9-97c8-27a8d9181493.png) tview: ![image](https://user-images.githubusercontent.com/480930/66995747-cd9c9b80-f0cf-11e9-8fb1-d3b9670c4fd9.png) There are some differences, though. Some of them are due to `tcell` requiring specific colours (there is no colour such as "use the terminal's default color", see also gdamore/tcell#292). But the partial attribute reset is actually a bug which I need to fix. I hope to be able to resolve this soon.
Author
Owner

@rivo commented on GitHub (May 27, 2020):

Sorry it took so long. I believe the latest commit fixes these issues. Your test file looks like it's supposed to in tview. Let me know if there's anything else. (Probably best to open a new issue in that case so that the topic doesn't get lost.)

<!-- gh-comment-id:634900582 --> @rivo commented on GitHub (May 27, 2020): Sorry it took so long. I believe the latest commit fixes these issues. Your test file looks like it's supposed to in `tview`. Let me know if there's anything else. (Probably best to open a new issue in that case so that the topic doesn't get lost.)
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#242
No description provided.