diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-14 20:40:58 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-03-13 13:17:22 +0800 |
commit | 0cf2dc63bf9e3c94e1373142a6198635efd1c514 (patch) | |
tree | d41b1c3e6633a37dff0395c0bd59f44e5814777e /src | |
parent | d33aebb821b7e7c9197b035c9152859e0b6ed712 (diff) | |
download | rneovim-0cf2dc63bf9e3c94e1373142a6198635efd1c514.tar.gz rneovim-0cf2dc63bf9e3c94e1373142a6198635efd1c514.tar.bz2 rneovim-0cf2dc63bf9e3c94e1373142a6198635efd1c514.zip |
fix(win_split_ins): do not fail when oldwin is not valid
Ref #14240
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/quickfix.c | 9 | ||||
-rw-r--r-- | src/nvim/window.c | 8 |
2 files changed, 3 insertions, 14 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index bddbd04af9..edd4d17e67 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3646,15 +3646,6 @@ static int qf_open_new_cwindow(qf_info_T *qi, int height) if (win_split(height, flags) == FAIL) { return FAIL; // not enough room for window } - - // User autocommands may have invalidated the previous window after calling - // win_split, so add a check to ensure that the win is still here - if (IS_LL_STACK(qi) && !win_valid(win)) { - // close the window that was supposed to be for the loclist - win_close(curwin, false, false); - return FAIL; - } - RESET_BINDING(curwin); if (IS_LL_STACK(qi)) { diff --git a/src/nvim/window.c b/src/nvim/window.c index d5299202b0..faf4b117f4 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1420,13 +1420,11 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir) p_wh = i; } - if (!win_valid(oldwin)) { - return FAIL; + if (win_valid(oldwin)) { + // Send the window positions to the UI + oldwin->w_pos_changed = true; } - // Send the window positions to the UI - oldwin->w_pos_changed = true; - return OK; } |