mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2025-02-23 08:16:53 +00:00
parent
cd1c11cf09
commit
1bff8d610f
16
lua/gitsigns/actions.lua
generated
16
lua/gitsigns/actions.lua
generated
@ -568,9 +568,9 @@ end
|
||||
local function insert_hunk_hlmarks(fmt, hunk)
|
||||
for _, line in ipairs(fmt) do
|
||||
for _, s in ipairs(line) do
|
||||
if s[1] == '<hunk>' then
|
||||
local orig_hl = s[2]
|
||||
s[2] = hlmarks_for_hunk(hunk, orig_hl)
|
||||
local hl = s[2]
|
||||
if s[1] == '<hunk>' and type(hl) == "string" then
|
||||
s[2] = hlmarks_for_hunk(hunk, hl)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -595,17 +595,19 @@ M.preview_hunk = noautocmd(function()
|
||||
|
||||
if not hunk then return end
|
||||
|
||||
local lines_spec = lines_format({
|
||||
local lines_fmt = {
|
||||
{ { 'Hunk <hunk_no> of <num_hunks>', 'Title' } },
|
||||
{ { '<hunk>', 'Normal' } },
|
||||
}, {
|
||||
}
|
||||
|
||||
insert_hunk_hlmarks(lines_fmt, hunk)
|
||||
|
||||
local lines_spec = lines_format(lines_fmt, {
|
||||
hunk_no = index,
|
||||
num_hunks = #bcache.hunks,
|
||||
hunk = gs_hunks.patch_lines(hunk, vim.bo[cbuf].fileformat),
|
||||
})
|
||||
|
||||
insert_hunk_hlmarks(lines_spec, hunk)
|
||||
|
||||
popup.create(lines_spec, config.preview_config)
|
||||
end)
|
||||
|
||||
|
@ -568,9 +568,9 @@ end
|
||||
local function insert_hunk_hlmarks(fmt: popup.LinesSpec, hunk: Hunk)
|
||||
for _, line in ipairs(fmt) do
|
||||
for _, s in ipairs(line) do
|
||||
if s[1] == '<hunk>' then
|
||||
local orig_hl = s[2] as string
|
||||
s[2] = hlmarks_for_hunk(hunk, orig_hl)
|
||||
local hl = s[2]
|
||||
if s[1] == '<hunk>' and hl is string then
|
||||
s[2] = hlmarks_for_hunk(hunk, hl)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -595,17 +595,19 @@ M.preview_hunk = noautocmd(function()
|
||||
|
||||
if not hunk then return end
|
||||
|
||||
local lines_spec = lines_format({
|
||||
local lines_fmt = {
|
||||
{{'Hunk <hunk_no> of <num_hunks>', 'Title'}},
|
||||
{{'<hunk>', 'Normal' }}
|
||||
}, {
|
||||
}
|
||||
|
||||
insert_hunk_hlmarks(lines_fmt, hunk)
|
||||
|
||||
local lines_spec = lines_format(lines_fmt, {
|
||||
hunk_no = index,
|
||||
num_hunks = #bcache.hunks,
|
||||
hunk = gs_hunks.patch_lines(hunk, vim.bo[cbuf].fileformat),
|
||||
})
|
||||
|
||||
insert_hunk_hlmarks(lines_spec, hunk)
|
||||
|
||||
popup.create(lines_spec, config.preview_config)
|
||||
end)
|
||||
|
||||
|
@ -477,6 +477,8 @@ global record vim
|
||||
end
|
||||
end
|
||||
notify: function(string, integer, table)
|
||||
pretty_print: function(any)
|
||||
|
||||
split: function(string, string): {string}
|
||||
split: function(string, string, boolean): {string}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user