summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index c802f0ea..40e49d6a 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -3771,6 +3771,9 @@ pub const Pardes = struct {
/// A mouse sweep is extending the focused header's selection.
header_drag: bool = false,
header_scroll: usize = 0,
+ /// The focused header's first line on screen, which follows its caret
+ /// when it has more lines than rows.
+ header_top: usize = 0,
ov_pinch_scale: f32 = 1.0,
ov_touch_scroll_delta: f32 = 0.0,
/// middle+left chord argument: a kept left selection captured by a left
@@ -5533,6 +5536,13 @@ pub const Pardes = struct {
const lines = std.mem.count(u8, tagline.curTail(pane), "\n") + 1;
pane.tag_rows = @intCast(@min(lines, MAX_TAG_ROWS, @max(BOX_H, r.h -| 1)));
if (pane.collapsed) pane.tag_rows = BOX_H;
+ if (pane.focus == .tag and pane.prompt != .name) {
+ const cur: usize = @intCast(@max(0, pane.tag.cur_row));
+ var top: usize = pane.tag_top;
+ if (cur < top) top = cur;
+ if (cur >= top + pane.tag_rows) top = cur + 1 - pane.tag_rows;
+ pane.tag_top = @intCast(@min(top, lines - pane.tag_rows));
+ } else pane.tag_top = 0;
const cols = @max(1, r.w -| config.GUTTER);
const rows = @max(1, r.h -| pane.tag_rows); // the tag steals the top rows
if ((cols != pane.cols or rows != pane.rows) and r.h > pane.tag_rows) {