replace nested if for readability

This commit is contained in:
Daniel
2025-07-04 21:36:17 -04:00
parent 0b4a1e2154
commit 1a4b128af3

View File

@ -145,8 +145,9 @@ pub const Contents = struct {
self.fg_rows.lists[0].clearRetainingCapacity(); self.fg_rows.lists[0].clearRetainingCapacity();
self.fg_rows.lists[self.size.rows + 1].clearRetainingCapacity(); self.fg_rows.lists[self.size.rows + 1].clearRetainingCapacity();
if (v) |cell| { const cell = v orelse return;
if (cursor_style) |style| { const style = cursor_style orelse return;
switch (style) { switch (style) {
// Block cursors should be drawn first // Block cursors should be drawn first
.block => self.fg_rows.lists[0].appendAssumeCapacity(cell), .block => self.fg_rows.lists[0].appendAssumeCapacity(cell),
@ -154,8 +155,6 @@ pub const Contents = struct {
.block_hollow, .bar, .underline, .lock => self.fg_rows.lists[self.size.rows + 1].appendAssumeCapacity(cell), .block_hollow, .bar, .underline, .lock => self.fg_rows.lists[self.size.rows + 1].appendAssumeCapacity(cell),
} }
} }
}
}
/// Access a background cell. Prefer this function over direct indexing /// Access a background cell. Prefer this function over direct indexing
/// of `bg_cells` in order to avoid integer size bugs causing overflows. /// of `bg_cells` in order to avoid integer size bugs causing overflows.