Browse Source

Fixed missed tag at EOL in TextView

This fix was cherry-picked and adapted from tview commit
ba9f3a6fa1

Resolves #73.
wordwrap
Oliver 5 months ago
committed by Trevor Slocum
parent
commit
6f90b4422c
  1. 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…
Cancel
Save