summaryrefslogtreecommitdiff
path: root/src/tokenizer.go
diff options
context:
space:
mode:
authorphanium <91544758+phanen@users.noreply.github.com>2025-02-21 21:21:55 +0800
committerGitHub <noreply@github.com>2025-02-21 22:21:55 +0900
commit77568e114ff531f4fe14cfaeab6febd53a99b1bc (patch)
treebeef8d15922ab3a241e547a0053dc17b6e5a7769 /src/tokenizer.go
parenta24d274a3cdc680dd2d4e5664121e9727239f3b6 (diff)
downloadfzf-77568e114ff531f4fe14cfaeab6febd53a99b1bc.tar.gz
Don't trim last field when delimiter is regex (#4266)
Diffstat (limited to 'src/tokenizer.go')
-rw-r--r--src/tokenizer.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tokenizer.go b/src/tokenizer.go
index 573a3576..edf36903 100644
--- a/src/tokenizer.go
+++ b/src/tokenizer.go
@@ -225,7 +225,9 @@ func StripLastDelimiter(str string, delimiter Delimiter) string {
locs := delimiter.regex.FindAllStringIndex(str, -1)
if len(locs) > 0 {
lastLoc := locs[len(locs)-1]
- str = str[:lastLoc[0]]
+ if lastLoc[1] == len(str) {
+ str = str[:lastLoc[0]]
+ }
}
}
return strings.TrimRightFunc(str, unicode.IsSpace)