mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Problem: setcellwidths() may make 'listchars' or 'fillchars' invalid. Solution: Check the value and give an error. (closes #9024)
This commit is contained in:
36
src/mbyte.c
36
src/mbyte.c
@@ -5510,6 +5510,8 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
int i;
|
||||
listitem_T **ptrs;
|
||||
cw_interval_T *table;
|
||||
cw_interval_T *cw_table_save;
|
||||
size_t cw_table_size_save;
|
||||
|
||||
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
|
||||
return;
|
||||
@@ -5620,9 +5622,41 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
}
|
||||
|
||||
vim_free(ptrs);
|
||||
vim_free(cw_table);
|
||||
|
||||
cw_table_save = cw_table;
|
||||
cw_table_size_save = cw_table_size;
|
||||
cw_table = table;
|
||||
cw_table_size = l->lv_len;
|
||||
|
||||
// Check that the new value does not conflict with 'fillchars' or
|
||||
// 'listchars'.
|
||||
if (set_chars_option(curwin, &p_fcs) != NULL)
|
||||
{
|
||||
emsg(_(e_conflicts_with_value_of_fillchars));
|
||||
cw_table = cw_table_save;
|
||||
cw_table_size = cw_table_size_save;
|
||||
vim_free(table);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
tabpage_T *tp;
|
||||
win_T *wp;
|
||||
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||
{
|
||||
if (set_chars_option(wp, &wp->w_p_lcs) != NULL)
|
||||
{
|
||||
emsg((e_conflicts_with_value_of_listchars));
|
||||
cw_table = cw_table_save;
|
||||
cw_table_size = cw_table_size_save;
|
||||
vim_free(table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim_free(cw_table_save);
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user