diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-12-10 14:03:44 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-12-16 12:46:59 +0100 |
commit | 2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4 (patch) | |
tree | d7bb06b9366e0640d4299a3c7adce644f8e4086e /src/nvim/eval/buffer.c | |
parent | 9c6a3703bb15d56fecdd962512f69f0ccf6d398c (diff) | |
download | rneovim-2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4.tar.gz rneovim-2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4.tar.bz2 rneovim-2d6f57b2891247f9ca0f6fb75c4b93fb2c714dc4.zip |
refactor(wininfo): change wininfo from a linked list to an array
"wininfo" is going to be my next victim. The main problem with wininfo
is that it is "all or nothing", i e either all state about a buffer in a
window is considered valid or none of it is. This needs to be fixed to
address some long running grievances.
For now this is just a warmup: refactor it from a linked list to a
vector.
Diffstat (limited to 'src/nvim/eval/buffer.c')
-rw-r--r-- | src/nvim/eval/buffer.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c index 73bfd6db2a..b4181eb186 100644 --- a/src/nvim/eval/buffer.c +++ b/src/nvim/eval/buffer.c @@ -66,12 +66,11 @@ buf_T *find_buffer(typval_T *avar) /// If there is a window for "curbuf", make it the current window. static void 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) { + for (size_t i = 0; i < kv_size(curbuf->b_wininfo); i++) { + WinInfo *wip = kv_A(curbuf->b_wininfo, i); if (wip->wi_win != NULL && wip->wi_win->w_buffer == curbuf) { curwin = wip->wi_win; break; |