summaryrefslogtreecommitdiff
path: root/core/look.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/look.zig')
-rw-r--r--core/look.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/look.zig b/core/look.zig
index 0b42b603..f9dcfbc3 100644
--- a/core/look.zig
+++ b/core/look.zig
@@ -803,7 +803,7 @@ pub fn advanceLookHover(p: *Pardes) void {
p.look_hover_wait = null;
}
-pub fn focusPaneLine(p: *Pardes, id: usize, at_in: Spot, landing: enum { center, keep }) void {
+pub fn focusPaneLine(p: *Pardes, id: usize, at_in: Spot, landing: enum { center, third, keep }) void {
if (id >= MAX_PANES) return;
const pane = p.panes[id] orelse return;
p.view().active = id;
@@ -822,7 +822,9 @@ pub fn focusPaneLine(p: *Pardes, id: usize, at_in: Spot, landing: enum { center,
if (at.line > panes.File.nlines(p.gpa, f)) return;
// centred (its first row of text half the body's rows down, as
// zz), clamped at the top; a text that fits is shown whole
- if (landing == .center) panes.File.setTop(pane, if (pane.textFits()) .{ .line = 0 } else panes.File.walkRows(p.settings.tab, pane, .{ .line = at.line - 1, .row = panes.File.rowOf(p.settings.tab, pane, at.line - 1, 0) }, -@as(i64, pane.rows / 2)).to);
+ // or a third of them down (a picker's preview, UX D7: context above
+ // its landing line, the rest below)
+ if (landing != .keep) panes.File.setTop(pane, if (pane.textFits()) .{ .line = 0 } else panes.File.walkRows(p.settings.tab, pane, .{ .line = at.line - 1, .row = panes.File.rowOf(p.settings.tab, pane, at.line - 1, 0) }, -@as(i64, if (landing == .third) (pane.rows + 2) / 3 else pane.rows / 2)).to);
}
pane.body.cur_row = std.math.cast(i32, at.line - 1) orelse return;
pane.body.cur_col = columnOn(pane, pane.body.cur_row, at.col);