mirror of https://github.com/rivo/tview.git
Merge pull request #753 from sruehl/fix/textview_color_panic
fix: fixed GetRegionText when colors are active, fixes #751
This commit is contained in:
commit
941f8605ec
|
@ -626,10 +626,11 @@ func (t *TextView) GetRegionText(regionID string) string {
|
||||||
for pos, ch := range str {
|
for pos, ch := range str {
|
||||||
// Skip any color tags.
|
// Skip any color tags.
|
||||||
if currentTag < len(colorTagIndices) && pos >= colorTagIndices[currentTag][0] && pos < colorTagIndices[currentTag][1] {
|
if currentTag < len(colorTagIndices) && pos >= colorTagIndices[currentTag][0] && pos < colorTagIndices[currentTag][1] {
|
||||||
if pos == colorTagIndices[currentTag][1]-1 {
|
tag := currentTag
|
||||||
|
if pos == colorTagIndices[tag][1]-1 {
|
||||||
currentTag++
|
currentTag++
|
||||||
}
|
}
|
||||||
if colorTagIndices[currentTag][1]-colorTagIndices[currentTag][0] > 2 {
|
if colorTagIndices[tag][1]-colorTagIndices[tag][0] > 2 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue