get rid of utils.Cut since we can now rely on strings.Cut instead

This commit is contained in:
Kovid Goyal
2023-03-04 13:37:55 +05:30
parent defac0c061
commit a2887bb9e0
12 changed files with 24 additions and 35 deletions

View File

@@ -7,9 +7,9 @@ import (
"fmt"
"io"
"os"
"strings"
"kitty/tools/tty"
"kitty/tools/utils"
)
func debug(args ...any) {
@@ -81,7 +81,7 @@ func GenerateCompletions(args []string) error {
}
shell_state := make(map[string]string, n)
for _, arg := range args {
k, v, found := utils.Cut(arg, "=")
k, v, found := strings.Cut(arg, "=")
if !found {
return fmt.Errorf("Invalid shell state specification: %s", arg)
}

View File

@@ -36,7 +36,7 @@ func (self *MatchGroup) remove_common_prefix() string {
}
}
} else if len(self.Matches) > 1 && strings.HasPrefix(self.Matches[0].Word, "--") && strings.Contains(self.Matches[0].Word, "=") {
lcp, _, _ := utils.Cut(self.longest_common_prefix(), "=")
lcp, _, _ := strings.Cut(self.longest_common_prefix(), "=")
lcp += "="
if len(lcp) > 3 {
self.remove_prefix_from_all_matches(lcp)

View File

@@ -76,7 +76,7 @@ func (self *Match) FormatForCompletionList(max_word_len int, f *markup.Context,
return word
}
word_len := wcswidth.Stringwidth(word)
line, _, _ := utils.Cut(strings.TrimSpace(desc), "\n")
line, _, _ := strings.Cut(strings.TrimSpace(desc), "\n")
desc = f.Prettify(line)
multiline := false