mirror of
https://github.com/neovim/neovim.git
synced 2025-09-09 12:58:16 +00:00
vim-patch:8.1.0497: :%diffput changes order of lines
Problem: :%diffput changes order of lines. (Markus Braun)
Solution: Do adjust marks when using internal diff.
5f57bdcab7
This commit is contained in:
@@ -271,9 +271,9 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1,
|
|||||||
// Will update diffs before redrawing. Set _invalid to update the
|
// Will update diffs before redrawing. Set _invalid to update the
|
||||||
// diffs themselves, set _update to also update folds properly just
|
// diffs themselves, set _update to also update folds properly just
|
||||||
// before redrawing.
|
// before redrawing.
|
||||||
|
// Do update marks here, it is needed for :%diffput.
|
||||||
tp->tp_diff_invalid = true;
|
tp->tp_diff_invalid = true;
|
||||||
tp->tp_diff_update = true;
|
tp->tp_diff_update = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int inserted;
|
int inserted;
|
||||||
@@ -2742,7 +2742,7 @@ theend:
|
|||||||
ex_diffupdate(NULL);
|
ex_diffupdate(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the cursor is on a valid character and update it's
|
// Check that the cursor is on a valid character and update its
|
||||||
// position. When there were filler lines the topline has become
|
// position. When there were filler lines the topline has become
|
||||||
// invalid.
|
// invalid.
|
||||||
check_cursor();
|
check_cursor();
|
||||||
|
@@ -219,6 +219,26 @@ func Test_diffget_diffput()
|
|||||||
%bwipe!
|
%bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test putting two changes from one buffer to another
|
||||||
|
func Test_diffput_two()
|
||||||
|
new a
|
||||||
|
let win_a = win_getid()
|
||||||
|
call setline(1, range(1, 10))
|
||||||
|
diffthis
|
||||||
|
new b
|
||||||
|
let win_b = win_getid()
|
||||||
|
call setline(1, range(1, 10))
|
||||||
|
8del
|
||||||
|
5del
|
||||||
|
diffthis
|
||||||
|
call win_gotoid(win_a)
|
||||||
|
%diffput
|
||||||
|
call win_gotoid(win_b)
|
||||||
|
call assert_equal(map(range(1, 10), 'string(v:val)'), getline(1, '$'))
|
||||||
|
bwipe! a
|
||||||
|
bwipe! b
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_dp_do_buffer()
|
func Test_dp_do_buffer()
|
||||||
e! one
|
e! one
|
||||||
let bn1=bufnr('%')
|
let bn1=bufnr('%')
|
||||||
|
Reference in New Issue
Block a user