From 65246327ddc9383f7a6f203849f3628107f6d1dd Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 31 Aug 2023 19:45:22 -0700 Subject: [PATCH] terminal: add more assertions --- src/terminal/Screen.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 55fff4424..532bb352e 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -412,6 +412,8 @@ pub const Row = struct { /// Attach a grapheme codepoint to the given cell. pub fn attachGrapheme(self: Row, x: usize, cp: u21) !void { + assert(x < self.storage.len - 1); + const cell = &self.storage[x + 1].cell; const key = self.getId() + x + 1; const gop = try self.screen.graphemes.getOrPut(self.screen.alloc, key); @@ -448,6 +450,8 @@ pub const Row = struct { /// Removes all graphemes associated with a cell. pub fn clearGraphemes(self: Row, x: usize) void { + assert(x < self.storage.len - 1); + // Our row is now dirty self.storage[0].header.flags.dirty = true;