mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
vim-patch:9.1.0112: Remove undo information, when cleaning quickfix buffer
Problem: When the quickfix buffer has been modified an autocommand
may invalidate the undo stack (kawarimidoll)
Solution: When clearing the quickfix buffer, also wipe the undo stack
fixes: vim/vim#13905
closes: vim/vim#13928
f0d3d4a426
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -68,6 +68,7 @@
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/types_defs.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/undo.h"
|
||||
#include "nvim/vim_defs.h"
|
||||
#include "nvim/window.h"
|
||||
|
||||
@@ -4142,6 +4143,12 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int q
|
||||
}
|
||||
|
||||
// delete all existing lines
|
||||
//
|
||||
// Note: we cannot store undo information, because
|
||||
// qf buffer is usually not allowed to be modified.
|
||||
//
|
||||
// So we need to clean up undo information
|
||||
// otherwise autocommands may invalidate the undo stack
|
||||
while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) {
|
||||
// If deletion fails, this loop may run forever, so
|
||||
// signal error and return.
|
||||
@@ -4150,6 +4157,10 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int q
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all undo information
|
||||
u_blockfree(curbuf);
|
||||
u_clearall(curbuf);
|
||||
}
|
||||
|
||||
// Check if there is anything to display
|
||||
|
Reference in New Issue
Block a user