Skip to content

Commit

Permalink
fix: bad sign calculation
Browse files Browse the repository at this point in the history
Fixes #544
  • Loading branch information
lewis6991 committed Apr 25, 2022
1 parent ead0d48 commit 3461ffa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions lua/gitsigns/hunks.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions teal/gitsigns/hunks.tl
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,11 @@ function M.calc_signs(hunk: Hunk, min_lnum: integer, max_lnum: integer): {Sign}
end

if hunk.type == "change" and added > removed and
hunk.dend >= min_lnum and hunk.dend <= max_lnum then
local count = added - removed
for lnum = max(hunk.dend, min_lnum), min(hunk.dend + count, max_lnum) do
hunk.vend >= min_lnum and hunk.dend <= max_lnum then
for lnum = max(hunk.dend, min_lnum), min(hunk.vend, max_lnum) do
signs[#signs+1] = {
type = 'add',
count = lnum == hunk.dend and count,
count = lnum == hunk.vend and (added - removed),
lnum = lnum
}
end
Expand Down

0 comments on commit 3461ffa

Please sign in to comment.