mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
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.
This commit is contained in:
@@ -2402,14 +2402,15 @@ static void f_getchangelist(typval_T *argvars, typval_T *rettv, EvalFuncData fpt
|
||||
if (buf == curwin->w_buffer) {
|
||||
changelistindex = curwin->w_changelistidx;
|
||||
} else {
|
||||
wininfo_T *wip;
|
||||
changelistindex = buf->b_changelistlen;
|
||||
|
||||
FOR_ALL_BUF_WININFO(buf, wip) {
|
||||
for (size_t i = 0; i < kv_size(buf->b_wininfo); i++) {
|
||||
WinInfo *wip = kv_A(buf->b_wininfo, i);
|
||||
if (wip->wi_win == curwin) {
|
||||
changelistindex = wip->wi_changelistidx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
changelistindex = wip != NULL ? wip->wi_changelistidx : buf->b_changelistlen;
|
||||
}
|
||||
tv_list_append_number(rettv->vval.v_list, (varnumber_T)changelistindex);
|
||||
|
||||
|
Reference in New Issue
Block a user