terminal: make switch true/false more idiomatic zig

This commit is contained in:
Mitchell Hashimoto
2023-09-22 23:12:46 -07:00
parent e73d8ff378
commit 056de47b76

View File

@ -1028,13 +1028,10 @@ pub fn eraseDisplay(
defer tracy.end(); defer tracy.end();
// Erasing clears all attributes / colors _except_ the background // Erasing clears all attributes / colors _except_ the background
switch (self.screen.cursor.pen.attrs.has_bg) { self.screen.cursor.pen = if (!self.screen.cursor.pen.attrs.has_bg) .{} else .{
true => { .bg = self.screen.cursor.pen.bg,
const bg = self.screen.cursor.pen.bg; .attrs = .{ .has_bg = true },
self.screen.cursor.pen = .{ .bg = bg, .attrs = .{ .has_bg = true } }; };
},
false => self.screen.cursor.pen = .{},
}
switch (mode) { switch (mode) {
.complete => { .complete => {