From 5ed87ffcb920f8311cfd29dee0575e6c64755314 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 26 Jun 2025 20:47:57 +0900 Subject: Fix highlight offsets of multi-line entries Fix regression from 4811e52a --- src/terminal.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/terminal.go') diff --git a/src/terminal.go b/src/terminal.go index f5ded439..9c627e12 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -3399,13 +3399,8 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat finalLineNum = lineNum offsets := []colorOffset{} lbg := tui.NoColorPair() - var lineLen int for idx, offset := range allOffsets { - lineLen = len(line) - if lineLen > 0 && line[lineLen-1] == '\n' { - lineLen-- - } - lineEnd := int32(from + lineLen) + lineEnd := int32(from + len(line)) if offset.offset[0] >= lineEnd { if offset.IsFullBgMarker(lineEnd) { lbg = offset.color @@ -3441,7 +3436,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat break } } - from += lineLen + from += len(line) if lineOffset < skipLines { continue } -- cgit v1.2.3