File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 66 "fmt"
77 "strconv"
88 "strings"
9+ "sync"
910
1011 "kitty/tools/utils/shlex"
1112)
@@ -318,13 +319,9 @@ func parse_spec(spec string) []escape_code {
318319 sgr := sgr_code {}
319320 sparts , _ := shlex .Split (spec )
320321 for _ , p := range sparts {
321- parts := strings .SplitN (p , "=" , 2 )
322- key := parts [0 ]
323- val := ""
324- if len (parts ) == 1 {
322+ key , val , found := strings .Cut (p , "=" )
323+ if ! found {
325324 val = "true"
326- } else {
327- val = parts [1 ]
328325 }
329326 switch key {
330327 case "fg" :
@@ -355,8 +352,11 @@ func parse_spec(spec string) []escape_code {
355352}
356353
357354var parsed_spec_cache = make (map [string ][]escape_code )
355+ var parsed_spec_cache_mutex = sync.Mutex {}
358356
359357func cached_parse_spec (spec string ) []escape_code {
358+ parsed_spec_cache_mutex .Lock ()
359+ defer parsed_spec_cache_mutex .Unlock ()
360360 if val , ok := parsed_spec_cache [spec ]; ok {
361361 return val
362362 }
You can’t perform that action at this time.
0 commit comments