Skip to content
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

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

Open
quantumsheep opened this issue Feb 7, 2022 · 2 comments
Open

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

quantumsheep opened this issue Feb 7, 2022 · 2 comments

Comments

@quantumsheep
Copy link

style_parser.go implements a special feature where [ and ] characters are used to separate styled text.

termui/style_parser.go

Lines 19 to 20 in f976fe6

tokenBeginStyledText = '['
tokenEndStyledText = ']'

termui/style_parser.go

Lines 105 to 112 in f976fe6

case parserStateDefault:
if _rune == tokenBeginStyledText {
state = parserStateStyledText
squareCount = 1
styledText = append(styledText, _rune)
} else {
cells = append(cells, Cell{_rune, defaultStyle})
}

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
Copy link

andrewarrow commented Oct 4, 2022

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

@andrewarrow
Copy link

Ok I finally have a solution! Made a PR #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 ].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants