diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 22:02:04 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | b660adabce36e90cbfbb52d95715528983376ab5 (patch) | |
| tree | 655cbad2aee854430700359d454dce7f626dc651 /src/look.zig | |
| parent | 0acd945d85887da88f2863219e706000ca738cdd (diff) | |
| download | pardes-b660adabce36e90cbfbb52d95715528983376ab5.tar.gz pardes-b660adabce36e90cbfbb52d95715528983376ab5.zip | |
A pane whose whole text fits in its rows never scrolls to keep a margin
The scroll margin reveals text; with none off screen there is nothing to
reveal. ensureCursorVisible and a centred look both leave such a pane at its
top. A longer file keeps helix's clamp (hxdiff and hxparity unchanged).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/look.zig')
| -rw-r--r-- | src/look.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/look.zig b/src/look.zig index b6a89b64..a413bf50 100644 --- a/src/look.zig +++ b/src/look.zig @@ -968,7 +968,8 @@ pub fn focusPaneLine(p: *Pardes, id: usize, at: Spot, landing: enum { center, ke if (pane.file) |*f| { if (at.line > panes.File.nlines(p.gpa, f)) return; if (landing == .center) { - const next = (at.line - 1) -| pane.rows / 2; // center, clamp at top + // center, clamp at top; a text that fits is shown whole + const next = if (pane.textFits()) 0 else (at.line - 1) -| pane.rows / 2; if (next != f.scroll) { f.scroll = next; f.syntax_dirty = true; |
