akinsho / git-conflict.nvim

A plugin to visualise and resolve merge conflicts in neovim
1k stars 35 forks source link

Bug: Choosing ours/theirs/base does not work when cursor is on the last line of the change #84

Closed b0o closed 5 months ago

b0o commented 5 months ago

For example, with the following change:

local foo = 1
<<<<<<< HEAD
local value = 5 + 7
print(value)
print(string.format("value is %d", value))
||||||| c59b690
local value = 1 + 1
=======
local value = 1 - 1
>>>>>>> new_branch
print(foo, value)

If the cursor is on the line >>>>>>> new_branch and you run a GitConflictChoose* cmd or call the require("git-conflict").choose() function, nothing will happen. If the cursor is on the line above the last line, it will work as expected.

Interestingly, if the cursor is on the line before the change (local foo = 1), running GitConflictChoose* will work, when I would not expect it to. This leads me to believe this is an off-by-one bug.

See: https://github.com/akinsho/git-conflict.nvim/issues/48#issuecomment-2131531276

jradam commented 5 months ago

Found the issue! I opened a pull request: https://github.com/akinsho/git-conflict.nvim/pull/86

b0o commented 5 months ago

Seems to be fixed, thanks @jradam!