vim-patch:7.4.2204

Problem:    It is not easy to get information about buffers, windows and
            tabpages.
Solution:   Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan
            Lakshmanan)

b5ae48e9ff
This commit is contained in:
James McCoy
2016-11-15 12:06:10 -05:00
parent 99a8cd3be0
commit 0046641070
9 changed files with 425 additions and 2 deletions

View File

@@ -6923,3 +6923,28 @@ bool signcolumn_on(win_T *wp)
}
return wp->w_buffer->b_signlist != NULL;
}
/// Get window or buffer local options.
dict_T * get_winbuf_options(int bufopt)
{
dict_T *d = dict_alloc();
for (int opt_idx = 0; options[opt_idx].fullname; opt_idx++) {
struct vimoption *opt = &options[opt_idx];
if ((bufopt && (opt->indir & PV_BUF))
|| (!bufopt && (opt->indir & PV_WIN))) {
char_u *varp = get_varp(opt);
if (varp != NULL) {
if (opt->flags & P_STRING) {
dict_add_nr_str(d, opt->fullname, 0L, *(char_u **)varp);
} else {
dict_add_nr_str(d, opt->fullname, *varp, NULL);
}
}
}
}
return d;
}