fix(git): separate blame gutter from buffer text
This commit is contained in:
+8
-25
@@ -390,25 +390,6 @@ local function render_inline(buf)
|
||||
})
|
||||
end
|
||||
|
||||
---The native fold / sign / number column items, each emitted only when
|
||||
---its window option is on.
|
||||
---@param win integer
|
||||
---@return string
|
||||
local function native_items(win)
|
||||
local wo = vim.wo[win]
|
||||
local items = ""
|
||||
if wo.foldcolumn ~= "0" then
|
||||
items = items .. "%C"
|
||||
end
|
||||
if wo.signcolumn ~= "no" then
|
||||
items = items .. "%s"
|
||||
end
|
||||
if wo.number or wo.relativenumber then
|
||||
items = items .. "%l"
|
||||
end
|
||||
return items
|
||||
end
|
||||
|
||||
---The maximum width the native fold / sign / number columns can occupy.
|
||||
---Computed from the window options, not evaluated: evaluating a
|
||||
---statuscolumn reports the window's current gutter width, which the
|
||||
@@ -515,10 +496,6 @@ local function gutter(win, lnum, virtnum)
|
||||
return (virtnum == 0 and state.blame_text[lnum]) or state.blame_blank or ""
|
||||
end
|
||||
|
||||
M._gutter = gutter
|
||||
M._layout = layout
|
||||
M._native_width = native_width
|
||||
|
||||
function M.statuscolumn()
|
||||
local ok, result =
|
||||
pcall(gutter, vim.api.nvim_get_current_win(), vim.v.lnum, vim.v.virtnum)
|
||||
@@ -556,7 +533,10 @@ local function refresh_gutter_columns()
|
||||
if on and not has_blame then
|
||||
saved_statuscolumn[win] = saved_statuscolumn[win]
|
||||
or vim.wo[win].statuscolumn
|
||||
set_statuscolumn(win, BLAME_EXPR .. native_items(win))
|
||||
set_statuscolumn(
|
||||
win,
|
||||
BLAME_EXPR .. "%C%s%l" .. (native_width(win) > 0 and " " or "")
|
||||
)
|
||||
elseif not on and has_blame then
|
||||
set_statuscolumn(
|
||||
win,
|
||||
@@ -584,7 +564,10 @@ local function render(buf)
|
||||
build_blame_text(state, win)
|
||||
built = true
|
||||
end
|
||||
set_statuscolumn(win, BLAME_EXPR .. native_items(win))
|
||||
set_statuscolumn(
|
||||
win,
|
||||
BLAME_EXPR .. "%C%s%l" .. (native_width(win) > 0 and " " or "")
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user