mirror of
https://github.com/neovim/neovim.git
synced 2025-09-09 04:48:18 +00:00
Merge #7345 'location-list update on buffer-modified'
This commit is contained in:
@@ -951,11 +951,17 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2,
|
|||||||
one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum));
|
one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum));
|
||||||
one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum));
|
one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum));
|
||||||
|
|
||||||
/* quickfix marks */
|
// quickfix marks
|
||||||
qf_mark_adjust(NULL, line1, line2, amount, amount_after);
|
if (!qf_mark_adjust(NULL, line1, line2, amount, amount_after)) {
|
||||||
/* location lists */
|
curbuf->b_has_qf_entry &= ~BUF_HAS_QF_ENTRY;
|
||||||
|
}
|
||||||
|
// location lists
|
||||||
|
bool found_one = false;
|
||||||
FOR_ALL_TAB_WINDOWS(tab, win) {
|
FOR_ALL_TAB_WINDOWS(tab, win) {
|
||||||
qf_mark_adjust(win, line1, line2, amount, amount_after);
|
found_one |= qf_mark_adjust(win, line1, line2, amount, amount_after);
|
||||||
|
}
|
||||||
|
if (!found_one) {
|
||||||
|
curbuf->b_has_qf_entry &= ~BUF_HAS_LL_ENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
sign_mark_adjust(line1, line2, amount, amount_after);
|
sign_mark_adjust(line1, line2, amount, amount_after);
|
||||||
|
@@ -2379,7 +2379,8 @@ static void qf_free(qf_info_T *qi, int idx)
|
|||||||
/*
|
/*
|
||||||
* qf_mark_adjust: adjust marks
|
* qf_mark_adjust: adjust marks
|
||||||
*/
|
*/
|
||||||
void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)
|
bool qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount,
|
||||||
|
long amount_after)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
qfline_T *qfp;
|
qfline_T *qfp;
|
||||||
@@ -2389,11 +2390,12 @@ void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long
|
|||||||
int buf_has_flag = wp == NULL ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
|
int buf_has_flag = wp == NULL ? BUF_HAS_QF_ENTRY : BUF_HAS_LL_ENTRY;
|
||||||
|
|
||||||
if (!(curbuf->b_has_qf_entry & buf_has_flag)) {
|
if (!(curbuf->b_has_qf_entry & buf_has_flag)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (wp != NULL) {
|
if (wp != NULL) {
|
||||||
if (wp->w_llist == NULL)
|
if (wp->w_llist == NULL) {
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
qi = wp->w_llist;
|
qi = wp->w_llist;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2414,9 +2416,7 @@ void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found_one) {
|
return found_one;
|
||||||
curbuf->b_has_qf_entry &= ~buf_has_flag;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -7,6 +7,7 @@ local command = helpers.command
|
|||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
local curbufmeths = helpers.curbufmeths
|
local curbufmeths = helpers.curbufmeths
|
||||||
|
local source = helpers.source
|
||||||
|
|
||||||
local file_base = 'Xtest-functional-ex_cmds-quickfix_commands'
|
local file_base = 'Xtest-functional-ex_cmds-quickfix_commands'
|
||||||
|
|
||||||
@@ -81,3 +82,30 @@ for _, c in ipairs({'l', 'c'}) do
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe('quickfix', function()
|
||||||
|
it('location-list update on buffer modification', function()
|
||||||
|
source([[
|
||||||
|
new
|
||||||
|
setl bt=nofile
|
||||||
|
let lines = ['Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5']
|
||||||
|
call append(0, lines)
|
||||||
|
new
|
||||||
|
setl bt=nofile
|
||||||
|
call append(0, lines)
|
||||||
|
let qf_item = {
|
||||||
|
\ 'lnum': 4,
|
||||||
|
\ 'text': "This is the error line.",
|
||||||
|
\ }
|
||||||
|
let qf_item['bufnr'] = bufnr('%')
|
||||||
|
call setloclist(0, [qf_item])
|
||||||
|
wincmd p
|
||||||
|
let qf_item['bufnr'] = bufnr('%')
|
||||||
|
call setloclist(0, [qf_item])
|
||||||
|
1del _
|
||||||
|
call append(0, ['New line 1', 'New line 2', 'New line 3'])
|
||||||
|
silent ll
|
||||||
|
]])
|
||||||
|
eq({0, 6, 1, 0, 1}, funcs.getcurpos())
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
Reference in New Issue
Block a user