diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-10-10 15:22:05 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-10-10 22:04:25 -0400 |
commit | 9606317486416aeba590d44fd9fcc955834d1e3b (patch) | |
tree | 03759dd403a84d1fef6eae7a537d3d05cd438547 /src/nvim/quickfix.c | |
parent | e82b8ddef16eb7ce96e1d3d063ff529f79ed6bb2 (diff) | |
download | rneovim-9606317486416aeba590d44fd9fcc955834d1e3b.tar.gz rneovim-9606317486416aeba590d44fd9fcc955834d1e3b.tar.bz2 rneovim-9606317486416aeba590d44fd9fcc955834d1e3b.zip |
vim-patch:8.1.0988: deleting location list buffer breaks location list window
Problem: Deleting a location list buffer breaks location list window
functionality.
Solution: (Yegappan Lakshmanan, closes vim/vim#4056)
https://github.com/vim/vim/commit/d82a81cad93708a6c180e59119db4818cc38c1a9
Cherry-pick Xqbuf_test() changes from patch 8.1.0892.
Patch 8.1.0892 triggers a memory leak.
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 1582ce3bd6..06fed9c2cf 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3581,6 +3581,18 @@ static int qf_goto_cwindow(const qf_info_T *qi, bool resize, int sz, return OK; } +// Set options for the buffer in the quickfix or location list window. +static void qf_set_cwindow_options(void) +{ + // switch off 'swapfile' + set_option_value("swf", 0L, NULL, OPT_LOCAL); + set_option_value("bt", 0L, "quickfix", OPT_LOCAL); + set_option_value("bh", 0L, "hide", OPT_LOCAL); + RESET_BINDING(curwin); + curwin->w_p_diff = false; + set_option_value("fdm", 0L, "manual", OPT_LOCAL); +} + // Open a new quickfix or location list window, load the quickfix buffer and // set the appropriate options for the window. // Returns FAIL if the window could not be opened. @@ -3629,17 +3641,17 @@ static int qf_open_new_cwindow(qf_info_T *qi, int height) // Create a new quickfix buffer (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin); - // switch off 'swapfile' - set_option_value("swf", 0L, NULL, OPT_LOCAL); - set_option_value("bt", 0L, "quickfix", OPT_LOCAL); - set_option_value("bh", 0L, "hide", OPT_LOCAL); - RESET_BINDING(curwin); - curwin->w_p_diff = false; - set_option_value("fdm", 0L, "manual", OPT_LOCAL); // save the number of the new buffer qi->qf_bufnr = curbuf->b_fnum; } + // Set the options for the quickfix buffer/window (if not already done) + // Do this even if the quickfix buffer was already present, as an autocmd + // might have previously deleted (:bdelete) the quickfix buffer. + if (curbuf->b_p_bt[0] != 'q') { + qf_set_cwindow_options(); + } + // Only set the height when still in the same tab page and there is no // window to the side. if (curtab == prevtab && curwin->w_width == Columns) { |