Clarify that WordWrap accepts unescaped text only

Resolves #27.
This commit is contained in:
Trevor Slocum 2020-11-03 09:34:21 -08:00
parent 30838d75cd
commit 614c61839b
3 changed files with 6 additions and 2 deletions

View File

@ -13,6 +13,7 @@ v1.5.1 (WIP)
- Allow modification of scroll bar render text
- Allow scrolling List horizontally
- Clarify that Table rows must each have the same number of columns
- Clarify that WordWrap accepts unescaped text only
- Display TextView scroll bar automatically by default
- Generalize tag stripping as StripTags
- Make printWithStyle public and rename as PrintStyle

View File

@ -327,7 +327,7 @@ func (a *Application) Run() error {
continue
}
// A screen was finalized (event is nil). Wait for a new scren.
// A screen was finalized (event is nil). Wait for a new screen.
screen = <-a.screenReplacement
if screen == nil {
// No new screen. We're done.
@ -383,6 +383,7 @@ EventLoop:
// Ctrl-C closes the application.
if event.Key() == tcell.KeyCtrlC {
a.Stop()
continue
}
// Pass other key events to the currently focused primitive.
@ -630,7 +631,7 @@ func (a *Application) draw() {
}
// Resize if requested.
if fullscreen && root != nil {
if fullscreen {
root.SetRect(0, 0, a.width, a.height)
}

View File

@ -506,6 +506,8 @@ func TaggedStringWidth(text string) int {
// This function considers color tags to have no width.
//
// Text is always split at newline characters ('\n').
//
// Text must not be escaped.
func WordWrap(text string, width int) (lines []string) {
colorTagIndices, _, _, _, escapeIndices, strippedText, _ := decomposeText([]byte(text), true, false)