diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-11-27 19:45:49 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-27 19:45:49 +0000 |
commit | 3da8597fc07505c0f8839b0834aafe1c10ffb456 (patch) | |
tree | f8a2ef6f53114411a856dd25bff8c9e502a1647f /src/evalbuffer.c | |
parent | 502e91756e99181d5fe668fad2e868dc7f3f4fea (diff) |
patch 9.0.0961: using deletebufline() may jump to another windowv9.0.0961
Problem: Using deletebufline() may jump to another window.
Solution: Do not use a window where the buffer was only in the past.
(closes #11594)
Diffstat (limited to 'src/evalbuffer.c')
-rw-r--r-- | src/evalbuffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/evalbuffer.c b/src/evalbuffer.c index 52662a6533..82a10d675c 100644 --- a/src/evalbuffer.c +++ b/src/evalbuffer.c @@ -109,9 +109,12 @@ find_win_for_curbuf(void) { wininfo_T *wip; + // The b_wininfo list should have the windows that recently contained the + // buffer, going over this is faster than going over all the windows. + // Do check the buffer is still there. FOR_ALL_BUF_WININFO(curbuf, wip) { - if (wip->wi_win != NULL) + if (wip->wi_win != NULL && wip->wi_win->w_buffer == curbuf) { curwin = wip->wi_win; break; |