Make --accept-nth compatible with --select-1
Some checks are pending
CodeQL / Analyze (go) (push) Waiting to run
Test fzf on Linux / build (push) Waiting to run
Test fzf on macOS / build (push) Waiting to run

Fix #4287
This commit is contained in:
Junegunn Choi
2025-02-26 00:24:41 +09:00
parent bb64d84ce4
commit 710ebdf9c1
4 changed files with 22 additions and 4 deletions

View File

@@ -1575,9 +1575,7 @@ func (t *Terminal) output() bool {
}
if t.acceptNth != nil {
transform = func(item *Item) string {
tokens := Tokenize(item.AsString(t.ansi), t.delimiter)
transformed := t.acceptNth(tokens, item.Index())
return StripLastDelimiter(transformed, t.delimiter)
return item.acceptNth(t.ansi, t.delimiter, t.acceptNth)
}
}
found := len(t.selected) > 0