summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-05-30 19:43:10 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-05-30 19:43:10 +0900
commit1721e6a1eddd4cdc44fc78e09eb2192bc56b895c (patch)
tree7d397821cfef90232dd3d5054b05b457305b33b1 /src
parentc7ee3b833f5a511b705c771df35dbc0d6945a572 (diff)
downloadfzf-1721e6a1eddd4cdc44fc78e09eb2192bc56b895c.tar.gz
Do not apply 'nth' attributes to trailing whitespaces
# foo bar # ----- <- previously underlined trailing whitespace # --- <- with the fix, trailing whitespace is excluded fzf --color nth:underline --nth 1 <<< 'foo bar'
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 86580d7a..6f65f52e 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -3044,7 +3044,8 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
}
for _, token := range tokens {
start := token.prefixLength
- end := start + int32(token.text.Length())
+ length := token.text.Length() - token.text.TrailingWhitespaces()
+ end := start + int32(length)
nthOffsets = append(nthOffsets, Offset{int32(start), int32(end)})
}
sort.Sort(ByOrder(nthOffsets))