mirror of
https://github.com/rivo/tview.git
synced 2025-04-26 13:49:06 +08:00
Checking line index before attempting purge. Fixes #891
This commit is contained in:
parent
0ad06c2ea3
commit
d7e1e3802f
14
flex.go
14
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.
|
||||
|
@ -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…
x
Reference in New Issue
Block a user