Browse Source

Clarify that WordWrap accepts unescaped text only

Resolves #27.
tablepad
Trevor Slocum 2 years ago
parent
commit
614c61839b
  1. 1
      CHANGELOG
  2. 5
      application.go
  3. 2
      util.go

1
CHANGELOG

@ -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

5
application.go

@ -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)
}

2
util.go

@ -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)

Loading…
Cancel
Save