Checking line index before attempting purge. Fixes #891

pull/893/head
Oliver 8 months ago
parent 0ad06c2ea3
commit d7e1e3802f

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

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

Loading…
Cancel
Save