@@ -119,19 +119,15 @@ pub fn diffLines(a: std.mem.Allocator, path: []const u8, lines: []const []const
119119 return out.items;
120120 }
121121
122-pub fn diffRows(a: std.mem.Allocator, diffs: []const common.FileDiff) []const BodyLine {
123- var out: std.ArrayList(BodyLine) = .empty;
124- for (diffs) |d| {
125- out.append(a, .{ .text = d.path, .style = .{ .fg = theme.current.prompt } }) catch {};
126- if (d.patch) |patch| {
127- const trimmed = std.mem.trimEnd(u8, patch, " \t\r\n");
128- var it = std.mem.splitScalar(u8, trimmed, '\n');
129- var body: std.ArrayList([]const u8) = .empty;
130- while (it.next()) |l| body.append(a, l) catch {};
131- out.appendSlice(a, diffLines(a, d.path, body.items)) catch {};
132- } else if (d.note) |note| {
133- out.append(a, .{ .text = note, .style = .{ .fg = theme.current.comment } }) catch {};
134- }
122+pub fn diffBody(a: std.mem.Allocator, d: common.FileDiff) []const BodyLine {
123+ if (d.patch) |patch| {
124+ const trimmed = std.mem.trimEnd(u8, patch, " \t\r\n");
125+ var it = std.mem.splitScalar(u8, trimmed, '\n');
126+ var body: std.ArrayList([]const u8) = .empty;
127+ while (it.next()) |l| body.append(a, l) catch {};
128+ return diffLines(a, d.path, body.items);
135129 }
130+ var out: std.ArrayList(BodyLine) = .empty;
131+ if (d.note) |note| out.append(a, .{ .text = note, .style = .{ .fg = theme.current.comment } }) catch {};
136132 return out.items;
137133 }