mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-11 19:19:35 +02:00
run modernize
This commit is contained in:
@@ -45,7 +45,7 @@ var decoder_array = sync.OnceValue(func() *[256]byte {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
}
|
||||
for i := 0; i < len(encode); i++ {
|
||||
for i := range len(encode) {
|
||||
decode[encode[i]] = byte(i)
|
||||
}
|
||||
return &decode
|
||||
@@ -101,7 +101,7 @@ func decodeChunk(decode *[256]byte, dst, src []byte) (int, int) {
|
||||
var val uint32
|
||||
m := DecodedLen(len(src))
|
||||
buf := [5]byte{84, 84, 84, 84, 84}
|
||||
for i := 0; i < len(src); i++ {
|
||||
for i := range src {
|
||||
e := decode[src[i]]
|
||||
if e == 0xFF {
|
||||
return 0, i + 1
|
||||
@@ -109,7 +109,7 @@ func decodeChunk(decode *[256]byte, dst, src []byte) (int, int) {
|
||||
buf[i] = e
|
||||
}
|
||||
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := range 5 {
|
||||
r := buf[i]
|
||||
val += uint32(r) * decode_base[i]
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func CustomRelTime(a, b time.Time, albl, blbl string, magnitudes []RelTimeMagnit
|
||||
n = len(magnitudes) - 1
|
||||
}
|
||||
mag := magnitudes[n]
|
||||
args := []interface{}{}
|
||||
args := []any{}
|
||||
escaped := false
|
||||
for _, ch := range mag.Format {
|
||||
if escaped {
|
||||
|
||||
@@ -58,14 +58,14 @@ func LongestCommon(next func() (string, bool), prefix bool) string {
|
||||
return ""
|
||||
}
|
||||
if prefix {
|
||||
for i := 0; i < max_len; i++ {
|
||||
for i := range max_len {
|
||||
if xfix[i] != q[i] {
|
||||
xfix = xfix[:i]
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for i := 0; i < max_len; i++ {
|
||||
for i := range max_len {
|
||||
xi := xfix_len - i - 1
|
||||
si := q_len - i - 1
|
||||
if xfix[xi] != q[si] {
|
||||
|
||||
@@ -103,7 +103,7 @@ func ConfigDirForName(name string) (config_dir string) {
|
||||
add(xh)
|
||||
}
|
||||
if dirs := os.Getenv("XDG_CONFIG_DIRS"); dirs != "" {
|
||||
for _, candidate := range strings.Split(dirs, ":") {
|
||||
for candidate := range strings.SplitSeq(dirs, ":") {
|
||||
add(candidate)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,7 @@ func num_to_string(number *big.Int, alphabet []rune, alphabet_len *big.Int, pad_
|
||||
if number.Sign() < 0 {
|
||||
*number = zero
|
||||
}
|
||||
capacity := 64
|
||||
if pad_to_length > capacity {
|
||||
capacity = pad_to_length
|
||||
}
|
||||
capacity := max(pad_to_length, 64)
|
||||
ans := make([]rune, 0, capacity)
|
||||
for number.Cmp(&zero) == 1 {
|
||||
number.DivMod(number, alphabet_len, &digit)
|
||||
|
||||
Reference in New Issue
Block a user