vim-patch:9.0.1212: cannot read back what setcellwidths() has done (#21867)

Problem:    Cannot read back what setcellwidths() has done.
Solution:   Add getcellwidths(). (Kota Kato, closes vim/vim#11837)

66bb9ae70f

Co-authored-by: Kota Kato <github@kat0h.com>
This commit is contained in:
zeertzjq
2023-01-18 06:50:22 +08:00
committed by GitHub
parent 20b7be2d10
commit f4e03cbdbc
5 changed files with 45 additions and 0 deletions

View File

@@ -2795,6 +2795,21 @@ void f_setcellwidths(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
redraw_all_later(UPD_NOT_VALID);
}
/// "getcellwidths()" function
void f_getcellwidths(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
tv_list_alloc_ret(rettv, (ptrdiff_t)cw_table_size);
for (size_t i = 0; i < cw_table_size; i++) {
list_T *entry = tv_list_alloc(3);
tv_list_append_number(entry, (varnumber_T)cw_table[i].first);
tv_list_append_number(entry, (varnumber_T)cw_table[i].last);
tv_list_append_number(entry, (varnumber_T)cw_table[i].width);
tv_list_append_list(rettv->vval.v_list, entry);
}
}
void f_charclass(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
if (tv_check_for_string_arg(argvars, 0) == FAIL