refactor(optionstr.c): align comments (#22070)

Align comments in did_set_string_option_for() at column 57.
This commit is contained in:
zeertzjq
2023-02-01 08:17:18 +08:00
committed by GitHub
parent 8376486e8f
commit 249b9de405

View File

@@ -638,13 +638,11 @@ char *check_stl_option(char *s)
return NULL;
}
static int shada_idx = -1;
/// Check for a "normal" directory or file name in some options. Disallow a
/// path separator (slash and/or backslash), wildcards and characters that are
/// often illegal in a file name. Be more permissive if "secure" is off.
static bool check_illegal_path_names(char *val, uint32_t flags)
{
// Disallow a path separator (slash and/or backslash), wildcards and
// characters that are often illegal in a file name. Be more permissive
// if "secure" is off.
return (((flags & P_NFNAME)
&& strpbrk(val, (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
|| ((flags & P_NDNAME)
@@ -701,8 +699,8 @@ static void did_set_breakindentopt(win_T *win, char **errmsg)
static void did_set_isopt(buf_T *buf, bool *did_chartab, char **errmsg)
{
// 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[]
// If the new option is invalid, use old value. 'lisp' option: refill
// g_chartab[] for '-' char
// If the new option is invalid, use old value.
// 'lisp' option: refill g_chartab[] for '-' char
if (buf_init_chartab(buf, true) == FAIL) {
*did_chartab = true; // need to restore it below
*errmsg = e_invarg; // error in value
@@ -1013,6 +1011,8 @@ static void did_set_verbosefile(char **errmsg)
}
}
static int shada_idx = -1;
static void did_set_shada(vimoption_T **opt, int *opt_idx, bool *free_oldval, char *errbuf,
size_t errbuflen, char **errmsg)
{
@@ -1272,6 +1272,16 @@ static void did_set_completeopt(char **errmsg)
}
}
#ifdef BACKSLASH_IN_FILENAME
static void did_set_completeslash(buf_T *buf, char **errmsg)
{
if (check_opt_strings(p_csl, p_csl_values, false) != OK
|| check_opt_strings(buf->b_p_csl, p_csl_values, false) != OK) {
*errmsg = e_invarg;
}
}
#endif
static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, char **errmsg)
{
if (check_signcolumn(*varp) != OK) {
@@ -1561,7 +1571,7 @@ static void do_filetype_autocmd(buf_T *buf, char **varp, int opt_flags, bool val
}
}
static void did_set_spelllang_source(win_T *win)
static void do_spelllang_source(win_T *win)
{
char fname[200];
char *q = win->w_s->b_p_spl;
@@ -1614,30 +1624,29 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
char **gvarp = (char **)get_varp_scope(opt, OPT_GLOBAL);
// Disallow changing some options from secure mode
if ((secure || sandbox != 0)
&& (opt->flags & P_SECURE)) {
if ((secure || sandbox != 0) && (opt->flags & P_SECURE)) {
errmsg = e_secure;
} else if (check_illegal_path_names(*varp, opt->flags)) {
// Check for a "normal" directory or file name in some options.
} else if (check_illegal_path_names(*varp, opt->flags)) {
errmsg = e_invarg;
} else if (gvarp == &p_bkc) { // 'backupcopy'
did_set_backupcopy(buf, oldval, opt_flags, &errmsg);
} else if (varp == &p_bex || varp == &p_pm) { // 'backupext' and 'patchmode'
} else if (varp == &p_bex // 'backupext'
|| varp == &p_pm) { // 'patchmode'
did_set_backupext_or_patchmode(&errmsg);
} else if (varp == &win->w_p_briopt) { // 'breakindentopt'
did_set_breakindentopt(win, &errmsg);
} else if (varp == &p_isi
|| varp == &buf->b_p_isk
|| varp == &p_isp
|| varp == &p_isf) {
// 'isident', 'iskeyword', 'isprint or 'isfname' option
} else if (varp == &p_isi // 'isident'
|| varp == &buf->b_p_isk // 'iskeyword'
|| varp == &p_isp // 'isprint'
|| varp == &p_isf) { // 'isfname'
did_set_isopt(buf, &did_chartab, &errmsg);
} else if (varp == &p_hf) { // 'helpfile'
did_set_helpfile();
} else if (varp == &p_rtp || varp == &p_pp) { // 'runtimepath' 'packpath'
} else if (varp == &p_rtp // 'runtimepath'
|| varp == &p_pp) { // 'packpath'
runtime_search_path_invalidate();
} else if (varp == &win->w_p_culopt
|| gvarp == &win->w_allbuf_opt.wo_culopt) { // 'cursorlineopt'
} else if (gvarp == &win->w_allbuf_opt.wo_culopt) { // 'cursorlineopt'
did_set_cursorlineopt(win, varp, &errmsg);
} else if (varp == &win->w_p_cc) { // 'colorcolumn'
errmsg = check_colorcolumn(win);
@@ -1657,7 +1666,8 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_opt_flags(p_rdb, p_rdb_values, &rdb_flags, true, &errmsg);
} else if (varp == &p_sbo) { // 'scrollopt'
did_set_opt_strings(p_sbo, p_scbopt_values, true, &errmsg);
} else if (varp == &p_ambw || (int *)varp == &p_emoji) { // 'ambiwidth'
} else if (varp == &p_ambw // 'ambiwidth'
|| (int *)varp == &p_emoji) { // 'emoji'
did_set_ambiwidth(&errmsg);
} else if (varp == &p_bg) { // 'background'
did_set_background(&errmsg);
@@ -1669,10 +1679,11 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_winaltkeys(&errmsg);
} else if (varp == &p_ei) { // 'eventignore'
did_set_eventignore(&errmsg);
} else if (varp == &p_enc || gvarp == &p_fenc || gvarp == &p_menc) {
// 'encoding', 'fileencoding' and 'makeencoding'
} else if (varp == &p_enc // 'encoding'
|| gvarp == &p_fenc // 'fileencoding'
|| gvarp == &p_menc) { // 'makeencoding'
did_set_encoding(buf, varp, gvarp, opt_flags, &errmsg);
} else if (varp == &buf->b_p_keymap) {
} else if (varp == &buf->b_p_keymap) { // 'keymap'
did_set_keymap(buf, varp, opt_flags, value_checked, &errmsg);
} else if (gvarp == &p_ff) { // 'fileformat'
did_set_fileformat(buf, varp, oldval, opt_flags, &errmsg);
@@ -1682,7 +1693,8 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_matchpairs(varp, &errmsg);
} else if (gvarp == &p_com) { // 'comments'
did_set_comments(varp, errbuf, errbuflen, &errmsg);
} else if (varp == &p_lcs || varp == &p_fcs) { // global 'listchars' or 'fillchars'
} else if (varp == &p_lcs // global 'listchars'
|| varp == &p_fcs) { // global 'fillchars'
did_set_global_listfillchars(win, varp, opt_flags, &errmsg);
} else if (varp == &win->w_p_lcs) { // local 'listchars'
errmsg = set_chars_option(win, varp, true);
@@ -1702,8 +1714,8 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
langmap_set();
} else if (varp == &p_breakat) { // 'breakat'
fill_breakat_flags();
} else if (varp == &p_titlestring || varp == &p_iconstring) {
// 'titlestring' and 'iconstring'
} else if (varp == &p_titlestring // 'titlestring'
|| varp == &p_iconstring) { // 'iconstring'
did_set_titleiconstring(varp);
} else if (varp == &p_sel) { // 'selection'
did_set_selection(&errmsg);
@@ -1727,11 +1739,11 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_opt_strings(p_ead, p_ead_values, false, &errmsg);
} else if (varp == &p_cb) { // 'clipboard'
did_set_opt_flags(p_cb, p_cb_values, &cb_flags, true, &errmsg);
} else if (varp == &win->w_s->b_p_spf) {
} else if (varp == &win->w_s->b_p_spf) { // 'spellfile'
did_set_spellfile(varp, &errmsg);
} else if (varp == &win->w_s->b_p_spl) { // 'spell'
did_set_spell(varp, &errmsg);
} else if (varp == &win->w_s->b_p_spc) {
} else if (varp == &win->w_s->b_p_spc) { // 'spellcapcheck'
did_set_spellcapcheck(win, &errmsg);
} else if (varp == &win->w_s->b_p_spo) { // 'spelloptions'
did_set_spelloptions(win, &errmsg);
@@ -1739,13 +1751,15 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_spellsuggest(&errmsg);
} else if (varp == &p_msm) { // 'mkspellmem'
did_set_mkspellmem(&errmsg);
} else if (gvarp == &p_bh) {
} else if (gvarp == &p_bh) { // 'bufhidden'
did_set_opt_strings(buf->b_p_bh, p_bufhidden_values, false, &errmsg);
} else if (gvarp == &p_bt) { // 'buftype'
did_set_buftype(buf, win, &errmsg);
} else if (gvarp == &p_stl || gvarp == &p_wbr || varp == &p_tal
|| varp == &p_ruf || varp == &win->w_p_stc) {
// 'statusline', 'winbar', 'tabline', 'rulerformat' or 'statuscolumn'
} else if (gvarp == &p_stl // 'statusline'
|| gvarp == &p_wbr // 'winbar'
|| varp == &p_tal // 'tabline'
|| varp == &p_ruf // 'rulerformat'
|| varp == &win->w_p_stc) { // 'statuscolumn'
did_set_statusline(win, varp, gvarp, &errmsg);
} else if (gvarp == &p_cpt) { // 'complete'
did_set_complete(varp, errbuf, errbuflen, &errmsg);
@@ -1753,18 +1767,13 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_completeopt(&errmsg);
#ifdef BACKSLASH_IN_FILENAME
} else if (gvarp == &p_csl) { // 'completeslash'
if (check_opt_strings(p_csl, p_csl_values, false) != OK
|| check_opt_strings(buf->b_p_csl, p_csl_values, false) != OK) {
errmsg = e_invarg;
}
did_set_completeslash(buf, &errmsg);
#endif
} else if (varp == &win->w_p_scl) { // 'signcolumn'
did_set_signcolumn(win, varp, oldval, &errmsg);
} else if (varp == &p_sloc) { // 'showcmdloc'
did_set_opt_strings(*varp, p_sloc_values, false, &errmsg);
} else if (varp == &win->w_p_fdc
|| varp == &win->w_allbuf_opt.wo_fdc) {
// 'foldcolumn'
} else if (gvarp == &win->w_allbuf_opt.wo_fdc) { // 'foldcolumn'
did_set_foldcolumn(varp, &errmsg);
} else if (varp == &p_pt) { // 'pastetoggle'
did_set_pastetoggle();
@@ -1799,9 +1808,10 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_lispoptions(varp, &errmsg);
} else if (varp == &p_icm) { // 'inccommand'
did_set_opt_strings(*varp, p_icm_values, false, &errmsg);
} else if (gvarp == &p_ft || gvarp == &p_syn) {
} else if (gvarp == &p_ft // 'filetype'
|| gvarp == &p_syn) { // 'syntax'
did_set_filetype_or_syntax(varp, oldval, value_checked, &value_changed, &errmsg);
} else if (varp == &win->w_p_winhl) {
} else if (varp == &win->w_p_winhl) { // 'winhighlight'
did_set_winhl(win, &errmsg);
} else if (varp == &p_tpf) {
did_set_opt_flags(p_tpf, p_tpf_values, &tpf_flags, true, &errmsg);
@@ -1845,7 +1855,7 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_option_listflag(varp, COCU_ALL, errbuf, errbuflen, &errmsg);
} else if (varp == &p_mouse) { // 'mouse'
did_set_option_listflag(varp, MOUSE_ALL, errbuf, errbuflen, &errmsg);
} else if (gvarp == &p_flp) {
} else if (gvarp == &p_flp) { // 'formatlistpat'
if (win->w_briopt_list) {
// Changing Formatlistpattern when briopt includes the list setting:
// redraw
@@ -1853,7 +1863,7 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
}
}
// If error detected, restore the previous value.
// If an error is detected, restore the previous value.
if (errmsg != NULL) {
free_string_option(*varp);
*varp = oldval;
@@ -1890,7 +1900,7 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
} else if (varp == &buf->b_p_ft) {
do_filetype_autocmd(buf, varp, opt_flags, value_changed);
} else if (varp == &win->w_s->b_p_spl) {
did_set_spelllang_source(win);
do_spelllang_source(win);
}
}