diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 01:01:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 9d2e07e997de155c7dbb894a79e5c11839eab39e (patch) | |
| tree | 45d09fbe224693b2b9426213e59e56d5b1f35224 /src/edit.zig | |
| parent | 425d9beb9c977df364ed83743cb2efdef9429478 (diff) | |
| download | pardes-9d2e07e997de155c7dbb894a79e5c11839eab39e.tar.gz pardes-9d2e07e997de155c7dbb894a79e5c11839eab39e.zip | |
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 <[email protected]>
Diffstat (limited to 'src/edit.zig')
| -rw-r--r-- | src/edit.zig | 7 |
1 files changed, 4 insertions, 3 deletions
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) }); } |
