0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.1.0113: duplicate code when cleaning undo stack

Problem:  duplicate code when cleaning undo stack
Solution: refactor undo cleanup into a single public function

related: #13928

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2024-02-15 20:17:37 +01:00
parent f0d3d4a426
commit 9071ed8107
7 changed files with 36 additions and 28 deletions

View File

@@ -919,10 +919,9 @@ buf_freeall(buf_T *buf, int flags)
ml_close(buf, TRUE); // close and delete the memline/memfile
buf->b_ml.ml_line_count = 0; // no lines in buffer
if ((flags & BFA_KEEP_UNDO) == 0)
{
u_blockfree(buf); // free the memory allocated for undo
u_clearall(buf); // reset all undo information
}
// free the memory allocated for undo
// and reset all undo information
u_clearallandblockfree(buf);
#ifdef FEAT_SYN_HL
syntax_clear(&buf->b_s); // reset syntax info
#endif