mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Merge remote-tracking branch 'origin/main' into right-click-to-copy
This commit is contained in:
@ -4370,7 +4370,9 @@ pub const ColorList = struct {
|
|||||||
count += 1;
|
count += 1;
|
||||||
if (count > 64) return error.InvalidValue;
|
if (count > 64) return error.InvalidValue;
|
||||||
|
|
||||||
const color = try Color.parseCLI(raw);
|
// Trim whitespace from each color value
|
||||||
|
const trimmed = std.mem.trim(u8, raw, " \t");
|
||||||
|
const color = try Color.parseCLI(trimmed);
|
||||||
try self.colors.append(alloc, color);
|
try self.colors.append(alloc, color);
|
||||||
try self.colors_c.append(alloc, color.cval());
|
try self.colors_c.append(alloc, color.cval());
|
||||||
}
|
}
|
||||||
@ -4439,6 +4441,14 @@ pub const ColorList = struct {
|
|||||||
try p.parseCLI(alloc, "black,white");
|
try p.parseCLI(alloc, "black,white");
|
||||||
try testing.expectEqual(2, p.colors.items.len);
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
|
||||||
|
// Test whitespace handling
|
||||||
|
try p.parseCLI(alloc, "black, white"); // space after comma
|
||||||
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
try p.parseCLI(alloc, "black , white"); // spaces around comma
|
||||||
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
try p.parseCLI(alloc, " black , white "); // extra spaces at ends
|
||||||
|
try testing.expectEqual(2, p.colors.items.len);
|
||||||
|
|
||||||
// Error cases
|
// Error cases
|
||||||
try testing.expectError(error.ValueRequired, p.parseCLI(alloc, null));
|
try testing.expectError(error.ValueRequired, p.parseCLI(alloc, null));
|
||||||
try testing.expectError(error.InvalidValue, p.parseCLI(alloc, " "));
|
try testing.expectError(error.InvalidValue, p.parseCLI(alloc, " "));
|
||||||
|
Reference in New Issue
Block a user