Compare commits
No commits in common. "6603e60951d7d002d317c4e89da2bcbf05d37b88" and "640904adddb14eb002dfc8c94f8e4024a0ed804e" have entirely different histories.
6603e60951
...
640904addd
1 changed files with 1 additions and 27 deletions
|
|
@ -1475,37 +1475,11 @@ pub const Editor = struct {
|
|||
_ = self.plane.putc(&cell) catch {};
|
||||
}
|
||||
|
||||
/// Get delta line from HEAD version with diffs
|
||||
inline fn get_delta_lines_until_row(self: *const Self, row_: usize) ?usize {
|
||||
const row: isize = @intCast(row_);
|
||||
var delta_lines: isize = 0;
|
||||
|
||||
for (self.changes.items) |change| {
|
||||
if (change.line > row)
|
||||
break;
|
||||
|
||||
if (change.kind == .insert)
|
||||
if (row >= change.line and row < change.line + change.lines)
|
||||
return null;
|
||||
|
||||
switch (change.kind) {
|
||||
.insert => delta_lines -= @intCast(change.lines),
|
||||
.delete => delta_lines += @intCast(change.lines),
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
|
||||
const head_line = delta_lines + row;
|
||||
return if (head_line < 0) null else @intCast(head_line);
|
||||
}
|
||||
|
||||
fn render_blame(self: *Self, theme: *const Widget.Theme, hl_row: ?usize, cell_map: CellMap) !void {
|
||||
const cursor = self.get_primary().cursor;
|
||||
const pos = self.screen_cursor(&cursor) orelse return;
|
||||
const buffer = self.buffer orelse return;
|
||||
|
||||
const blame_row = self.get_delta_lines_until_row(cursor.row) orelse return;
|
||||
const commit = buffer.get_vcs_blame(blame_row) orelse return;
|
||||
const commit = buffer.get_vcs_blame(cursor.row) orelse return;
|
||||
|
||||
var buf: std.Io.Writer.Allocating = .init(self.allocator);
|
||||
defer buf.deinit();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue