Fix --tiebreak=pathname with non-ASCII text

Fix #4902
This commit is contained in:
Junegunn Choi committed 2026-08-31 18:57:12 +09:00
1 parent f7ae439ff5
commit b395cfbd91
3 files changed
+29 -3

No files matched your search

+3 -3
View File
@@ -82,10 +82,10 @@ func buildResultFromBounds(item *Item, score int, minBegin, minEnd, maxEnd int,
val = item.TrimLength()
case byPathname:
if validOffsetFound {
// Rune index, to be comparable with minBegin
lastDelim := -1
s := item.text.ToString()
for i := len(s) - 1; i >= 0; i-- {
if s[i] == '/' || s[i] == '\\' {
for i := numChars - 1; i >= 0; i-- {
if r := item.text.Get(i); r == '/' || r == '\\' {
lastDelim = i
break
}