From 1721e6a1eddd4cdc44fc78e09eb2192bc56b895c Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 30 May 2025 19:43:10 +0900 Subject: [PATCH] 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' --- src/terminal.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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))