mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2025-02-25 01:06:53 +00:00
Remove some newly broken sign speculation logic
https://github.com/neovim/neovim/pull/12323 means we can no longer see placed signs on deleted lines.
This commit is contained in:
parent
8b2b54de22
commit
1fd587f7e6
12
lua/gitsigns.lua
generated
12
lua/gitsigns.lua
generated
@ -480,19 +480,7 @@ local function speculate_signs(buf, last_orig, last_new)
|
||||
if last_new < last_orig then
|
||||
|
||||
|
||||
local placed = signs.get(buf, last_new + 1)[last_new + 1]
|
||||
|
||||
|
||||
if not placed or not vim.startswith(placed, 'GitSignsAdd') then
|
||||
local stype = last_new == 0 and 'topdelete' or 'delete'
|
||||
local snum = last_new == 0 and 1 or last_new
|
||||
signs.add(config, buf, { [snum] = { type = stype, count = last_orig } })
|
||||
end
|
||||
|
||||
|
||||
for i = last_new + 1, last_orig do
|
||||
signs.remove(buf, i)
|
||||
end
|
||||
elseif last_new > last_orig then
|
||||
|
||||
|
||||
|
@ -479,20 +479,8 @@ end
|
||||
local function speculate_signs(buf: integer, last_orig: integer, last_new: integer)
|
||||
if last_new < last_orig then
|
||||
-- Lines removed
|
||||
|
||||
local placed = signs.get(buf, last_new+1)[last_new+1]
|
||||
|
||||
-- Add a 'delete' sign only if there wasn't an add sign below
|
||||
if not placed or not vim.startswith(placed, 'GitSignsAdd') then
|
||||
local stype: signs.SignType = last_new == 0 and 'topdelete' or 'delete'
|
||||
local snum = last_new == 0 and 1 or last_new
|
||||
signs.add(config, buf, {[snum] = {type=stype, count=last_orig}})
|
||||
end
|
||||
|
||||
-- If lines are removed, make sure to immediately remove the signs
|
||||
for i = last_new+1, last_orig do
|
||||
signs.remove(buf, i)
|
||||
end
|
||||
--
|
||||
-- Cannot do much here due to https://github.com/neovim/neovim/pull/12323
|
||||
elseif last_new > last_orig then
|
||||
-- Lines added
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user