comparison src/evalbuffer.c @ 31255:87ff5e71d3c2 v9.0.0961

patch 9.0.0961: using deletebufline() may jump to another window Commit: https://github.com/vim/vim/commit/3da8597fc07505c0f8839b0834aafe1c10ffb456 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 27 19:45:49 2022 +0000 patch 9.0.0961: using deletebufline() may jump to another window Problem: Using deletebufline() may jump to another window. Solution: Do not use a window where the buffer was only in the past. (closes #11594)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Nov 2022 21:00:05 +0100
parents 7831da568864
children d8e7d725a666
comparison
equal deleted inserted replaced
31254:fac14d7d7c2b 31255:87ff5e71d3c2
107 static void 107 static void
108 find_win_for_curbuf(void) 108 find_win_for_curbuf(void)
109 { 109 {
110 wininfo_T *wip; 110 wininfo_T *wip;
111 111
112 // The b_wininfo list should have the windows that recently contained the
113 // buffer, going over this is faster than going over all the windows.
114 // Do check the buffer is still there.
112 FOR_ALL_BUF_WININFO(curbuf, wip) 115 FOR_ALL_BUF_WININFO(curbuf, wip)
113 { 116 {
114 if (wip->wi_win != NULL) 117 if (wip->wi_win != NULL && wip->wi_win->w_buffer == curbuf)
115 { 118 {
116 curwin = wip->wi_win; 119 curwin = wip->wi_win;
117 break; 120 break;
118 } 121 }
119 } 122 }