Skip to content

Commit

Permalink
Merge pull request #1527 from fnune/fnune/fix-hunk-offset-arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey authored Oct 29, 2024
2 parents d46678d + b2e226b commit ad86259
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/neogit/lib/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function Ui:resolve_cursor_location(cursor)

if cursor.hunk.index_from == hunk.index_from then
logger.debug(("[UI] Using hunk.first with offset %q"):format(cursor.hunk.name))
return hunk.first + cursor.hunk_offset - (cursor.last - hunk.last)
return hunk.first + (cursor.hunk_offset or 0) - (cursor.last - hunk.last)
else
logger.debug(("[UI] Using hunk.first %q"):format(cursor.hunk.name))
return hunk.first
Expand Down

0 comments on commit ad86259

Please sign in to comment.