From 1a4b128af336d497deab540ec976db7f7926064e Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 4 Jul 2025 21:36:17 -0400 Subject: [PATCH] replace nested if for readability --- src/renderer/cell.zig | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/renderer/cell.zig b/src/renderer/cell.zig index 083adee40..97b24aa90 100644 --- a/src/renderer/cell.zig +++ b/src/renderer/cell.zig @@ -145,15 +145,14 @@ pub const Contents = struct { self.fg_rows.lists[0].clearRetainingCapacity(); self.fg_rows.lists[self.size.rows + 1].clearRetainingCapacity(); - if (v) |cell| { - if (cursor_style) |style| { - switch (style) { - // Block cursors should be drawn first - .block => self.fg_rows.lists[0].appendAssumeCapacity(cell), - // Other cursor styles should be drawn last - .block_hollow, .bar, .underline, .lock => self.fg_rows.lists[self.size.rows + 1].appendAssumeCapacity(cell), - } - } + const cell = v orelse return; + const style = cursor_style orelse return; + + switch (style) { + // Block cursors should be drawn first + .block => self.fg_rows.lists[0].appendAssumeCapacity(cell), + // Other cursor styles should be drawn last + .block_hollow, .bar, .underline, .lock => self.fg_rows.lists[self.size.rows + 1].appendAssumeCapacity(cell), } }