From de2df4a183e3bc67221970223f28a9ec079e7e33 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sat, 3 Oct 2026 17:47:42 -0700 Subject: [PATCH] fix(eficore): don't panic when filling a rectangle past the right edge The slice start was after its end when the rectangle began beyond the framebuffer width, which happens when the cursor is at the right edge. --- crates/eficore/src/framebuffer.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/eficore/src/framebuffer.rs b/crates/eficore/src/framebuffer.rs index 481881c..3944551 100644 --- a/crates/eficore/src/framebuffer.rs +++ b/crates/eficore/src/framebuffer.rs @@ -46,8 +46,11 @@ impl Framebuffer { pub fn fill_rect(&mut self, x: usize, y: usize, width: usize, height: usize, color: BltPixel) { let end_x = x.saturating_add(width).min(self.width); let end_y = y.saturating_add(height).min(self.height); + if x >= end_x { + return; + } for row in y..end_y { - // The row is in bounds, so its range is within the pixels. + // The row and columns are in bounds, so its range is within the pixels. self.pixels[row * self.width + x..row * self.width + end_x].fill(color); } }