From 1a8c024f6a66d3ea509cc40c3bde2b8b3e006ad0 Mon Sep 17 00:00:00 2001 From: li6in9muyou Date: Wed, 16 Jul 2025 22:12:02 +0800 Subject: [PATCH] feat(file-history): customize the max length of commit subject before truncating --- doc/diffview_defaults.txt | 1 + lua/diffview/config.lua | 1 + lua/diffview/scene/views/file_history/render.lua | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/diffview_defaults.txt b/doc/diffview_defaults.txt index 1ff1f7db..5734e5fe 100644 --- a/doc/diffview_defaults.txt +++ b/doc/diffview_defaults.txt @@ -62,6 +62,7 @@ DEFAULT CONFIG *diffview.defaults* }, }, file_history_panel = { + max_len_commit_subject = 72, log_options = { -- See |diffview-config-log_options| git = { single_file = { diff --git a/lua/diffview/config.lua b/lua/diffview/config.lua index f1f6d0f1..16054e6d 100644 --- a/lua/diffview/config.lua +++ b/lua/diffview/config.lua @@ -83,6 +83,7 @@ M.defaults = { }, }, file_history_panel = { + max_len_commit_subject = 72, log_options = { ---@type ConfigLogOptions git = { diff --git a/lua/diffview/scene/views/file_history/render.lua b/lua/diffview/scene/views/file_history/render.lua index 24b13970..232b839f 100644 --- a/lua/diffview/scene/views/file_history/render.lua +++ b/lua/diffview/scene/views/file_history/render.lua @@ -142,7 +142,7 @@ local function render_entries(panel, parent, entries, updating) comp:add_text((" (%s)"):format(entry.commit.ref_names), "DiffviewReference") end - local subject = utils.str_trunc(entry.commit.subject, 72) + local subject = utils.str_trunc(entry.commit.subject, c.file_history_panel.max_len_commit_subject) if subject == "" then subject = "[empty message]"