summaryrefslogtreecommitdiff
path: root/src/terminal.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-06-26 20:47:57 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-06-26 20:48:34 +0900
commit5ed87ffcb920f8311cfd29dee0575e6c64755314 (patch)
tree5c508ea4b7959cdc6176ce4fb553be9bb813accb /src/terminal.go
parentb99cb6323fef55ceb458528250e3b26149f1b5b5 (diff)
downloadfzf-5ed87ffcb920f8311cfd29dee0575e6c64755314.tar.gz
Fix highlight offsets of multi-line entries
Fix regression from 4811e52a
Diffstat (limited to 'src/terminal.go')
-rw-r--r--src/terminal.go9
1 files changed, 2 insertions, 7 deletions
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
}