mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-20 10:46:07 +03:00
cli: fix integer overflow in +list-themes
if window is too narrow
Reproduction is to resize the window to it's minimum width and then run `ghostty +list-themes`. Ghostty will crash because Zig for loops don't like having a range where the end is smaller than the start.
This commit is contained in:
@ -1068,6 +1068,7 @@ const Preview = struct {
|
|||||||
.col_offset = 2,
|
.col_offset = 2,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if (child.width > 10) {
|
||||||
for (10..child.width) |col| {
|
for (10..child.width) |col| {
|
||||||
_ = try child.print(
|
_ = try child.print(
|
||||||
&.{
|
&.{
|
||||||
@ -1083,6 +1084,7 @@ const Preview = struct {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_ = try child.print(
|
_ = try child.print(
|
||||||
&.{
|
&.{
|
||||||
.{
|
.{
|
||||||
@ -1118,6 +1120,7 @@ const Preview = struct {
|
|||||||
.col_offset = 2,
|
.col_offset = 2,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if (child.width > 10) {
|
||||||
for (10..child.width) |col| {
|
for (10..child.width) |col| {
|
||||||
_ = try child.print(
|
_ = try child.print(
|
||||||
&.{
|
&.{
|
||||||
@ -1133,6 +1136,7 @@ const Preview = struct {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_ = try child.print(
|
_ = try child.print(
|
||||||
&.{
|
&.{
|
||||||
.{ .text = " 1 │ ", .style = color238 },
|
.{ .text = " 1 │ ", .style = color238 },
|
||||||
@ -1383,6 +1387,7 @@ const Preview = struct {
|
|||||||
.col_offset = 2,
|
.col_offset = 2,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if (child.width > 10) {
|
||||||
for (10..child.width) |col| {
|
for (10..child.width) |col| {
|
||||||
_ = try child.print(
|
_ = try child.print(
|
||||||
&.{
|
&.{
|
||||||
@ -1398,6 +1403,7 @@ const Preview = struct {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_ = try child.print(
|
_ = try child.print(
|
||||||
&.{
|
&.{
|
||||||
.{ .text = "ghostty ", .style = color6 },
|
.{ .text = "ghostty ", .style = color6 },
|
||||||
|
Reference in New Issue
Block a user