mirror of
https://github.com/neovim/neovim.git
synced 2026-02-20 01:09:56 +10:00
fix(undo): u_savecommon uses wrong buffer
Problem: u_savecommon with reload = true wrongly uses curbuf. Solution: use buf. Fix comments.
This commit is contained in:
@@ -382,7 +382,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, bool r
|
||||
u_entry_T *prev_uep;
|
||||
linenr_T size = bot - top - 1;
|
||||
|
||||
// If curbuf->b_u_synced == true make a new header.
|
||||
// If buf->b_u_synced == true make a new header.
|
||||
if (buf->b_u_synced) {
|
||||
// Need to create new entry in b_changelist.
|
||||
buf->b_new_change = true;
|
||||
@@ -401,7 +401,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, bool r
|
||||
}
|
||||
|
||||
// If we undid more than we redid, move the entry lists before and
|
||||
// including curbuf->b_u_curhead to an alternate branch.
|
||||
// including buf->b_u_curhead to an alternate branch.
|
||||
u_header_T *old_curhead = buf->b_u_curhead;
|
||||
if (old_curhead != NULL) {
|
||||
buf->b_u_newhead = old_curhead->uh_next.ptr;
|
||||
@@ -608,7 +608,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, bool r
|
||||
buf->b_u_newhead->uh_entry = uep;
|
||||
if (reload) {
|
||||
// buffer was reloaded, notify text change subscribers
|
||||
curbuf->b_u_newhead->uh_flags |= UH_RELOAD;
|
||||
buf->b_u_newhead->uh_flags |= UH_RELOAD;
|
||||
}
|
||||
buf->b_u_synced = false;
|
||||
undo_undoes = false;
|
||||
|
||||
Reference in New Issue
Block a user