Make --accept-nth compatible with --select-1
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:25:23 +09:00
parent bb64d84ce4
commit 710ebdf9c1
4 changed files with 22 additions and 4 deletions
+6
View File
@@ -51,3 +51,9 @@ func (item *Item) AsString(stripAnsi bool) string {
}
return item.text.ToString()
}
func (item *Item) acceptNth(stripAnsi bool, delimiter Delimiter, transformer func([]Token, int32) string) string {
tokens := Tokenize(item.AsString(stripAnsi), delimiter)
transformed := transformer(tokens, item.Index())
return StripLastDelimiter(transformed, delimiter)
}