mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09:18:19 +00:00
vim-patch:8.1.0402: the DiffUpdate event isn't triggered for :diffput
Problem: The DiffUpdate event isn't triggered for :diffput.
Solution: Also trigger DiffUpdate for :diffget and :diffput.
198fa066b2
This commit is contained in:
@@ -268,7 +268,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1,
|
|||||||
linenr_T line2, long amount, long amount_after)
|
linenr_T line2, long amount, long amount_after)
|
||||||
{
|
{
|
||||||
if (diff_internal()) {
|
if (diff_internal()) {
|
||||||
// Will udpate 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.
|
||||||
tp->tp_diff_invalid = true;
|
tp->tp_diff_invalid = true;
|
||||||
@@ -886,6 +886,8 @@ void ex_diffupdate(exarg_T *eap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int had_diffs = curtab->tp_first_diff != NULL;
|
||||||
|
|
||||||
// Delete all diffblocks.
|
// Delete all diffblocks.
|
||||||
diff_clear(curtab);
|
diff_clear(curtab);
|
||||||
curtab->tp_diff_invalid = false;
|
curtab->tp_diff_invalid = false;
|
||||||
@@ -899,7 +901,7 @@ void ex_diffupdate(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (idx_orig == DB_COUNT) {
|
if (idx_orig == DB_COUNT) {
|
||||||
return;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only need to do something when there is another buffer.
|
// Only need to do something when there is another buffer.
|
||||||
@@ -911,7 +913,7 @@ void ex_diffupdate(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (idx_new == DB_COUNT) {
|
if (idx_new == DB_COUNT) {
|
||||||
return;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only use the internal method if it did not fail for one of the buffers.
|
// Only use the internal method if it did not fail for one of the buffers.
|
||||||
@@ -929,9 +931,13 @@ void ex_diffupdate(exarg_T *eap)
|
|||||||
// force updating cursor position on screen
|
// force updating cursor position on screen
|
||||||
curwin->w_valid_cursor.lnum = 0;
|
curwin->w_valid_cursor.lnum = 0;
|
||||||
|
|
||||||
diff_redraw(true);
|
theend:
|
||||||
|
// A redraw is needed if there were diffs and they were cleared, or there
|
||||||
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, false, curbuf);
|
// are diffs now, which means they got updated.
|
||||||
|
if (had_diffs || curtab->tp_first_diff != NULL) {
|
||||||
|
diff_redraw(true);
|
||||||
|
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, false, curbuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -2176,7 +2182,8 @@ int diffopt_changed(void)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If "icase" or "iwhite" was added or removed, need to update the diff.
|
// If flags were added or removed, or the algorithm was changed, need to
|
||||||
|
// update the diff.
|
||||||
if (diff_flags != diff_flags_new || diff_algorithm != diff_algorithm_new) {
|
if (diff_flags != diff_flags_new || diff_algorithm != diff_algorithm_new) {
|
||||||
FOR_ALL_TABS(tp) {
|
FOR_ALL_TABS(tp) {
|
||||||
tp->tp_diff_invalid = true;
|
tp->tp_diff_invalid = true;
|
||||||
@@ -2734,15 +2741,17 @@ theend:
|
|||||||
if (diff_need_update) {
|
if (diff_need_update) {
|
||||||
diff_need_update = false;
|
diff_need_update = false;
|
||||||
ex_diffupdate(NULL);
|
ex_diffupdate(NULL);
|
||||||
|
} else {
|
||||||
|
// Check that the cursor is on a valid character and update it's
|
||||||
|
// position. When there were filler lines the topline has become
|
||||||
|
// invalid.
|
||||||
|
check_cursor();
|
||||||
|
changed_line_abv_curs();
|
||||||
|
|
||||||
|
// Also need to redraw the other buffers.
|
||||||
|
diff_redraw(false);
|
||||||
|
apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, false, curbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the cursor is on a valid character and update it's position.
|
|
||||||
// When there were filler lines the topline has become invalid.
|
|
||||||
check_cursor();
|
|
||||||
changed_line_abv_curs();
|
|
||||||
|
|
||||||
// Also need to redraw the other buffers.
|
|
||||||
diff_redraw(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update folds for all diff buffers for entry "dp".
|
/// Update folds for all diff buffers for entry "dp".
|
||||||
|
Reference in New Issue
Block a user