diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 15:26:17 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 830e936da4aca7ea802a6a862fa40c0086defd2f (patch) | |
| tree | 8f2b76129f35fc27263dc975cfb61ac8b4024ea2 /src/tagline.zig | |
| parent | d0b4e65eeaf71c8215cda347e7546f3abc07b25b (diff) | |
| download | pardes-830e936da4aca7ea802a6a862fa40c0086defd2f.tar.gz pardes-830e936da4aca7ea802a6a862fa40c0086defd2f.zip | |
A command of several lines keeps its pane's tag to one row, and the tag never panics on a longer prefix
A two-line exec made a command pane whose tag prefix held the line's newline,
so the tag ran to a second row and tagTintRange sliced its first row past its
end: panic. acme runs a multi-line selection as one command, and so does
pardes; the tag now shows the line's first row, cut at a character's start,
and '...', tagTintRange stays inside the row it is given, and the '% line'
echo turns the line's newlines into the terminal's, so it does not
staircase.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/tagline.zig')
| -rw-r--r-- | src/tagline.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tagline.zig b/src/tagline.zig index 14bf5677..28dffa06 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -112,8 +112,15 @@ pub fn pathPrefix(arena: std.mem.Allocator, pane: *Pane) ![]const u8 { return std.fmt.allocPrint(arena, "{s} [{d}/{d}]", .{ pv.path, pv.page + 1, pv.page_count }); if (pane.image) |*state| return panes.Image.tagPrefix(arena, state); // A command pane: its directory, the line it runs, and how that went. + // Its first line only, cut to 48 bytes at a character's start: a tag's + // first row is where the prefix ends, and a line that ran over to a + // second (acme runs a multi-line selection as one command) would move + // it (body_layer.zig tagTintRange). if (pane.command) |line| { - const shown = line[0..@min(line.len, 48)]; + const first = line[0 .. std.mem.indexOfAny(u8, line, "\r\n") orelse line.len]; + var cut = @min(first.len, 48); + while (cut < first.len and cut > 0 and first[cut] & 0xC0 == 0x80) cut -= 1; + const shown = first[0..cut]; const more = if (shown.len < line.len) "..." else ""; var idbuf: [48]u8 = undefined; const id = exec.replId(&idbuf, pane); |
