m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 23:33:39 -05:00

Keep the previous delimiter before frozen columns

This commit is contained in:
Junegunn Choi
2025-11-13 22:38:49 +09:00
parent 535b610a6b
commit 1df99db0b2
3 changed files with 29 additions and 3 deletions

View File

@@ -3546,8 +3546,9 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
if t.freezeLeft > 0 || t.freezeRight > 0 {
tokens = Tokenize(item.text.ToString(), t.delimiter)
}
// 0 1 2| 3 |4 5
// -----> <---
// 0 | 1 | 2 | 3 | 4 | 5
// ------> <------
if t.freezeLeft > 0 {
if len(tokens) > 0 {
token := tokens[util.Min(t.freezeLeft, len(tokens))-1]
@@ -3560,7 +3561,8 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
splitOffset2 = 0
} else if index >= t.freezeLeft {
token := tokens[index]
splitOffset2 = int(token.prefixLength) + token.text.Length()
delimiter := strings.TrimLeftFunc(GetLastDelimiter(token.text.ToString(), t.delimiter), unicode.IsSpace)
splitOffset2 = int(token.prefixLength) + token.text.Length() - len([]rune(delimiter))
}
splitOffset2 = util.Max(splitOffset2, splitOffset1)
}