aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/undo.c14
-rw-r--r--src/nvim/undo_defs.h7
2 files changed, 16 insertions, 5 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index da464c56dc..8c2ae3bc35 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -580,6 +580,10 @@ int u_savecommon(linenr_T top, linenr_T bot, linenr_T newbot, int reload)
uep->ue_array = NULL;
uep->ue_next = curbuf->b_u_newhead->uh_entry;
curbuf->b_u_newhead->uh_entry = uep;
+ if (reload) {
+ // buffer was reloaded, notify text change subscribers
+ curbuf->b_u_newhead->uh_flags |= UH_RELOAD;
+ }
curbuf->b_u_synced = false;
undo_undoes = false;
@@ -2157,8 +2161,9 @@ static void u_undoredo(int undo, bool do_buf_event)
u_check(FALSE);
#endif
old_flags = curhead->uh_flags;
- new_flags = (curbuf->b_changed ? UH_CHANGED : 0) +
- ((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0);
+ new_flags = (curbuf->b_changed ? UH_CHANGED : 0)
+ | ((curbuf->b_ml.ml_flags & ML_EMPTY) ? UH_EMPTYBUF : 0)
+ | (old_flags & UH_RELOAD);
setpcmark();
/*
@@ -2299,6 +2304,11 @@ static void u_undoredo(int undo, bool do_buf_event)
extmark_apply_undo(undo_info, undo);
}
}
+ if (curhead->uh_flags & UH_RELOAD) {
+ // TODO(bfredl): this is a bit crude. When 'undoreload' is used we
+ // should have all info to send a buffer-reloaing on_lines/on_bytes event
+ buf_updates_unload(curbuf, true);
+ }
// finish Adjusting extmarks
diff --git a/src/nvim/undo_defs.h b/src/nvim/undo_defs.h
index cc2c39a711..b46295a15d 100644
--- a/src/nvim/undo_defs.h
+++ b/src/nvim/undo_defs.h
@@ -69,9 +69,10 @@ struct u_header {
#endif
};
-/* values for uh_flags */
-#define UH_CHANGED 0x01 /* b_changed flag before undo/after redo */
-#define UH_EMPTYBUF 0x02 /* buffer was empty */
+// values for uh_flags
+#define UH_CHANGED 0x01 // b_changed flag before undo/after redo
+#define UH_EMPTYBUF 0x02 // buffer was empty
+#define UH_RELOAD 0x04 // buffer was reloaded
/// Structure passed around between undofile functions.
typedef struct {