[GH-ISSUE #84] Escape function for texts #61

Closed
opened 2026-03-04 01:01:35 +03:00 by kerem · 4 comments
Owner

Originally created by @muesli on GitHub (Mar 20, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/84

When trying to display texts like [foobar] (as an actual text, not a color definition), a convenient little escape function would be handy, otherwise those texts are incorrectly interpreted as a color-markup.

Originally created by @muesli on GitHub (Mar 20, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/84 When trying to display texts like `[foobar]` (as an actual text, not a color definition), a convenient little escape function would be handy, otherwise those texts are incorrectly interpreted as a color-markup.
kerem 2026-03-04 01:01:35 +03:00
Author
Owner

@rivo commented on GitHub (Mar 23, 2018):

Yeah, I want to add this. Not just for strings but also for io.Writer's so you can use it in the TextView primitive as well.

<!-- gh-comment-id:375786179 --> @rivo commented on GitHub (Mar 23, 2018): Yeah, I want to add this. Not just for strings but also for `io.Writer`'s so you can use it in the `TextView` primitive as well.
Author
Owner

@rivo commented on GitHub (Mar 29, 2018):

Btw, this also affects #91 so I will probably do this after introducing background colors.

<!-- gh-comment-id:377295630 --> @rivo commented on GitHub (Mar 29, 2018): Btw, this also affects #91 so I will probably do this after introducing background colors.
Author
Owner

@KingRikkie commented on GitHub (Apr 7, 2018):

Please make it handle Umlauts äüö and brackets ( ) correctly. The current workaround with a strings.NewReplacer("]", "[]") fails when there are any of said chars inside the square brackets as tview will ignore the brackets then leading to something like this in viewport

string with [Ümlauts] in brackets -> string with [Ümlauts[] in brackets
string with [bra(kets] in brackets -> string with [bra(kets[] in brackets

<!-- gh-comment-id:379463705 --> @KingRikkie commented on GitHub (Apr 7, 2018): Please make it handle Umlauts `äüö` and brackets `( )` correctly. The current workaround with a `strings.NewReplacer("]", "[]")` fails when there are any of said chars inside the square brackets as tview will ignore the brackets then leading to something like this in viewport `string with [Ümlauts] in brackets` -> `string with [Ümlauts[] in brackets` `string with [bra(kets] in brackets` -> `string with [bra(kets[] in brackets`
Author
Owner

@rivo commented on GitHub (Apr 13, 2018):

The package now has an escape function. See Escape() for details.

<!-- gh-comment-id:381272515 --> @rivo commented on GitHub (Apr 13, 2018): The package now has an escape function. See [`Escape()`](https://godoc.org/github.com/rivo/tview#Escape) for details.
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#61
No description provided.