From 7568c3f71cfaba4dabefcb8cd7bec6f654455bfe Mon Sep 17 00:00:00 2001 From: Oliver <480930+rivo@users.noreply.github.com> Date: Sat, 20 Jan 2024 10:50:12 +0100 Subject: [PATCH] Fixed disappearing highlights. Fixes #941 --- textview.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/textview.go b/textview.go index 682f139..8524ee5 100644 --- a/textview.go +++ b/textview.go @@ -1048,17 +1048,15 @@ func (t *TextView) Draw(screen tcell.Screen) { // Scroll to highlighted regions. if t.regionTags && t.scrollToHighlights { // Make sure we know all highlighted regions. - knownHighlights := make(map[string]struct{}) t.parseAhead(width, func(lineNumber int, line *textViewLine) bool { for regionID := range t.highlights { if _, ok := t.regions[regionID]; !ok { return false } - knownHighlights[regionID] = struct{}{} + t.highlights[regionID] = struct{}{} } return true }) - t.highlights = knownHighlights // What is the line range for all highlighted regions? var (