termui icon indicating copy to clipboard operation
termui copied to clipboard

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

Open quantumsheep opened this issue 3 years ago • 2 comments

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 ?

quantumsheep avatar Feb 07 '22 15:02 quantumsheep

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

andrewarrow avatar Oct 04 '22 13:10 andrewarrow

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 ].

andrewarrow avatar Nov 09 '22 14:11 andrewarrow