mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 15:23:48 -05:00
Allow ^EqualMatch$
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package algo
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/junegunn/fzf/src/util"
|
||||
@@ -159,3 +160,17 @@ func SuffixMatch(caseSensitive bool, input *[]rune, pattern []rune) (int, int) {
|
||||
}
|
||||
return trimmedLen - len(pattern), trimmedLen
|
||||
}
|
||||
|
||||
func EqualMatch(caseSensitive bool, runes *[]rune, pattern []rune) (int, int) {
|
||||
if len(*runes) != len(pattern) {
|
||||
return -1, -1
|
||||
}
|
||||
runesStr := string(*runes)
|
||||
if !caseSensitive {
|
||||
runesStr = strings.ToLower(runesStr)
|
||||
}
|
||||
if runesStr == string(pattern) {
|
||||
return 0, len(pattern)
|
||||
}
|
||||
return -1, -1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user