awesome-gocui / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
344 stars 39 forks source link

[BUG] Overrides previous ANSI style #50

Open C0DK opened 4 years ago

C0DK commented 4 years ago

Describe the bug So this is pretty simple to replicate and test, but \x1b[1m \x1b[31m test this string will not be bold, which it should, based on ANSI standards. the first ANSI styling is overwritten by the second, however i don't use any reset flag so it shouldn't.. the following two strings should be identical, but they are not: \x1b[1m\x1b[31m test and \x1b[1;31m test.

YOu can easily test the expected output by using echo -e "\x1b[1m \x1b[31m test" - it basically seems like gocui overwrites the current color scheme/settings at every call, which IMO is a bug. Not sure if it's a feature. hehe

Environment (please complete the following information):

glvr182 commented 4 years ago

Thank you for the report! Right now we are reworking some things in the rendering part (see #47 #49) After those (maybe even during) I'll check if i can fix it!

MichaelMure commented 4 years ago

No idea if it's useful for this particular issue but I wrote some code to accumulate multiple ANSI escape code together: https://github.com/MichaelMure/go-term-text/blob/master/escape_state.go

kamushadenes commented 2 years ago

Hello, any updates on that? I noticed this bug when testing zerolog.ConsoleWriter but inside and outside a gocui frame.

kamushadenes commented 2 years ago

I'm talking about this:

Screen Shot 2022-07-20 at 18 23 32 Screen Shot 2022-07-20 at 18 23 44