mirror of
https://github.com/zoriya/kitty.git
synced 2026-08-15 18:53:34 +00:00
run go modernizer
This commit is contained in:
@@ -142,8 +142,8 @@ func bestWordMatch(queryToken string, words []wordToken, colText string) (score
|
||||
|
||||
// Compound token: try exact substring match in the column text
|
||||
colLower := strings.ToLower(colText)
|
||||
if idx := strings.Index(colLower, queryToken); idx != -1 {
|
||||
runeIdx := len([]rune(colLower[:idx]))
|
||||
if before, _, ok := strings.Cut(colLower, queryToken); ok {
|
||||
runeIdx := len([]rune(before))
|
||||
qRuneLen := len([]rune(queryToken))
|
||||
subParts := strings.FieldsFunc(queryToken, isWordDelimiter)
|
||||
return 4 * len(subParts), runeRange(runeIdx, runeIdx+qRuneLen)
|
||||
|
||||
@@ -23,8 +23,8 @@ func testBinding(key, action, help string) Binding {
|
||||
// Action. Action is derived as the first word of actionDisplay.
|
||||
func testMouseBinding(key, actionDisplay string) Binding {
|
||||
action := actionDisplay
|
||||
if idx := strings.IndexByte(actionDisplay, ' '); idx >= 0 {
|
||||
action = actionDisplay[:idx]
|
||||
if before, _, ok := strings.Cut(actionDisplay, " "); ok {
|
||||
action = before
|
||||
}
|
||||
return Binding{
|
||||
Key: key,
|
||||
|
||||
@@ -245,7 +245,7 @@ func TestWatchForConfigChangesDebounce(t *testing.T) {
|
||||
// Write to the file several times rapidly within the debounce window.
|
||||
// The fswatcher debouncer drops events that occur within the cooldown period
|
||||
// after the first event, so only the first write should produce an action call.
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := range 5 {
|
||||
write_file(t, main_conf, fmt.Sprintf("font_size %d\n", 12+i))
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user