From 9d2e07e997de155c7dbb894a79e5c11839eab39e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 01:01:35 -0300 Subject: Scroll a tag taller than its rows to keep its caret in view A tag shows at most eight rows, so a longer one (a 9P write of many lines, or `o` in the tag) put its caret on a line that was never drawn. Pane, column and workspace tags now keep a first line on screen that follows the caret while they have the keyboard, and the pointer and the pane text count their rows from it. Co-Authored-By: Claude Opus 5.5 --- src/edit.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/edit.zig') diff --git a/src/edit.zig b/src/edit.zig index edc86dd2..42032168 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -131,12 +131,13 @@ pub fn clipYank(p: *Pardes, pane: *Pane, main_only: bool) void { } /// tag + '\n' + body: the full selectable pane text, a row to a screen row -/// (the tag's lines first, as many as it shows) +/// (the tag's lines first, the ones it shows) pub fn paneText(p: *Pardes, pane: *Pane) ![]u8 { const arena = p.scratch.allocator(); const tag = try tagline.tagText(p, arena, pane); - const cut = modal.lineStartOffset(tag, pane.tag_rows); - const shown = if (cut < tag.len) tag[0 .. cut - 1] else tag; + const from = modal.lineStartOffset(tag, pane.tag_top); + const cut = modal.lineStartOffset(tag, pane.tag_top + pane.tag_rows); + const shown = if (cut < tag.len) tag[from .. cut - 1] else tag[from..]; return std.fmt.allocPrint(arena, "{s}\n{s}", .{ shown, try body_layer.bodyText(p, arena, pane) }); } -- cgit v1.3