Handle variable fonts like cascadia code that dont have a postfix variation prefix name for some of their faces

This commit is contained in:
Kovid Goyal
2024-05-18 15:12:56 +05:30
parent 815df1e210
commit b017cc0c1e
7 changed files with 97 additions and 65 deletions

View File

@@ -17,6 +17,7 @@ package shlex
import (
"fmt"
"kitty/tools/utils"
"strings"
"unicode/utf8"
)
@@ -182,6 +183,16 @@ func Split(s string) (ans []string, err error) {
return
}
func Quote(s string) string {
if s == "" {
return s
}
if utils.MustCompile(`[^\w@%+=:,./-]`).MatchString(s) {
return "'" + strings.ReplaceAll(s, "'", "'\"'\"'") + "'"
}
return s
}
// SplitForCompletion partitions a string into a slice of strings. It differs from Split in being
// more relaxed about errors and also adding an empty string at the end if s ends with a Space.
func SplitForCompletion(s string) (argv []string, position_of_last_arg int) {