gizak / termui

Golang terminal dashboard
MIT License
13.06k stars 783 forks source link

How to use `[` and `]` characters in cells ? #311

Open quantumsheep opened 2 years ago

quantumsheep commented 2 years ago

style_parser.go implements a special feature where [ and ] characters are used to separate styled text. https://github.com/gizak/termui/blob/f976fe697aa09b747f16fa6e08c36dde5fb16f27/style_parser.go#L19-L20 https://github.com/gizak/termui/blob/f976fe697aa09b747f16fa6e08c36dde5fb16f27/style_parser.go#L105-L112

Which ends up cropping the text:

CleanShot 2022-02-07 at 16 35 46@2x

Is there a way to disable this feature without having to edit the code ?

andrewarrow commented 1 year ago

+1 for this. Maybe we should make \[ escape the significance of the [ character.

andrewarrow commented 1 year ago

Ok I finally have a solution! Made a PR https://github.com/gizak/termui/pull/321 and there is no need to \ to escape. I made the logic look for ]( i.e. you have to have a ( to start the style after the ending ] or it will ignore [ and ].