Skip to content

Commit 259d0da

Browse files
committed
kitty: Guard hex color conversion
Sometimes there is a color code, where one part is missing, e.g. "#[fg=,bg=terminal]", in which case it would try to parse the empty string as an integer. Fix this by explicitly checking for an empty argument.
1 parent 278b0c8 commit 259d0da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/tpipeline-kitty.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ def parse_stl(screen: Screen, draw_data: DrawData, stl: str, draw: bool):
7777
screen.cursor.fg = as_rgb(int(draw_data.default_fg))
7878
elif f == "fg=bg":
7979
screen.cursor.fg = screen.cursor.bg
80-
else:
80+
elif len(f) > 9:
8181
screen.cursor.fg = as_rgb(int(f[4:10], 16))
8282
elif f.startswith("bg="):
8383
if f == "bg=default" or f == "bg=terminal":
8484
screen.cursor.bg = as_rgb(int(draw_data.default_bg))
8585
elif f == "bg=fg":
8686
screen.cursor.bg = screen.cursor.fg
87-
else:
87+
elif len(f) > 9:
8888
screen.cursor.bg = as_rgb(int(f[4:10], 16))
8989

9090
pos = next + 1

0 commit comments

Comments
 (0)