Compare commits

...

2 commits

Author SHA1 Message Date
Miguel Granero
1034872e8f refactor: avoid unnecessary casts 2026-02-11 17:08:36 +01:00
Miguel Granero
d60611deba refactor: change display style of blame commit summary to a max width 2026-02-11 17:08:36 +01:00

View file

@ -1546,11 +1546,6 @@ pub const Editor = struct {
const blame_row = self.get_delta_lines_until_row(cursor.row) orelse return;
const commit = buffer.get_vcs_blame(blame_row) orelse return;
var buf: std.Io.Writer.Allocating = .init(self.allocator);
defer buf.deinit();
_ = buf.writer.print("  {s}, {s}", .{ commit.summary, commit.author }) catch 0;
const msg = buf.written();
const screen_width = self.view.cols;
var space_begin = screen_width;
while (space_begin > 0) : (space_begin -= 1)
@ -1562,6 +1557,22 @@ pub const Editor = struct {
.bg = if (hl_row) |_| theme.editor_line_highlight.bg else theme.editor_hint.bg,
});
const static_text = "  , ";
const summary_freespace = screen_width -| (space_begin + static_text.len + commit.author.len);
var buf: std.Io.Writer.Allocating = .init(self.allocator);
defer buf.deinit();
if (summary_freespace >= commit.summary.len) {
_ = buf.writer.print("  {s}, {s}", .{ commit.summary, commit.author }) catch 0;
} else if (summary_freespace <= 3) {
_ = buf.writer.print("  {s}", .{commit.author}) catch 0;
} else {
_ = buf.writer.print("  {s}..., {s}", .{ commit.summary[0..summary_freespace -| 3], commit.author }) catch 0;
}
const msg = buf.written();
switch (tui.config().inline_vcs_blame_alignment) {
.left => {
const width = self.plane.window.width;