forked from tslocum/cview
Fixed missed tag at EOL in TextView
This fix was cherry-picked and adapted from tview commit ba9f3a6fa19d4eb2cebed6c256523ff90faa0bbb Resolves #73.
This commit is contained in:
parent
605d0123c1
commit
6f90b4422c
1 changed files with 16 additions and 8 deletions
24
textview.go
24
textview.go
|
@ -1171,14 +1171,22 @@ func (t *TextView) Draw(screen tcell.Screen) {
|
|||
backgroundColor := index.BackgroundColor
|
||||
attributes := index.Attributes
|
||||
regionID := index.Region
|
||||
if t.regions && len(regionID) > 0 && (len(t.regionInfos) == 0 || !bytes.Equal(t.regionInfos[len(t.regionInfos)-1].ID, regionID)) {
|
||||
t.regionInfos = append(t.regionInfos, &textViewRegion{
|
||||
ID: regionID,
|
||||
FromX: x,
|
||||
FromY: y + line - t.lineOffset,
|
||||
ToX: -1,
|
||||
ToY: -1,
|
||||
})
|
||||
if t.regions {
|
||||
if len(t.regionInfos) > 0 && !bytes.Equal(t.regionInfos[len(t.regionInfos)-1].ID, regionID) {
|
||||
// End last region.
|
||||
t.regionInfos[len(t.regionInfos)-1].ToX = x
|
||||
t.regionInfos[len(t.regionInfos)-1].ToY = y + line - t.lineOffset
|
||||
}
|
||||
if len(regionID) > 0 && (len(t.regionInfos) == 0 || !bytes.Equal(t.regionInfos[len(t.regionInfos)-1].ID, regionID)) {
|
||||
// Start a new region.
|
||||
t.regionInfos = append(t.regionInfos, &textViewRegion{
|
||||
ID: regionID,
|
||||
FromX: x,
|
||||
FromY: y + line - t.lineOffset,
|
||||
ToX: -1,
|
||||
ToY: -1,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Process tags.
|
||||
|
|
Loading…
Reference in a new issue