From f794cceb95a7ab038154e5df03b77eba58507c56 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Mon, 12 Jul 2021 13:21:13 -0700 Subject: [PATCH] Fix TextView.GetRegionText error when text contains color tags Resolves #69. --- CHANGELOG | 3 +++ textview.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 92e8080..cdedc44 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +v1.5.7 (WIP) +- Fix TextView.GetRegionText error when text contains color tags + v1.5.6 (2020-07-08) - Add TrueColorTags option and do not use TrueColor tag values by default - Add TextView.SetHighlightForegroundColor and TextView.SetHighlightBackgroundColor diff --git a/textview.go b/textview.go index 1fac443..89d321b 100644 --- a/textview.go +++ b/textview.go @@ -697,6 +697,9 @@ func (t *TextView) GetRegionText(regionID string) string { if currentTag < len(colorTagIndices) && pos >= colorTagIndices[currentTag][0] && pos < colorTagIndices[currentTag][1] { if pos == colorTagIndices[currentTag][1]-1 { currentTag++ + if currentTag == len(colorTagIndices) { + continue + } } if colorTagIndices[currentTag][1]-colorTagIndices[currentTag][0] > 2 { continue