From 100f986e81d710e93e7edc67dd20c3e00252cb8f Mon Sep 17 00:00:00 2001 From: Alexandre ABRIOUX Date: Fri, 11 Sep 2026 16:07:58 +0200 Subject: [PATCH] fix(conflicts): display menu as a virtual line --- lua/vgit/git/GitBuffer.lua | 6 +++--- lua/vgit/ui/Extmark.lua | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lua/vgit/git/GitBuffer.lua b/lua/vgit/git/GitBuffer.lua index 3b818139..be8cf9ef 100644 --- a/lua/vgit/git/GitBuffer.lua +++ b/lua/vgit/git/GitBuffer.lua @@ -277,11 +277,11 @@ function GitBuffer:render_conflict_help_text(conflict) end if help_text ~= '' then - self.conflict_extmark:text({ + self.conflict_extmark:virt_line({ text = help_text, hl = 'GitComment', - row = current.top - 2, - col = 0, + row = current.top - 1, + above = true, }) end diff --git a/lua/vgit/ui/Extmark.lua b/lua/vgit/ui/Extmark.lua index f67912df..e73892b3 100644 --- a/lua/vgit/ui/Extmark.lua +++ b/lua/vgit/ui/Extmark.lua @@ -16,6 +16,7 @@ function Extmark:constructor(bufnr, ns_name_extension) text = 10, sign = 100, lnum = 1000, + virt_line = 10000, }, ns_id = ns_id, } @@ -91,6 +92,23 @@ function Extmark:text(opts) }) end +function Extmark:virt_line(opts) + local hl = opts.hl + local row = opts.row + local text = opts.text + local priority = opts.priority + local above = opts.above + if above == nil then above = true end + + local id = self:derive_id(row, 'virt_line') + return pcall(vim.api.nvim_buf_set_extmark, self.bufnr, self.ns_id, row, 0, { + id = id, + virt_lines = { { { text, hl } } }, + virt_lines_above = above, + priority = priority, + }) +end + function Extmark:lnum(opts) local hl = opts.hl local row = opts.row