diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-16 06:35:30 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-02-16 07:18:06 +0800 |
commit | c1fa8789c1ba5549dc37163dfa9be039c5092a41 (patch) | |
tree | 9c39a44906067eb3e9dffc762f0ce7a36dbfd27b /src/nvim/quickfix.c | |
parent | d60eeacae4ce4aa780636b90199ac20af609e91b (diff) | |
download | rneovim-c1fa8789c1ba5549dc37163dfa9be039c5092a41.tar.gz rneovim-c1fa8789c1ba5549dc37163dfa9be039c5092a41.tar.bz2 rneovim-c1fa8789c1ba5549dc37163dfa9be039c5092a41.zip |
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
https://github.com/vim/vim/commit/f0d3d4a42657dca996e790aa829de3c6be7fdb63
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 14758c8cea..16290b76c6 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -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 |