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: #13905
closes: #13928
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/quickfix.c b/src/quickfix.c
index dd681ca..3e2d3df 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4829,8 +4829,18 @@
}
// 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)
(void)ml_delete((linenr_T)1);
+
+ // Remove all undo information
+ u_blockfree(curbuf);
+ u_clearall(curbuf);
}
// Check if there is anything to display