brewery
notashelf /
3775e25cdffdf83766a39887521084fa6f7c2844

beer

public

A terminal worth pouring time into

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/beer.git

Commit 3775e25cdffd

tarball

NotAShelf <raf@notashelf.dev> · 2026-06-26 21:51 UTC

unverified1 files changed+19-1
beer/grid: scroll to fit image when cursor is near bottom

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ic95b18caca0c575b7d7452c87f9f1f956a6a6964
diff --git a/crates/beer/src/grid/mod.rs b/crates/beer/src/grid/mod.rsindex e775c21..85dec08 100644--- a/crates/beer/src/grid/mod.rs+++ b/crates/beer/src/grid/mod.rs@@ -782,7 +782,25 @@ impl Grid {         rows: usize,         keep_cursor: bool,     ) {-        let (x0, y0) = (self.cursor.x, self.cursor.y);+        let x0 = self.cursor.x;+        // Scroll the screen to make vertical room for the image. Only scroll+        // when the full screen is the active scroll region; a DECSTBM region+        // or the alternate screen keeps the image clipped as before.+        let y0 = if self.top == 0+            && self.bottom == self.rows - 1+            && self.alt_saved.is_none()+        {+            let y0_initial = self.cursor.y;+            let scroll_n = (y0_initial + rows)+                .saturating_sub(self.rows)+                .min(y0_initial);+            if scroll_n > 0 {+                self.scroll_up(scroll_n);+            }+            y0_initial - scroll_n+        } else {+            self.cursor.y+        };         for dy in 0..rows {             let cy = y0 + dy;             if cy >= self.rows {