diff --git a/flex.go b/flex.go index 469a0e3..0cc2424 100644 --- a/flex.go +++ b/flex.go @@ -4,12 +4,16 @@ import ( "github.com/gdamore/tcell/v2" ) -// Configuration values. +// Flex directions. const ( - FlexRow = 0 // One item per row. - FlexColumn = 1 // One item per column. - FlexRowCSS = 1 // As defined in CSS, items distributed along a row. - FlexColumnCSS = 0 // As defined in CSS, items distributed within a column. + // One item per row. + FlexRow = 0 + // One item per column. + FlexColumn = 1 + // As defined in CSS, items distributed along a row. + FlexRowCSS = 1 + // As defined in CSS, items distributed within a column. + FlexColumnCSS = 0 ) // flexItem holds layout options for one item. @@ -49,7 +53,7 @@ type Flex struct { // background before any items are drawn, set it to a box with the desired // color: // -// flex.Box = NewBox() +// flex.Box = NewBox() func NewFlex() *Flex { f := &Flex{ direction: FlexColumn, diff --git a/textview.go b/textview.go index f970ae5..200c8cc 100644 --- a/textview.go +++ b/textview.go @@ -1259,7 +1259,7 @@ func (t *TextView) Draw(screen tcell.Screen) { } // Purge. - if purgeStart > 0 { + if purgeStart > 0 && purgeStart < len(t.lineIndex) { newText := t.text.String()[t.lineIndex[purgeStart].offset:] t.text.Reset() t.text.WriteString(newText)