From 629749b3832aaec86929794a527c108e5c1c29d1 Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Fri, 3 May 2024 20:59:30 +0200 Subject: [PATCH] Fix out of bounds issue when using the Delete key Signed-off-by: AnErrupTion --- src/tui/components/Text.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tui/components/Text.zig b/src/tui/components/Text.zig index 22c0fc4..fe8b0d1 100644 --- a/src/tui/components/Text.zig +++ b/src/tui/components/Text.zig @@ -118,6 +118,8 @@ fn goRight(self: *Text) void { } fn delete(self: *Text) void { + if (self.cursor >= self.end) return; + _ = self.text.orderedRemove(self.cursor); self.end -= 1;