fix: pre-release cleanup for v0.2.0 (#102)
## Problem Three minor issues remain before the v0.2.0 release: 1. Git quotes filenames containing spaces, unicode, or special characters in the fugitive status buffer. `parse_file_line` passed the quotes through verbatim, causing file-not-found errors on diff operations. 2. Navigation wrap-around in both conflict and merge modules was silent, giving no indication when jumping past the last/first item back to the beginning/end. 3. `resolved_hunks` and `(resolved)` virtual text in the merge module persisted across buffer re-reads, showing stale markers for hunks that were no longer resolved. ## Solution 1. Add an `unquote()` helper to fugitive.lua that strips surrounding quotes and unescapes `\\`, `\"`, `\n`, `\t`, and octal `\NNN` sequences. Applied to both return paths in `parse_file_line`. 2. Add `vim.notify` before the wrap-around jump in all four navigation functions (`goto_next`/`goto_prev` in conflict.lua and merge.lua). 3. Clear `resolved_hunks[bufnr]` and the merge namespace at the top of `setup_keymaps` so each buffer init starts fresh. Closes #66
This commit is contained in:
parent
b5d28e9f2b
commit
35067151e4
11 changed files with 393 additions and 931 deletions
|
|
@ -235,29 +235,6 @@ describe('conflict', function()
|
|||
helpers.delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('does not apply virtual text when disabled', function()
|
||||
local bufnr = create_file_buffer({
|
||||
'<<<<<<< HEAD',
|
||||
'local x = 1',
|
||||
'=======',
|
||||
'local x = 2',
|
||||
'>>>>>>> feature',
|
||||
})
|
||||
|
||||
conflict.attach(bufnr, default_config({ show_virtual_text = false }))
|
||||
|
||||
local extmarks = get_extmarks(bufnr)
|
||||
local virt_text_count = 0
|
||||
for _, mark in ipairs(extmarks) do
|
||||
if mark[4] and mark[4].virt_text then
|
||||
virt_text_count = virt_text_count + 1
|
||||
end
|
||||
end
|
||||
assert.are.equal(0, virt_text_count)
|
||||
|
||||
helpers.delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('applies number_hl_group to content lines', function()
|
||||
local bufnr = create_file_buffer({
|
||||
'<<<<<<< HEAD',
|
||||
|
|
@ -532,6 +509,33 @@ describe('conflict', function()
|
|||
helpers.delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('goto_next notifies on wrap-around', function()
|
||||
local bufnr = create_file_buffer({
|
||||
'<<<<<<< HEAD',
|
||||
'a',
|
||||
'=======',
|
||||
'b',
|
||||
'>>>>>>> feat',
|
||||
})
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
vim.api.nvim_win_set_cursor(0, { 5, 0 })
|
||||
|
||||
local notified = false
|
||||
local orig_notify = vim.notify
|
||||
vim.notify = function(msg)
|
||||
if msg:match('wrapped to first conflict') then
|
||||
notified = true
|
||||
end
|
||||
end
|
||||
|
||||
conflict.goto_next(bufnr)
|
||||
vim.notify = orig_notify
|
||||
|
||||
assert.is_true(notified)
|
||||
|
||||
helpers.delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('goto_prev jumps to previous conflict', function()
|
||||
local bufnr = create_file_buffer({
|
||||
'<<<<<<< HEAD',
|
||||
|
|
@ -576,6 +580,33 @@ describe('conflict', function()
|
|||
helpers.delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('goto_prev notifies on wrap-around', function()
|
||||
local bufnr = create_file_buffer({
|
||||
'<<<<<<< HEAD',
|
||||
'a',
|
||||
'=======',
|
||||
'b',
|
||||
'>>>>>>> feat',
|
||||
})
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
vim.api.nvim_win_set_cursor(0, { 1, 0 })
|
||||
|
||||
local notified = false
|
||||
local orig_notify = vim.notify
|
||||
vim.notify = function(msg)
|
||||
if msg:match('wrapped to last conflict') then
|
||||
notified = true
|
||||
end
|
||||
end
|
||||
|
||||
conflict.goto_prev(bufnr)
|
||||
vim.notify = orig_notify
|
||||
|
||||
assert.is_true(notified)
|
||||
|
||||
helpers.delete_buffer(bufnr)
|
||||
end)
|
||||
|
||||
it('goto_next does nothing with no conflicts', function()
|
||||
local bufnr = create_file_buffer({ 'normal line' })
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue