summaryrefslogtreecommitdiff
path: root/src/tagline.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/tagline.zig')
-rw-r--r--src/tagline.zig9
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);