annotate src/optionstr.c @ 31996:ca6bc7c04163 v9.0.1330

patch 9.0.1330: handling new value of an option has a long "else if" chain Commit: https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Feb 20 12:16:39 2023 +0000 patch 9.0.1330: handling new value of an option has a long "else if" chain Problem: Handling new value of an option has a long "else if" chain. Solution: Use a function pointer. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/12015)
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Feb 2023 13:30:05 +0100
parents 4efcb5c68112
children 4545f58c8490
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 * optionstr.c: Functions related to string options
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 #include "vim.h"
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
16 static char_u shm_buf[SHM_LEN];
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
17 static int set_shm_recursive = 0;
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
18
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 static char *(p_ambw_values[]) = {"single", "double", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 static char *(p_bg_values[]) = {"light", "dark", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 static char *(p_bkc_values[]) = {"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 static char *(p_bo_values[]) = {"all", "backspace", "cursor", "complete",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 "copy", "ctrlg", "error", "esc", "ex",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 "hangul", "insertmode", "lang", "mess",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 "showmatch", "operator", "register", "shell",
28439
16bd027b039e patch 8.2.4744: a terminal window can't use the bell
Bram Moolenaar <Bram@vim.org>
parents: 28353
diff changeset
26 "spell", "term", "wildmode", NULL};
20613
9edb439adbea patch 8.2.0860: cannot use CTRL-A and CTRL-X on unsigned numbers
Bram Moolenaar <Bram@vim.org>
parents: 20609
diff changeset
27 static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", "unsigned", NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 #ifdef FEAT_CRYPT
24970
7e9e53a0368f patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents: 24630
diff changeset
30 static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2",
7e9e53a0368f patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents: 24630
diff changeset
31 # ifdef FEAT_SODIUM
7e9e53a0368f patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents: 24630
diff changeset
32 "xchacha20",
7e9e53a0368f patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents: 24630
diff changeset
33 # endif
7e9e53a0368f patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents: 24630
diff changeset
34 NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 static char *(p_cmp_values[]) = {"internal", "keepascii", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 static char *(p_dy_values[]) = {"lastline", "truncate", "uhex", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 #ifdef FEAT_FOLDING
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 "quickfix", "search", "tag", "insert",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 "undo", "jump", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 #ifdef FEAT_SESSION
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24079
diff changeset
44 // Also used for 'viewoptions'! Keep in sync with SSOP_ flags.
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 "localoptions", "options", "help", "blank", "globals", "slash", "unix",
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24079
diff changeset
47 "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", "skiprtp",
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24079
diff changeset
48 NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 #endif
18646
394abd397e15 patch 8.1.2315: not always using the right window when jumping to an error
Bram Moolenaar <Bram@vim.org>
parents: 18574
diff changeset
50 // Keep in sync with SWB_ flags in option.h
394abd397e15 patch 8.1.2315: not always using the right window when jumping to an error
Bram Moolenaar <Bram@vim.org>
parents: 18574
diff changeset
51 static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", "vsplit", "uselast", NULL};
30624
f2f35161d75a patch 9.0.0647: the 'splitscroll' option is not a good name
Bram Moolenaar <Bram@vim.org>
parents: 29853
diff changeset
52 static char *(p_spk_values[]) = {"cursor", "screen", "topline", NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 static char *(p_tc_values[]) = {"followic", "ignore", "match", "followscs", "smart", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", "huge", "giant", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 #endif
18354
9f51d0cef8da patch 8.1.2171: mouse support not always available
Bram Moolenaar <Bram@vim.org>
parents: 18303
diff changeset
60 #if defined(UNIX) || defined(VMS)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", "sgr", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 #endif
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 25064
diff changeset
63 static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", "none", "NONE", NULL};
27875
ae38d2e81fca patch 8.2.4463: completion only uses strict matching
Bram Moolenaar <Bram@vim.org>
parents: 27597
diff changeset
64 static char *(p_wop_values[]) = {"fuzzy", "tagfile", "pum", NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 #ifdef FEAT_WAK
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 static char *(p_wak_values[]) = {"yes", "menu", "no", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 static char *(p_mousem_values[]) = {"extend", "popup", "popup_setpos", "mac", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 static char *(p_sel_values[]) = {"inclusive", "exclusive", "old", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 static char *(p_slm_values[]) = {"mouse", "key", "cmd", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 static char *(p_km_values[]) = {"startsel", "stopsel", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 #ifdef FEAT_BROWSE
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", "prompt", "popup", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
20069
9a67d41708d2 patch 8.2.0590: no 'backspace' value allows ignoring the insertion point
Bram Moolenaar <Bram@vim.org>
parents: 19675
diff changeset
80 static char *(p_bs_values[]) = {"indent", "eol", "start", "nostop", NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 #ifdef FEAT_FOLDING
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 # ifdef FEAT_DIFF
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 "diff",
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 # endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 static char *(p_fcl_values[]) = {"all", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 #endif
18396
ba5d8c5d77d7 patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents: 18354
diff changeset
89 static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "popup", "popuphidden", "noinsert", "noselect", NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 #ifdef BACKSLASH_IN_FILENAME
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 static char *(p_csl_values[]) = {"slash", "backslash", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 #ifdef FEAT_SIGNS
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 static char *(p_scl_values[]) = {"yes", "no", "auto", "number", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 #if defined(MSWIN) && defined(FEAT_TERMINAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 static char *(p_twt_values[]) = {"winpty", "conpty", "", NULL};
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 #endif
31457
bb797331e21b patch 9.0.1061: cannot display 'showcmd' somewhere else
Bram Moolenaar <Bram@vim.org>
parents: 31259
diff changeset
99 static char *(p_sloc_values[]) = {"last", "statusline", "tabline", NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 static int check_opt_strings(char_u *val, char **values, int list);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 static int opt_strings_flags(char_u *val, char **values, unsigned *flagp, int list);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 * After setting various option values: recompute variables that depend on
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 * option values.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 didset_string_options(void)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 #ifdef FEAT_SESSION
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 #ifdef FEAT_FOLDING
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 (void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, FALSE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
18354
9f51d0cef8da patch 8.1.2171: mouse support not always available
Bram Moolenaar <Bram@vim.org>
parents: 18303
diff changeset
124 #if defined(UNIX) || defined(VMS)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 (void)opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 #endif
28839
b93668df9160 patch 8.2.4943: changing 'switchbuf' may have no effect
Bram Moolenaar <Bram@vim.org>
parents: 28459
diff changeset
133 (void)opt_strings_flags(p_swb, p_swb_values, &swb_flags, TRUE);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 #if defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 * Trigger the OptionSet autocommand.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 * "opt_idx" is the index of the option being set.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 * "opt_flags" can be OPT_LOCAL etc.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 * "oldval" the old value
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 * "oldval_l" the old local value (only non-NULL if global and local value
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 * are set)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 * "oldval_g" the old global value (only non-NULL if global and local value
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 * are set)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 * "newval" the new value
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 void
31259
a7dba627a21b patch 9.0.0963: function name does not match autocmd event name
Bram Moolenaar <Bram@vim.org>
parents: 31192
diff changeset
149 trigger_optionset_string(
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 char_u *oldval,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 char_u *oldval_l,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 char_u *oldval_g,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 char_u *newval)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 // Don't do this recursively.
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
158 if (oldval == NULL || newval == NULL
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
159 || *get_vim_var_str(VV_OPTION_TYPE) != NUL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
160 return;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
162 char_u buf_type[7];
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
163
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
164 sprintf((char *)buf_type, "%s",
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 (opt_flags & OPT_LOCAL) ? "local" : "global");
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
166 set_vim_var_string(VV_OPTION_OLD, oldval, -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
167 set_vim_var_string(VV_OPTION_NEW, newval, -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
168 set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
169 if (opt_flags & OPT_LOCAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
170 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
171 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
172 set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
173 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
174 if (opt_flags & OPT_GLOBAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
175 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
176 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
177 set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval, -1);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 }
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
179 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
180 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
181 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
182 set_vim_var_string(VV_OPTION_OLDLOCAL, oldval_l, -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
183 set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval_g, -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
184 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
185 if (opt_flags & OPT_MODELINE)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
186 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
187 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
188 set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, -1);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
189 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
190 apply_autocmds(EVENT_OPTIONSET,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
191 get_option_fullname(opt_idx), NULL, FALSE,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
192 NULL);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
193 reset_v_option_vars();
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 static char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 illegal_char(char *errbuf, int c)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 if (errbuf == NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 return "";
26917
d91aea2a612c patch 8.2.3987: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents: 26883
diff changeset
202 sprintf((char *)errbuf, _(e_illegal_character_str), (char *)transchar(c));
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 return errbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 * Check string options in a buffer for NULL value.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 check_buf_options(buf_T *buf)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 check_string_option(&buf->b_p_bh);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 check_string_option(&buf->b_p_bt);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 check_string_option(&buf->b_p_fenc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 check_string_option(&buf->b_p_ff);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 #ifdef FEAT_FIND_ID
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 check_string_option(&buf->b_p_def);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 check_string_option(&buf->b_p_inc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 # ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 check_string_option(&buf->b_p_inex);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 # endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 #endif
28942
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28839
diff changeset
223 #if defined(FEAT_EVAL)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 check_string_option(&buf->b_p_inde);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 check_string_option(&buf->b_p_indk);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 check_string_option(&buf->b_p_bexpr);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 #if defined(FEAT_CRYPT)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 check_string_option(&buf->b_p_cm);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 check_string_option(&buf->b_p_fp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 #if defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 check_string_option(&buf->b_p_fex);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 #ifdef FEAT_CRYPT
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 check_string_option(&buf->b_p_key);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 check_string_option(&buf->b_p_kp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 check_string_option(&buf->b_p_mps);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 check_string_option(&buf->b_p_fo);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 check_string_option(&buf->b_p_flp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 check_string_option(&buf->b_p_isk);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 check_string_option(&buf->b_p_com);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 #ifdef FEAT_FOLDING
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 check_string_option(&buf->b_p_cms);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 check_string_option(&buf->b_p_nf);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 check_string_option(&buf->b_p_qe);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 #ifdef FEAT_SYN_HL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 check_string_option(&buf->b_p_syn);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 check_string_option(&buf->b_s.b_syn_isk);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 #ifdef FEAT_SPELL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 check_string_option(&buf->b_s.b_p_spc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 check_string_option(&buf->b_s.b_p_spf);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 check_string_option(&buf->b_s.b_p_spl);
20802
ed00f0fbdaef patch 8.2.0953: spell checking doesn't work for CamelCased words
Bram Moolenaar <Bram@vim.org>
parents: 20760
diff changeset
259 check_string_option(&buf->b_s.b_p_spo);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 check_string_option(&buf->b_p_sua);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 check_string_option(&buf->b_p_cink);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 check_string_option(&buf->b_p_cino);
28353
8bc8071928ed patch 8.2.4702: C++ scope labels are hard-coded
Bram Moolenaar <Bram@vim.org>
parents: 28337
diff changeset
264 check_string_option(&buf->b_p_cinsd);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 parse_cino(buf);
30853
40df8a6515f6 patch 9.0.0761: cannot use 'indentexpr' for Lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 30645
diff changeset
266 check_string_option(&buf->b_p_lop);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 check_string_option(&buf->b_p_ft);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 check_string_option(&buf->b_p_cinw);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 check_string_option(&buf->b_p_cpt);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 #ifdef FEAT_COMPL_FUNC
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 check_string_option(&buf->b_p_cfu);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 check_string_option(&buf->b_p_ofu);
25984
c8fcea636252 patch 8.2.3525: option variable name does not match option name
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
273 check_string_option(&buf->b_p_tsrfu);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 #ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 check_string_option(&buf->b_p_tfu);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 #ifdef FEAT_KEYMAP
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 check_string_option(&buf->b_p_keymap);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 #ifdef FEAT_QUICKFIX
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282 check_string_option(&buf->b_p_gp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 check_string_option(&buf->b_p_mp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 check_string_option(&buf->b_p_efm);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 check_string_option(&buf->b_p_ep);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 check_string_option(&buf->b_p_path);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 check_string_option(&buf->b_p_tags);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289 check_string_option(&buf->b_p_tc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 check_string_option(&buf->b_p_dict);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291 check_string_option(&buf->b_p_tsr);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292 check_string_option(&buf->b_p_lw);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 check_string_option(&buf->b_p_bkc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 check_string_option(&buf->b_p_menc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 #ifdef FEAT_VARTABS
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 check_string_option(&buf->b_p_vsts);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 check_string_option(&buf->b_p_vts);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302 * Free the string allocated for an option.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 * Checks for the string being empty_option. This may happen if we're out of
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 * check_options().
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 * Does NOT check for P_ALLOCED flag!
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 free_string_option(char_u *p)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 if (p != empty_option)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 vim_free(p);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 clear_string_option(char_u **pp)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 if (*pp != empty_option)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 vim_free(*pp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 *pp = empty_option;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 check_string_option(char_u **pp)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 if (*pp == NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 *pp = empty_option;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
331 * Set global value for string option when it's a local option.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 static void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 set_string_option_global(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 int opt_idx, // option index
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 char_u **varp) // pointer to option variable
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 char_u **p, *s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340 // the global value is always allocated
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 if (is_window_local_option(opt_idx))
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342 p = (char_u **)GLOBAL_WO(varp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 p = (char_u **)get_option_var(opt_idx);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 if (!is_global_option(opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 && p != varp
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347 && (s = vim_strsave(*varp)) != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349 free_string_option(*p);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 *p = s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355 * Set a string option to a new value (without checking the effect).
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 * The string is copied into allocated memory.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 * When "set_sid" is zero set the scriptID to current_sctx.sc_sid. When
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 * "set_sid" is SID_NONE don't set the scriptID. Otherwise set the scriptID to
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 * "set_sid".
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 set_string_option_direct(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367 int opt_flags, // OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 int set_sid UNUSED)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 char_u *s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 char_u **varp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 int idx = opt_idx;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 if (idx == -1) // use name
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377 idx = findoption(name);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
378 if (idx < 0) // not found (should not happen)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 {
26877
06a137af96f8 patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents: 26865
diff changeset
380 semsg(_(e_internal_error_str), "set_string_option_direct()");
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
381 siemsg(_("For option %s"), name);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
382 return;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
383 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
384 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
385
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
386 if (is_hidden_option(idx)) // can't set hidden option
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387 return;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
388
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389 s = vim_strsave(val);
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
390 if (s == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
391 return;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
392
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
393 varp = (char_u **)get_option_varp_scope(idx,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
394 both ? OPT_LOCAL : opt_flags);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
395 if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED))
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
396 free_string_option(*varp);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
397 *varp = s;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
398
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
399 // For buffer/window local option may also set the global value.
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
400 if (both)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
401 set_string_option_global(idx, varp);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
402
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
403 set_option_flag(idx, P_ALLOCED);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
404
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
405 // When setting both values of a global option with a local value,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
406 // make the local value empty, so that the global value is used.
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
407 if (is_global_local_option(idx) && both)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
408 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
409 free_string_option(*varp);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
410 *varp = empty_option;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
411 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
412 # ifdef FEAT_EVAL
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
413 if (set_sid != SID_NONE)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
414 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
415 sctx_T script_ctx;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
417 if (set_sid == 0)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
418 script_ctx = current_sctx;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
419 else
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
420 {
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
421 script_ctx.sc_sid = set_sid;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
422 script_ctx.sc_seq = 0;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
423 script_ctx.sc_lnum = 0;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
424 script_ctx.sc_version = 1;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
425 }
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
426 set_option_sctx_idx(idx, opt_flags, script_ctx);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
427 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 # endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
432 * Like set_string_option_direct(), but for a window-local option in "wp".
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433 * Blocks autocommands to avoid the old curwin becoming invalid.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
434 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436 set_string_option_direct_in_win(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 win_T *wp,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442 int set_sid)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 win_T *save_curwin = curwin;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446 block_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447 curwin = wp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 curbuf = curwin->w_buffer;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449 set_string_option_direct(name, opt_idx, val, opt_flags, set_sid);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450 curwin = save_curwin;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
451 curbuf = curwin->w_buffer;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 unblock_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454
27018
268f6a3511df patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents: 27000
diff changeset
455 #if defined(FEAT_PROP_POPUP) || defined(PROTO)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
457 * Like set_string_option_direct(), but for a buffer-local option in "buf".
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458 * Blocks autocommands to avoid the old curbuf becoming invalid.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
459 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
460 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 set_string_option_direct_in_buf(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
462 buf_T *buf,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
467 int set_sid)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 buf_T *save_curbuf = curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 block_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 curbuf = buf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 curwin->w_buffer = curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 set_string_option_direct(name, opt_idx, val, opt_flags, set_sid);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 curbuf = save_curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 curwin->w_buffer = curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 unblock_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
478 }
27018
268f6a3511df patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents: 27000
diff changeset
479 #endif
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
480
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
481 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 * Set a string option to a new value, and handle the effects.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
483 *
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
484 * Returns NULL on success or an untranslated error message on error.
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
485 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
486 char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487 set_string_option(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489 char_u *value,
31950
b0717fcca5eb patch 9.0.1307: setting 'formatoptions' with :let doesn't check for errors
Bram Moolenaar <Bram@vim.org>
parents: 31936
diff changeset
490 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL
b0717fcca5eb patch 9.0.1307: setting 'formatoptions' with :let doesn't check for errors
Bram Moolenaar <Bram@vim.org>
parents: 31936
diff changeset
491 char *errbuf)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
492 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
493 char_u *s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
494 char_u **varp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
495 char_u *oldval;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
496 #if defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 char_u *oldval_l = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
498 char_u *oldval_g = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
499 char_u *saved_oldval = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
500 char_u *saved_oldval_l = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
501 char_u *saved_oldval_g = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
502 char_u *saved_newval = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
503 #endif
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
504 char *errmsg = NULL;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
505 int value_checked = FALSE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
506
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
507 if (is_hidden_option(opt_idx)) // don't set hidden option
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
508 return NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
509
19675
bee179e81f28 patch 8.2.0394: Coverity complains about using NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 19265
diff changeset
510 s = vim_strsave(value == NULL ? (char_u *)"" : value);
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
511 if (s == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
512 return NULL;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
513
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
514 varp = (char_u **)get_option_varp_scope(opt_idx,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
515 (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
516 ? (is_global_local_option(opt_idx)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
517 ? OPT_GLOBAL : OPT_LOCAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
518 : opt_flags);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
519 oldval = *varp;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
520 #if defined(FEAT_EVAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
521 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
522 {
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
523 oldval_l = *(char_u **)get_option_varp_scope(opt_idx, OPT_LOCAL);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
524 oldval_g = *(char_u **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
525 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
526 #endif
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
527 *varp = s;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
528
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
529 #if defined(FEAT_EVAL)
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
530 if (!starting
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
531 # ifdef FEAT_CRYPT
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
532 && !is_crypt_key_option(opt_idx)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
533 # endif
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
534 )
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
535 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
536 if (oldval_l != NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
537 saved_oldval_l = vim_strsave(oldval_l);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
538 if (oldval_g != NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
539 saved_oldval_g = vim_strsave(oldval_g);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
540 saved_oldval = vim_strsave(oldval);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
541 saved_newval = vim_strsave(s);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
542 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543 #endif
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
544 if ((errmsg = did_set_string_option(opt_idx, varp, oldval, value, errbuf,
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
545 opt_flags, &value_checked)) == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
546 did_set_option(opt_idx, opt_flags, TRUE, value_checked);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
548 #if defined(FEAT_EVAL)
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
549 // call autocommand after handling side effects
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
550 if (errmsg == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
551 trigger_optionset_string(opt_idx, opt_flags,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
552 saved_oldval, saved_oldval_l,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
553 saved_oldval_g, saved_newval);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
554 vim_free(saved_oldval);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
555 vim_free(saved_oldval_l);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
556 vim_free(saved_oldval_g);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
557 vim_free(saved_newval);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
558 #endif
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
559 return errmsg;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
560 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
561
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
562 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
563 * Return TRUE if "val" is a valid 'filetype' name.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 * Also used for 'syntax' and 'keymap'.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 valid_filetype(char_u *val)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
569 return valid_name(val, ".-_");
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 #ifdef FEAT_STL_OPT
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 * Check validity of options with the 'statusline' format.
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
575 * Return an untranslated error message or NULL.
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
577 static char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 check_stl_option(char_u *s)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580 int groupdepth = 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 static char errbuf[80];
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582
22721
92a100fc5e17 patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents: 22091
diff changeset
583 while (*s)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 // Check for valid keys after % sequences
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 while (*s && *s != '%')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
587 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 if (!*s)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589 break;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 s++;
31936
82da100c0e45 patch 9.0.1300: 'statusline' only supports one "%=" item
Bram Moolenaar <Bram@vim.org>
parents: 31886
diff changeset
591 if (*s == '%' || *s == STL_TRUNCMARK || *s == STL_SEPARATE)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
593 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596 if (*s == ')')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599 if (--groupdepth < 0)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
600 break;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
601 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
602 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603 if (*s == '-')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 while (VIM_ISDIGIT(*s))
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 if (*s == STL_USER_HL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
609 if (*s == '.')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
612 while (*s && VIM_ISDIGIT(*s))
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 if (*s == '(')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617 groupdepth++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
618 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
620 if (vim_strchr(STL_ALL, *s) == NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
622 return illegal_char(errbuf, *s);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 if (*s == '{')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
625 {
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
626 int reevaluate = (*++s == '%');
24630
4cf4d7a71fac patch 8.2.2854: custom statusline cannot contain % items
Bram Moolenaar <Bram@vim.org>
parents: 24582
diff changeset
627
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
628 if (reevaluate && *++s == '}')
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
629 // "}" is not allowed immediately after "%{%"
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
630 return illegal_char(errbuf, '}');
24630
4cf4d7a71fac patch 8.2.2854: custom statusline cannot contain % items
Bram Moolenaar <Bram@vim.org>
parents: 24582
diff changeset
631 while ((*s != '}' || (reevaluate && s[-1] != '%')) && *s)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
632 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
633 if (*s != '}')
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
634 return e_unclosed_expression_sequence;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
635 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 if (groupdepth != 0)
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
638 return e_unbalanced_groups;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
639 return NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
640 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
643 /*
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
644 * Check for a "normal" directory or file name in some options. Disallow a
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
645 * path separator (slash and/or backslash), wildcards and characters that are
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
646 * often illegal in a file name. Be more permissive if "secure" is off.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
647 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
648 static int
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
649 check_illegal_path_names(int opt_idx, char_u **varp)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
650 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
651 return (((get_option_flags(opt_idx) & P_NFNAME)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
652 && vim_strpbrk(*varp, (char_u *)(secure
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
653 ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
654 || ((get_option_flags(opt_idx) & P_NDNAME)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
655 && vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL));
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
656 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
657
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
658 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
659 * The 'term' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
660 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
661 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
662 did_set_term(int *opt_idx, long_u *free_oldval)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
663 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
664 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
665
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
666 if (T_NAME[0] == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
667 errmsg = e_cannot_set_term_to_empty_string;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
668 #ifdef FEAT_GUI
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
669 else if (gui.in_use)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
670 errmsg = e_cannot_change_term_in_GUI;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
671 else if (term_is_gui(T_NAME))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
672 errmsg = e_use_gui_to_start_GUI;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
673 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
674 else if (set_termname(T_NAME) == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
675 errmsg = e_not_found_in_termcap;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
676 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
677 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
678 // Screen colors may have changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
679 redraw_later_clear();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
680
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
681 // Both 'term' and 'ttytype' point to T_NAME, only set the
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
682 // P_ALLOCED flag on 'term'.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
683 *opt_idx = findoption((char_u *)"term");
31886
b741e5243e58 patch 9.0.1275: the code for setting options is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 31869
diff changeset
684 if (*opt_idx >= 0)
b741e5243e58 patch 9.0.1275: the code for setting options is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 31869
diff changeset
685 *free_oldval = (get_option_flags(*opt_idx) & P_ALLOCED);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
686 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
687
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
688 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
689 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
690
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
691 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
692 * The 'backupcopy' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
693 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
694 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
695 did_set_backupcopy(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
696 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
697 char_u *bkc = p_bkc;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
698 unsigned int *flags = &bkc_flags;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
699 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
700
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
701 if (args->os_flags & OPT_LOCAL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
702 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
703 bkc = curbuf->b_p_bkc;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
704 flags = &curbuf->b_bkc_flags;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
705 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
706
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
707 if ((args->os_flags & OPT_LOCAL) && *bkc == NUL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
708 // make the local value empty: use the global value
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
709 *flags = 0;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
710 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
711 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
712 if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
713 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
714 if ((((int)*flags & BKC_AUTO) != 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
715 + (((int)*flags & BKC_YES) != 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
716 + (((int)*flags & BKC_NO) != 0) != 1)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
717 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
718 // Must have exactly one of "auto", "yes" and "no".
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
719 (void)opt_strings_flags(args->os_oldval.string, p_bkc_values,
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
720 flags, TRUE);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
721 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
722 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
723 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
724
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
725 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
726 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
727
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
728 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
729 * The 'backupext' or the 'patchmode' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
730 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
731 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
732 did_set_backupext_or_patchmode(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
733 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
734 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
735 *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
736 return e_backupext_and_patchmode_are_equal;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
737
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
738 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
739 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
740
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
741 #if defined(FEAT_LINEBREAK) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
742 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
743 * The 'breakindentopt' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
744 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
745 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
746 did_set_breakindentopt(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
747 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
748 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
749
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
750 if (briopt_check(curwin) == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
751 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
752 // list setting requires a redraw
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
753 if (curwin->w_briopt_list)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
754 redraw_all_later(UPD_NOT_VALID);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
755
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
756 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
757 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
758 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
759
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
760 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
761 * The 'isident' or the 'iskeyword' or the 'isprint' or the 'isfname' option is
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
762 * changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
763 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
764 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
765 did_set_isopt(int *did_chartab)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
766 {
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
767 // 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[]
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
768 // If the new option is invalid, use old value.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
769 // 'lisp' option: refill g_chartab[] for '-' char.
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
770 if (init_chartab() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
771 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
772 *did_chartab = TRUE; // need to restore it below
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
773 return e_invalid_argument; // error in value
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
774 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
775
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
776 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
777 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
778
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
779 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
780 * The 'helpfile' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
781 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
782 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
783 did_set_helpfile(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
784 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
785 // May compute new values for $VIM and $VIMRUNTIME
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
786 if (didset_vim)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
787 vim_unsetenv_ext((char_u *)"VIM");
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
788 if (didset_vimruntime)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
789 vim_unsetenv_ext((char_u *)"VIMRUNTIME");
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
790 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
791 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
792
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
793 #ifdef FEAT_SYN_HL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
794 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
795 * The 'cursorlineopt' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
796 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
797 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
798 did_set_cursorlineopt(char_u **varp)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
799 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
800 if (**varp == NUL || fill_culopt_flags(*varp, curwin) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
801 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
802
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
803 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
804 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
805 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
806
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
807 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
808 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
809 * The 'helplang' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
810 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
811 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
812 did_set_helplang(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
813 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
814 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
815
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
816 // Check for "", "ab", "ab,cd", etc.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
817 for (char_u *s = p_hlg; *s != NUL; s += 3)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
818 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
819 if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
820 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
821 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
822 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
823 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
824 if (s[2] == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
825 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
826 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
827
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
828 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
829 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
830 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
831
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
832 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
833 * The 'highlight' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
834 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
835 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
836 did_set_highlight(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
837 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
838 if (highlight_changed() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
839 return e_invalid_argument; // invalid flags
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
840
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
841 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
842 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
843
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
844 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
845 * An option that accepts a list of flags is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
846 * e.g. 'viewoptions', 'switchbuf', 'casemap', etc.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
847 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
848 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
849 did_set_opt_flags(char_u *val, char **values, unsigned *flagp, int list)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
850 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
851 if (opt_strings_flags(val, values, flagp, list) == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
852 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
853
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
854 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
855 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
856
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
857 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
858 * An option that accepts a list of string values is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
859 * e.g. 'nrformats', 'scrollopt', 'wildoptions', etc.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
860 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
861 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
862 did_set_opt_strings(char_u *val, char **values, int list)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
863 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
864 return did_set_opt_flags(val, values, NULL, list);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
865 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
866
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
867 #ifdef FEAT_SESSION
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
868 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
869 * The 'sessionoptions' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
870 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
871 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
872 did_set_sessionoptions(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
873 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
874 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
875 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
876 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
877 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
878 // Don't allow both "sesdir" and "curdir".
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
879 (void)opt_strings_flags(args->os_oldval.string, p_ssop_values,
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
880 &ssop_flags, TRUE);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
881 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
882 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
883
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
884 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
885 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
886 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
887
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
888 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
889 * The 'ambiwidth' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
890 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
891 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
892 did_set_ambiwidth(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
893 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
894 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
895 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
896
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
897 return check_chars_options();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
898 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
899
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
900 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
901 * The 'background' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
902 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
903 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
904 did_set_background(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
905 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
906 if (check_opt_strings(p_bg, p_bg_values, FALSE) == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
907 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
908
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
909 #ifdef FEAT_EVAL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
910 int dark = (*p_bg == 'd');
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
911 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
912
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
913 init_highlight(FALSE, FALSE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
914
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
915 #ifdef FEAT_EVAL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
916 if (dark != (*p_bg == 'd')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
917 && get_var_value((char_u *)"g:colors_name") != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
918 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
919 // The color scheme must have set 'background' back to another
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
920 // value, that's not what we want here. Disable the color
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
921 // scheme and set the colors again.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
922 do_unlet((char_u *)"g:colors_name", TRUE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
923 free_string_option(p_bg);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
924 p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
925 check_string_option(&p_bg);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
926 init_highlight(FALSE, FALSE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
927 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
928 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
929 #ifdef FEAT_TERMINAL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
930 term_update_colors_all();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
931 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
932
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
933 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
934 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
935
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
936 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
937 * The 'wildmode' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
938 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
939 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
940 did_set_wildmode(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
941 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
942 if (check_opt_wim() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
943 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
944 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
945 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
946
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
947 #if defined(FEAT_WAK) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
948 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
949 * The 'winaltkeys' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
950 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
951 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
952 did_set_winaltkeys(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
953 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
954 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
955
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
956 if (*p_wak == NUL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
957 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
958 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
959 # ifdef FEAT_MENU
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
960 # if defined(FEAT_GUI_MOTIF)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
961 else if (gui.in_use)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
962 gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
963 # elif defined(FEAT_GUI_GTK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
964 else if (gui.in_use)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
965 gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
966 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
967 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
968 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
969 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
970 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
971
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
972 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
973 * The 'eventignore' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
974 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
975 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
976 did_set_eventignore(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
977 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
978 if (check_ei() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
979 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
980 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
981 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
982
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
983 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
984 * One of the 'encoding', 'fileencoding', 'termencoding' or 'makeencoding'
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
985 * options is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
986 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
987 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
988 did_set_encoding(char_u **varp, char_u **gvarp, int opt_flags)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
989 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
990 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
991 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
992
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
993 if (gvarp == &p_fenc)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
994 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
995 if (!curbuf->b_p_ma && opt_flags != OPT_GLOBAL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
996 errmsg = e_cannot_make_changes_modifiable_is_off;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
997 else if (vim_strchr(*varp, ',') != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
998 // No comma allowed in 'fileencoding'; catches confusing it
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
999 // with 'fileencodings'.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1000 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1001 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1002 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1003 // May show a "+" in the title now.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1004 redraw_titles();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1005 // Add 'fileencoding' to the swap file.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1006 ml_setflags(curbuf);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1007 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1008 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1009 if (errmsg == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1010 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1011 // canonize the value, so that STRCMP() can be used on it
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1012 p = enc_canonize(*varp);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1013 if (p != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1014 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1015 vim_free(*varp);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1016 *varp = p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1017 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1018 if (varp == &p_enc)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1019 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1020 errmsg = mb_init();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1021 redraw_titles();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1022 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1023 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1024
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1025 #if defined(FEAT_GUI_GTK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1026 if (errmsg == NULL && varp == &p_tenc && gui.in_use)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1027 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1028 // GTK uses only a single encoding, and that is UTF-8.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1029 if (STRCMP(p_tenc, "utf-8") != 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1030 errmsg = e_cannot_be_changed_in_gtk_GUI;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1031 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1032 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1033
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1034 if (errmsg == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1035 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1036 #ifdef FEAT_KEYMAP
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1037 // When 'keymap' is used and 'encoding' changes, reload the keymap
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1038 // (with another encoding).
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1039 if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1040 (void)keymap_init();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1041 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1042
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1043 // When 'termencoding' is not empty and 'encoding' changes or when
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1044 // 'termencoding' changes, need to setup for keyboard input and
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1045 // display output conversion.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1046 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1047 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1048 if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1049 || convert_setup(&output_conv, p_enc, p_tenc) == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1050 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1051 semsg(_(e_cannot_convert_between_str_and_str),
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1052 p_tenc, p_enc);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1053 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1054 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1055 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1056
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1057 #if defined(MSWIN)
31962
4efcb5c68112 patch 9.0.1313: some settings use the current codepage instead of 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 31950
diff changeset
1058 // $HOME, $VIM and $VIMRUNTIME may have characters in active code page.
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1059 if (varp == &p_enc)
31962
4efcb5c68112 patch 9.0.1313: some settings use the current codepage instead of 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 31950
diff changeset
1060 {
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1061 init_homedir();
31962
4efcb5c68112 patch 9.0.1313: some settings use the current codepage instead of 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 31950
diff changeset
1062 init_vimdir();
4efcb5c68112 patch 9.0.1313: some settings use the current codepage instead of 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 31950
diff changeset
1063 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1064 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1065 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1066
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1067 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1068 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1069
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1070 #if defined(FEAT_POSTSCRIPT) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1071 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1072 * The 'printencoding' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1073 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1074 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1075 did_set_printencoding(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1076 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1077 char_u *s, *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1078
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
1079 // Canonize 'printencoding' if VIM standard one
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1080 p = enc_canonize(p_penc);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1081 if (p != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1082 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1083 vim_free(p_penc);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1084 p_penc = p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1085 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1086 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1087 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1088 // Ensure lower case and '-' for '_'
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1089 for (s = p_penc; *s != NUL; s++)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1090 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1091 if (*s == '_')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1092 *s = '-';
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1093 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1094 *s = TOLOWER_ASC(*s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1095 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1096 }
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1097
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1098 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1099 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1100 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1101
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1102 #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1103 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1104 * The 'imactivatekey' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1105 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1106 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1107 did_set_imactivatekey(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1108 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1109 if (!im_xim_isvalid_imactivate())
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1110 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1111 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1112 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1113 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1114
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1115 #ifdef FEAT_KEYMAP
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1116 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1117 * The 'keymap' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1118 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1119 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1120 did_set_keymap(char_u **varp, int opt_flags, int *value_checked)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1121 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1122 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1123
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1124 if (!valid_filetype(*varp))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1125 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1126 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1127 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1128 int secure_save = secure;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1129
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1130 // Reset the secure flag, since the value of 'keymap' has
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1131 // been checked to be safe.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1132 secure = 0;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1133
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1134 // load or unload key mapping tables
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1135 errmsg = keymap_init();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1136
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1137 secure = secure_save;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1138
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1139 // Since we check the value, there is no need to set P_INSECURE,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1140 // even when the value comes from a modeline.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1141 *value_checked = TRUE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1142 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1143
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1144 if (errmsg == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1145 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1146 if (*curbuf->b_p_keymap != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1147 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1148 // Installed a new keymap, switch on using it.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1149 curbuf->b_p_iminsert = B_IMODE_LMAP;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1150 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1151 curbuf->b_p_imsearch = B_IMODE_LMAP;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1152 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1153 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1154 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1155 // Cleared the keymap, may reset 'iminsert' and 'imsearch'.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1156 if (curbuf->b_p_iminsert == B_IMODE_LMAP)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1157 curbuf->b_p_iminsert = B_IMODE_NONE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1158 if (curbuf->b_p_imsearch == B_IMODE_LMAP)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1159 curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1160 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1161 if ((opt_flags & OPT_LOCAL) == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1162 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1163 set_iminsert_global();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1164 set_imsearch_global();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1165 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1166 status_redraw_curbuf();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1167 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1168
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1169 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1170 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1171 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1172
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1173 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1174 * The 'fileformat' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1175 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1176 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1177 did_set_fileformat(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1178 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1179 if (!curbuf->b_p_ma && !(args->os_flags & OPT_GLOBAL))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1180 return e_cannot_make_changes_modifiable_is_off;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1181 else if (check_opt_strings(args->os_varp, p_ff_values, FALSE) != OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1182 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1183
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1184 // may also change 'textmode'
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1185 if (get_fileformat(curbuf) == EOL_DOS)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1186 curbuf->b_p_tx = TRUE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1187 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1188 curbuf->b_p_tx = FALSE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1189 redraw_titles();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1190 // update flag in swap file
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1191 ml_setflags(curbuf);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1192 // Redraw needed when switching to/from "mac": a CR in the text
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1193 // will be displayed differently.
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1194 if (get_fileformat(curbuf) == EOL_MAC || *args->os_oldval.string == 'm')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1195 redraw_curbuf_later(UPD_NOT_VALID);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1196
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1197 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1198 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1199
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1200 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1201 * The 'fileformats' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1202 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1203 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1204 did_set_fileformats(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1205 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1206 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1207 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1208
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1209 // also change 'textauto'
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1210 if (*p_ffs == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1211 p_ta = FALSE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1212 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1213 p_ta = TRUE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1214
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1215 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1216 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1217
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1218 #if defined(FEAT_CRYPT) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1219 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1220 * The 'cryptkey' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1221 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1222 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1223 did_set_cryptkey(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1224 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1225 // Make sure the ":set" command doesn't show the new value in the
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1226 // history.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1227 remove_key_from_history();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1228
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1229 if (STRCMP(curbuf->b_p_key, args->os_oldval.string) != 0)
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
1230 {
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1231 // Need to update the swapfile.
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1232 ml_set_crypt_key(curbuf, args->os_oldval.string,
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1233 *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1234 changed_internal();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1235 }
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1236
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1237 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1238 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1239
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1240 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1241 * The 'cryptmethod' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1242 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1243 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1244 did_set_cryptmethod(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1245 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1246 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1247 char_u *s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1248
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1249 if (args->os_flags & OPT_LOCAL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1250 p = curbuf->b_p_cm;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1251 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1252 p = p_cm;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1253 if (check_opt_strings(p, p_cm_values, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1254 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1255 else if (crypt_self_test() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1256 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1257
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1258 // When setting the global value to empty, make it "zip".
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1259 if (*p_cm == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1260 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1261 free_string_option(p_cm);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1262 p_cm = vim_strsave((char_u *)"zip");
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1263 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1264 // When using ":set cm=name" the local value is going to be empty.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1265 // Do that here, otherwise the crypt functions will still use the
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1266 // local value.
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1267 if ((args->os_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1268 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1269 free_string_option(curbuf->b_p_cm);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1270 curbuf->b_p_cm = empty_option;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1271 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1272
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1273 // Need to update the swapfile when the effective method changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1274 // Set "s" to the effective old value, "p" to the effective new
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1275 // method and compare.
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1276 if ((args->os_flags & OPT_LOCAL) && *args->os_oldval.string == NUL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1277 s = p_cm; // was previously using the global value
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1278 else
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1279 s = args->os_oldval.string;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1280 if (*curbuf->b_p_cm == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1281 p = p_cm; // is now using the global value
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1282 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1283 p = curbuf->b_p_cm;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1284 if (STRCMP(s, p) != 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1285 ml_set_crypt_key(curbuf, curbuf->b_p_key, s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1286
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1287 // If the global value changes need to update the swapfile for all
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1288 // buffers using that value.
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1289 if ((args->os_flags & OPT_GLOBAL)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1290 && STRCMP(p_cm, args->os_oldval.string) != 0)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1291 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1292 buf_T *buf;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1293
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1294 FOR_ALL_BUFFERS(buf)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1295 if (buf != curbuf && *buf->b_p_cm == NUL)
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1296 ml_set_crypt_key(buf, buf->b_p_key, args->os_oldval.string);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1297 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1298 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1299 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1300 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1301
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1302 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1303 * The 'matchpairs' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1304 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1305 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1306 did_set_matchpairs(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1307 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1308 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1309
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1310 if (has_mbyte)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1311 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1312 for (p = args->os_varp; *p != NUL; ++p)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1313 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1314 int x2 = -1;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1315 int x3 = -1;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1316
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1317 p += mb_ptr2len(p);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1318 if (*p != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1319 x2 = *p++;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1320 if (*p != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1321 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1322 x3 = mb_ptr2char(p);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1323 p += mb_ptr2len(p);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1324 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1325 if (x2 != ':' || x3 == -1 || (*p != NUL && *p != ','))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1326 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1327 if (*p == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1328 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1329 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1330 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1331 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1332 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1333 // Check for "x:y,x:y"
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1334 for (p = args->os_varp; *p != NUL; p += 4)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1335 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1336 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1337 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1338 if (p[3] == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1339 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1340 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1341 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1342
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1343 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1344 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1345
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1346 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1347 * The 'comments' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1348 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1349 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1350 did_set_comments(char_u **varp, char *errbuf)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1351 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1352 char_u *s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1353 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1354
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1355 for (s = *varp; *s; )
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1356 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1357 while (*s && *s != ':')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1358 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1359 if (vim_strchr((char_u *)COM_ALL, *s) == NULL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1360 && !VIM_ISDIGIT(*s) && *s != '-')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1361 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1362 errmsg = illegal_char(errbuf, *s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1363 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1364 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1365 ++s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1366 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1367 if (*s++ == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1368 errmsg = e_missing_colon;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1369 else if (*s == ',' || *s == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1370 errmsg = e_zero_length_string;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1371 if (errmsg != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1372 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1373 while (*s && *s != ',')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1374 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1375 if (*s == '\\' && s[1] != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1376 ++s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1377 ++s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1378 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1379 s = skip_to_option_part(s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1380 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1381
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1382 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1383 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1384
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1385 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1386 * The global 'listchars' or 'fillchars' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1387 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1388 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1389 did_set_global_listfillchars(char_u **varp, int opt_flags)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1390 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1391 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1392 char_u **local_ptr = varp == &p_lcs
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1393 ? &curwin->w_p_lcs : &curwin->w_p_fcs;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1394
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1395 // only apply the global value to "curwin" when it does not have a
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1396 // local value
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1397 errmsg = set_chars_option(curwin, varp,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1398 **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1399 if (errmsg != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1400 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1401
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1402 tabpage_T *tp;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1403 win_T *wp;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1404
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1405 // If the current window is set to use the global
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1406 // 'listchars'/'fillchars' value, clear the window-local value.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1407 if (!(opt_flags & OPT_GLOBAL))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1408 clear_string_option(local_ptr);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1409 FOR_ALL_TAB_WINDOWS(tp, wp)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1410 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1411 // If the current window has a local value need to apply it
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1412 // again, it was changed when setting the global value.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1413 // If no error was returned above, we don't expect an error
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1414 // here, so ignore the return value.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1415 local_ptr = varp == &p_lcs ? &wp->w_p_lcs : &wp->w_p_fcs;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1416 if (**local_ptr == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1417 (void)set_chars_option(wp, local_ptr, TRUE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1418 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1419
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1420 redraw_all_later(UPD_NOT_VALID);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1421
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1422 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1423 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1424
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1425 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1426 * The 'verbosefile' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1427 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1428 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1429 did_set_verbosefile(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1430 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1431 verbose_stop();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1432 if (*p_vfile != NUL && verbose_open() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1433 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1434
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1435 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1436 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1437
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1438 #ifdef FEAT_VIMINFO
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1439 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1440 * The 'viminfo' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1441 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1442 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1443 did_set_viminfo(char *errbuf)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1444 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1445 char_u *s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1446 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1447
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1448 for (s = p_viminfo; *s;)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1449 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1450 // Check it's a valid character
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1451 if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1452 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1453 errmsg = illegal_char(errbuf, *s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1454 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1455 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1456 if (*s == 'n') // name is always last one
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1457 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1458 else if (*s == 'r') // skip until next ','
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1459 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1460 while (*++s && *s != ',')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1461 ;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1462 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1463 else if (*s == '%')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1464 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1465 // optional number
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1466 while (vim_isdigit(*++s))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1467 ;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1468 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1469 else if (*s == '!' || *s == 'h' || *s == 'c')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1470 ++s; // no extra chars
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1471 else // must have a number
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1472 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1473 while (vim_isdigit(*++s))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1474 ;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1475
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1476 if (!VIM_ISDIGIT(*(s - 1)))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1477 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1478 if (errbuf != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1479 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1480 sprintf(errbuf,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1481 _(e_missing_number_after_angle_str_angle),
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1482 transchar_byte(*(s - 1)));
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1483 errmsg = errbuf;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1484 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1485 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1486 errmsg = "";
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1487 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1488 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1489 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1490 if (*s == ',')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1491 ++s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1492 else if (*s)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1493 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1494 if (errbuf != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1495 errmsg = e_missing_comma;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1496 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1497 errmsg = "";
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1498 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1499 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1500 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1501 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1502 errmsg = e_must_specify_a_value;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1503
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1504 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1505 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1506 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1507
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1508 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1509 * Some terminal option (t_xxx) is changed
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1510 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1511 static void
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1512 did_set_term_option(char_u **varp, int *did_swaptcap UNUSED)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1513 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1514 // ":set t_Co=0" and ":set t_Co=1" do ":set t_Co="
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1515 if (varp == &T_CCO)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1516 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1517 int colors = atoi((char *)T_CCO);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1518
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1519 // Only reinitialize colors if t_Co value has really changed to
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1520 // avoid expensive reload of colorscheme if t_Co is set to the
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1521 // same value multiple times.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1522 if (colors != t_colors)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1523 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1524 t_colors = colors;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1525 if (t_colors <= 1)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1526 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1527 vim_free(T_CCO);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1528 T_CCO = empty_option;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1529 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1530 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1531 if (is_term_win32())
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1532 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1533 swap_tcap();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1534 *did_swaptcap = TRUE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1535 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1536 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1537 // We now have a different color setup, initialize it again.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1538 init_highlight(TRUE, FALSE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1539 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1540 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1541 ttest(FALSE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1542 if (varp == &T_ME)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1543 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1544 out_str(T_ME);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1545 redraw_later(UPD_CLEAR);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1546 #if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1547 // Since t_me has been set, this probably means that the user
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1548 // wants to use this as default colors. Need to reset default
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1549 // background/foreground colors.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1550 # ifdef VIMDLL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1551 if (!gui.in_use && !gui.starting)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1552 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1553 mch_set_normal_colors();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1554 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1555 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1556 if (varp == &T_BE && termcap_active)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1557 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1558 MAY_WANT_TO_LOG_THIS;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1559
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1560 if (*T_BE == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1561 // When clearing t_BE we assume the user no longer wants
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1562 // bracketed paste, thus disable it by writing t_BD.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1563 out_str(T_BD);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1564 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1565 out_str(T_BE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1566 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1567 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1568
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1569 #if defined(FEAT_LINEBREAK) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1570 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1571 * The 'showbreak' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1572 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1573 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1574 did_set_showbreak(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1575 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1576 char_u *s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1577
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1578 for (s = args->os_varp; *s; )
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1579 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1580 if (ptr2cells(s) != 1)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1581 return e_showbreak_contains_unprintable_or_wide_character;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1582 MB_PTR_ADV(s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1583 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1584
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1585 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1586 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1587 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1588
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1589 #if defined(FEAT_GUI) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1590 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1591 * The 'guifont' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1592 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1593 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1594 did_set_guifont(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1595 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1596 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1597 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1598
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1599 if (gui.in_use)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1600 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1601 p = p_guifont;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1602 # if defined(FEAT_GUI_GTK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1603 // Put up a font dialog and let the user select a new value.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1604 // If this is cancelled go back to the old value but don't
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1605 // give an error message.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1606 if (STRCMP(p, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1607 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1608 p = gui_mch_font_dialog(args->os_oldval.string);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1609 free_string_option(p_guifont);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1610 p_guifont = (p != NULL) ? p : vim_strsave(args->os_oldval.string);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1611 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1612 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1613 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1614 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1615 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1616 if (STRCMP(p_guifont, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1617 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1618 // Dialog was cancelled: Keep the old value without giving
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1619 // an error message.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1620 free_string_option(p_guifont);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1621 p_guifont = vim_strsave(args->os_oldval.string);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1622 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1623 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1624 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1625 errmsg = e_invalid_fonts;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1626 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1627 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1628
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1629 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1630 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1631
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1632 # if defined(FEAT_XFONTSET) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1633 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1634 * The 'guifontset' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1635 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1636 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1637 did_set_guifontset(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1638 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1639 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1640
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1641 if (STRCMP(p_guifontset, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1642 errmsg = e_cant_select_fontset;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1643 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1644 errmsg = e_invalid_fontset;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1645
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1646 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1647 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1648 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1649
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1650 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1651 * The 'guifontwide' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1652 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1653 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1654 did_set_guifontwide(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1655 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1656 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1657
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1658 if (STRCMP(p_guifontwide, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1659 errmsg = e_cant_select_wide_font;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1660 else if (gui_get_wide_font() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1661 errmsg = e_invalid_wide_font;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1662
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1663 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1664 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1665 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1666
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1667 #if defined(FEAT_GUI_GTK) || defined(PROTO)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1668 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1669 * The 'guiligatures' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1670 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1671 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1672 did_set_guiligatures(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1673 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1674 gui_set_ligatures();
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1675 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1676 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1677 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1678
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1679 #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1680 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1681 did_set_mouseshape(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1682 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1683 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1684
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1685 errmsg = parse_shape_opt(SHAPE_MOUSE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1686 update_mouseshape(-1);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1687
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1688 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1689 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1690 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1691
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1692 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1693 * The 'titlestring' or the 'iconstring' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1694 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1695 static char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1696 did_set_titleiconstring(optset_T *args UNUSED, int flagval UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1697 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1698 #ifdef FEAT_STL_OPT
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1699 // NULL => statusline syntax
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1700 if (vim_strchr(args->os_varp, '%')
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1701 && check_stl_option(args->os_varp) == NULL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1702 stl_syntax |= flagval;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1703 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1704 stl_syntax &= ~flagval;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1705 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1706 did_set_title();
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1707
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1708 return NULL;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1709 }
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1710
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1711 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1712 * The 'titlestring' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1713 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1714 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1715 did_set_titlestring(optset_T *args)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1716 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1717 int flagval = 0;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1718
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1719 #ifdef FEAT_STL_OPT
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1720 flagval = STL_IN_TITLE;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1721 #endif
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1722 return did_set_titleiconstring(args, flagval);
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1723 }
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1724
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1725 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1726 * The 'iconstring' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1727 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1728 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1729 did_set_iconstring(optset_T *args)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1730 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1731 int flagval = 0;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1732
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1733 #ifdef FEAT_STL_OPT
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1734 flagval = STL_IN_ICON;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1735 #endif
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1736
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1737 return did_set_titleiconstring(args, flagval);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1738 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1739
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1740 #ifdef FEAT_GUI
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1741 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1742 * The 'guioptions' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1743 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1744 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1745 did_set_guioptions(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1746 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1747 gui_init_which_components(args->os_oldval.string);
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1748 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1749 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1750 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1751
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1752 #if defined(FEAT_GUI_TABLINE)
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1753 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1754 * The 'guitablabel' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1755 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1756 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1757 did_set_guitablabel(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1758 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1759 redraw_tabline = TRUE;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1760 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1761 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1762 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1763
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1764 #if defined(UNIX) || defined(VMS) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1765 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1766 * The 'ttymouse' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1767 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1768 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1769 did_set_ttymouse(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1770 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1771 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1772
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1773 // Switch the mouse off before changing the escape sequences used for
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1774 // that.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1775 mch_setmouse(FALSE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1776 if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1777 errmsg = e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1778 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1779 check_mouse_termcode();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1780 if (termcap_active)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1781 setmouse(); // may switch it on again
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1782
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1783 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1784 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1785 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1786
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1787 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1788 * The 'selection' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1789 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1790 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1791 did_set_selection(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1792 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1793 if (*p_sel == NUL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1794 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1795 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1796
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1797 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1798 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1799
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1800 #if defined(FEAT_BROWSE) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1801 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1802 * The 'browsedir' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1803 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1804 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1805 did_set_browsedir(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1806 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1807 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1808 && !mch_isdir(p_bsdir))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1809 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1810
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1811 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1812 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1813 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1814
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1815 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1816 * The 'keymodel' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1817 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1818 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1819 did_set_keymodel(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1820 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1821 if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1822 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1823
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1824 km_stopsel = (vim_strchr(p_km, 'o') != NULL);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1825 km_startsel = (vim_strchr(p_km, 'a') != NULL);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1826 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1827 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1828
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1829 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1830 * The 'keyprotocol' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1831 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1832 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1833 did_set_keyprotocol(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1834 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1835 if (match_keyprotocol(NULL) == KEYPROTOCOL_FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1836 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1837
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1838 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1839 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1840
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1841 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1842 * The 'mousemodel' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1843 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1844 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1845 did_set_mousemodel(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1846 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1847 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1848 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1849 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1850 else if (*p_mousem != *oldval)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1851 // Changed from "extend" to "popup" or "popup_setpos" or vv: need
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1852 // to create or delete the popup menus.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1853 gui_motif_update_mousemodel(root_menu);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1854 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1855
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1856 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1857 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1858
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1859 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1860 * The 'display' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1861 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1862 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1863 did_set_display(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1864 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1865 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1866 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1867
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1868 (void)init_chartab();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1869 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1870 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1871
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1872 #if defined(FEAT_SPELL) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1873 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1874 * The 'spellfile' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1875 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1876 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1877 did_set_spellfile(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1878 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1879 if (!valid_spellfile(args->os_varp))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1880 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1881
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1882 // If there is a window for this buffer in which 'spell' is set load the
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1883 // wordlists.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1884 return did_set_spell_option(TRUE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1885 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1886
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1887 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1888 * The 'spell' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1889 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1890 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1891 did_set_spelllang(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1892 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1893 if (!valid_spelllang(args->os_varp))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1894 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1895
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1896 // If there is a window for this buffer in which 'spell' is set load the
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1897 // wordlists.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1898 return did_set_spell_option(FALSE);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1899 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1900
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1901 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1902 * The 'spellcapcheck' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1903 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1904 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1905 did_set_spellcapcheck(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1906 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1907 // compile the regexp program.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1908 return compile_cap_prog(curwin->w_s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1909 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1910
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1911 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1912 * The 'spelloptions' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1913 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1914 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1915 did_set_spelloptions(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1916 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1917 if (*args->os_varp != NUL && STRCMP("camel", args->os_varp) != 0)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1918 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1919
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1920 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1921 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1922
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1923 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1924 * The 'spellsuggest' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1925 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1926 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1927 did_set_spellsuggest(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1928 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1929 if (spell_check_sps() != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1930 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1931
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1932 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1933 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1934
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1935 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1936 * The 'mkspellmem' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1937 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1938 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1939 did_set_mkspellmem(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1940 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1941 if (spell_check_msm() != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1942 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1943
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1944 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1945 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1946 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1947
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1948 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1949 * The 'buftype' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1950 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1951 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1952 did_set_buftype(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1953 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1954 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1955 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1956
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1957 if (curwin->w_status_height)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1958 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1959 curwin->w_redr_status = TRUE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1960 redraw_later(UPD_VALID);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1961 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1962 curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1963 redraw_titles();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1964
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1965 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1966 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1967
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1968 #ifdef FEAT_STL_OPT
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1969 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1970 * The 'statusline' or the 'tabline' or the 'rulerformat' option is changed.
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1971 * "rulerformat" is TRUE if the 'rulerformat' option is changed.
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1972 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1973 static char *
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1974 did_set_statustabline_rulerformat(optset_T *args, int rulerformat)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1975 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1976 char_u *s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1977 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1978 int wid;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1979
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1980 if (rulerformat) // reset ru_wid first
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1981 ru_wid = 0;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1982 s = args->os_varp;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1983 if (rulerformat && *s == '%')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1984 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1985 // set ru_wid if 'ruf' starts with "%99("
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1986 if (*++s == '-') // ignore a '-'
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1987 s++;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1988 wid = getdigits(&s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1989 if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1990 ru_wid = wid;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1991 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1992 errmsg = check_stl_option(p_ruf);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1993 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1994 // check 'statusline' or 'tabline' only if it doesn't start with "%!"
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1995 else if (rulerformat || s[0] != '%' || s[1] != '!')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1996 errmsg = check_stl_option(s);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1997 if (rulerformat && errmsg == NULL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1998 comp_col();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1999
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2000 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2001 }
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2002
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2003 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2004 * The 'statusline' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2005 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2006 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2007 did_set_statusline(optset_T *args)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2008 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2009 return did_set_statustabline_rulerformat(args, FALSE);
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2010 }
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2011
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2012 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2013 * The 'tabline' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2014 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2015 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2016 did_set_tabline(optset_T *args)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2017 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2018 return did_set_statustabline_rulerformat(args, FALSE);
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2019 }
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2020
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2021
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2022 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2023 * The 'rulerformat' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2024 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2025 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2026 did_set_rulerformat(optset_T *args)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2027 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2028 return did_set_statustabline_rulerformat(args, TRUE);
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2029 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2030 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2031
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2032 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2033 * The 'complete' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2034 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2035 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2036 did_set_complete(char_u **varp, char *errbuf)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2037 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2038 char_u *s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2039
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2040 // check if it is a valid value for 'complete' -- Acevedo
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2041 for (s = *varp; *s;)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2042 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2043 while (*s == ',' || *s == ' ')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2044 s++;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2045 if (!*s)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2046 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2047 if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2048 return illegal_char(errbuf, *s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2049 if (*++s != NUL && *s != ',' && *s != ' ')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2050 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2051 if (s[-1] == 'k' || s[-1] == 's')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2052 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2053 // skip optional filename after 'k' and 's'
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2054 while (*s && *s != ',' && *s != ' ')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2055 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2056 if (*s == '\\' && s[1] != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2057 ++s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2058 ++s;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2059 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2060 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2061 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2062 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2063 if (errbuf != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2064 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2065 sprintf((char *)errbuf,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2066 _(e_illegal_character_after_chr), *--s);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2067 return errbuf;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2068 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2069 return "";
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2070 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2071 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2072 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2073
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2074 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2075 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2076
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2077 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2078 * The 'completeopt' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2079 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2080 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2081 did_set_completeopt(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2082 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2083 if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2084 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2085
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2086 completeopt_was_set();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2087 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2088 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2089
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2090 #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2091 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2092 * The 'completeslash' option is changed.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2093 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2094 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2095 did_set_completeslash(optset_T *args UNUSED)
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2096 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2097 if (check_opt_strings(p_csl, p_csl_values, FALSE) != OK
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2098 || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2099 return e_invalid_argument;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2100
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2101 return NULL;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2102 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2103 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2104
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2105 #if defined(FEAT_SIGNS) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2106 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2107 * The 'signcolumn' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2108 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2109 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2110 did_set_signcolumn(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2111 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2112 if (check_opt_strings(args->os_varp, p_scl_values, FALSE) != OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2113 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2114 // When changing the 'signcolumn' to or from 'number', recompute the
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2115 // width of the number column if 'number' or 'relativenumber' is set.
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2116 if (((*args->os_oldval.string == 'n' && args->os_oldval.string[1] == 'u')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2117 || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u'))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2118 && (curwin->w_p_nu || curwin->w_p_rnu))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2119 curwin->w_nrwidth_line_count = 0;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2120
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2121 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2122 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2123 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2124
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2125 #if (defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2126 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2127 * The 'toolbar' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2128 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2129 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2130 did_set_toolbar(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2131 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2132 if (opt_strings_flags(p_toolbar, p_toolbar_values,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2133 &toolbar_flags, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2134 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2135
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2136 out_flush();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2137 gui_mch_show_toolbar((toolbar_flags &
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2138 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2139 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2140 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2141 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2142
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2143 #if (defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2144 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2145 * The 'toolbariconsize' option is changed. GTK+ 2 only.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2146 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2147 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2148 did_set_toolbariconsize(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2149 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2150 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2151 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2152
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2153 out_flush();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2154 gui_mch_show_toolbar((toolbar_flags &
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2155 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2156 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2157 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2158 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2159
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2160 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2161 * The 'pastetoggle' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2162 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2163 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2164 did_set_pastetoggle(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2165 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2166 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2167
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2168 // translate key codes like in a mapping
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2169 if (*p_pt)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2170 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2171 (void)replace_termcodes(p_pt, &p,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2172 REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2173 if (p != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2174 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2175 free_string_option(p_pt);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2176 p_pt = p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2177 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2178 }
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2179
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2180 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2181 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2182
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2183 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2184 * The 'backspace' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2185 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2186 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2187 did_set_backspace(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2188 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2189 if (VIM_ISDIGIT(*p_bs))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2190 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2191 if (*p_bs > '3' || p_bs[1] != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2192 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2193 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2194 else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2195 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2196
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2197 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2198 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2199
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2200 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2201 * The 'tagcase' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2202 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2203 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2204 did_set_tagcase(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2205 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2206 unsigned int *flags;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2207 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2208
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2209 if (args->os_flags & OPT_LOCAL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2210 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2211 p = curbuf->b_p_tc;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2212 flags = &curbuf->b_tc_flags;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2213 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2214 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2215 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2216 p = p_tc;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2217 flags = &tc_flags;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2218 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2219
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2220 if ((args->os_flags & OPT_LOCAL) && *p == NUL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2221 // make the local value empty: use the global value
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2222 *flags = 0;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2223 else if (*p == NUL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2224 || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2225 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2226
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2227 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2228 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2229
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2230 #if defined(FEAT_DIFF) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2231 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2232 * The 'diffopt' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2233 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2234 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2235 did_set_diffopt(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2236 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2237 if (diffopt_changed() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2238 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2239
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2240 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2241 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2242 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2243
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2244 #if defined(FEAT_FOLDING) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2245 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2246 * The 'foldmethod' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2247 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2248 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2249 did_set_foldmethod(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2250 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2251 if (check_opt_strings(args->os_varp, p_fdm_values, FALSE) != OK
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2252 || *curwin->w_p_fdm == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2253 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2254
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2255 foldUpdateAll(curwin);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2256 if (foldmethodIsDiff(curwin))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2257 newFoldLevel();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2258 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2259 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2260
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2261 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2262 * The 'foldmarker' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2263 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2264 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2265 did_set_foldmarker(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2266 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2267 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2268
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2269 p = vim_strchr(args->os_varp, ',');
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2270 if (p == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2271 return e_comma_required;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2272 else if (p == args->os_varp || p[1] == NUL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2273 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2274 else if (foldmethodIsMarker(curwin))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2275 foldUpdateAll(curwin);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2276
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2277 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2278 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2279
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2280 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2281 * The 'commentstring' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2282 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2283 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2284 did_set_commentstring(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2285 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2286 if (*args->os_varp != NUL && strstr((char *)args->os_varp, "%s") == NULL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2287 return e_commentstring_must_be_empty_or_contain_str;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2288
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2289 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2290 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2291
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2292 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2293 * The 'foldignore' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2294 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2295 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2296 did_set_foldignore(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2297 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2298 if (foldmethodIsIndent(curwin))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2299 foldUpdateAll(curwin);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2300 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2301 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2302 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2303
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2304 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2305 * The 'virtualedit' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2306 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2307 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2308 did_set_virtualedit(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2309 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2310 char_u *ve = p_ve;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2311 unsigned int *flags = &ve_flags;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2312
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2313 if (args->os_flags & OPT_LOCAL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2314 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2315 ve = curwin->w_p_ve;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2316 flags = &curwin->w_ve_flags;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2317 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2318
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2319 if ((args->os_flags & OPT_LOCAL) && *ve == NUL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2320 // make the local value empty: use the global value
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2321 *flags = 0;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2322 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2323 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2324 if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2325 return e_invalid_argument;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2326 else if (STRCMP(ve, args->os_oldval.string) != 0)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2327 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2328 // Recompute cursor position in case the new 've' setting
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2329 // changes something.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2330 validate_virtcol();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2331 coladvance(curwin->w_virtcol);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2332 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2333 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2334
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2335 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2336 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2337
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2338 #if (defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2339 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2340 * The 'cscopequickfix' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2341 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2342 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2343 did_set_cscopequickfix(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2344 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2345 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2346
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2347 if (p_csqf == NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2348 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2349
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2350 p = p_csqf;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2351 while (*p != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2352 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2353 if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2354 || p[1] == NUL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2355 || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2356 || (p[2] != NUL && p[2] != ','))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2357 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2358 else if (p[2] == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2359 break;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2360 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2361 p += 3;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2362 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2363
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2364 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2365 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2366 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2367
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2368 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2369 * The 'cinoptions' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2370 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2371 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2372 did_set_cinoptions(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2373 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2374 // TODO: recognize errors
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2375 parse_cino(curbuf);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2376
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2377 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2378 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2379
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2380 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2381 * The 'lispoptions' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2382 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2383 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2384 did_set_lispoptions(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2385 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2386 if (*args->os_varp != NUL && STRCMP(args->os_varp, "expr:0") != 0
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2387 && STRCMP(args->os_varp, "expr:1") != 0)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2388 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2389
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2390 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2391 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2392
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2393 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2394 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2395 * The 'renderoptions' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2396 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2397 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2398 did_set_renderoptions(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2399 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2400 if (!gui_mch_set_rendering_options(p_rop))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2401 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2402
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2403 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2404 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2405 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2406
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2407 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2408 * The 'filetype' or the 'syntax' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2409 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2410 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2411 did_set_filetype_or_syntax(
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2412 char_u **varp,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2413 char_u *oldval,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2414 int *value_checked,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2415 int *value_changed)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2416 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2417 if (!valid_filetype(*varp))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2418 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2419
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2420 *value_changed = STRCMP(oldval, *varp) != 0;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2421
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2422 // Since we check the value, there is no need to set P_INSECURE,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2423 // even when the value comes from a modeline.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2424 *value_checked = TRUE;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2425
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2426 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2427 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2428
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2429 #if defined(FEAT_TERMINAL) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2430 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2431 * The 'termwinkey' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2432 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2433 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2434 did_set_termwinkey(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2435 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2436 if (*curwin->w_p_twk != NUL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2437 && string_to_key(curwin->w_p_twk, TRUE) == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2438 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2439
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2440 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2441 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2442
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2443 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2444 * The 'termwinsize' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2445 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2446 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2447 did_set_termwinsize(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2448 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2449 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2450
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2451 if (*curwin->w_p_tws == NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2452 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2453
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2454 p = skipdigits(curwin->w_p_tws);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2455 if (p == curwin->w_p_tws
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2456 || (*p != 'x' && *p != '*')
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2457 || *skipdigits(p + 1) != NUL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2458 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2459
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2460 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2461 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2462 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2463
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2464 #if defined(FEAT_VARTABS) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2465 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2466 * The 'varsofttabstop' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2467 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2468 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2469 did_set_varsofttabstop(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2470 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2471 char_u *cp;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2472
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2473 if (!(args->os_varp[0]) || (args->os_varp[0] == '0' && !(args->os_varp[1])))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2474 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2475 if (curbuf->b_p_vsts_array)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2476 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2477 vim_free(curbuf->b_p_vsts_array);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2478 curbuf->b_p_vsts_array = 0;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2479 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2480 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2481 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2482 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2483 for (cp = args->os_varp; *cp; ++cp)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2484 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2485 if (vim_isdigit(*cp))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2486 continue;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2487 if (*cp == ',' && cp > args->os_varp && *(cp-1) != ',')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2488 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2489 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2490 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2491
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2492 int *oldarray = curbuf->b_p_vsts_array;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2493 if (tabstop_set(args->os_varp, &(curbuf->b_p_vsts_array)) == OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2494 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2495 if (oldarray)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2496 vim_free(oldarray);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2497 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2498 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2499 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2500 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2501
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2502 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2503 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2504
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2505 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2506 * The 'vartabstop' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2507 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2508 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2509 did_set_vartabstop(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2510 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2511 char_u *cp;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2512
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2513 if (!(args->os_varp[0]) || (args->os_varp[0] == '0' && !(args->os_varp[1])))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2514 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2515 if (curbuf->b_p_vts_array)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2516 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2517 vim_free(curbuf->b_p_vts_array);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2518 curbuf->b_p_vts_array = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2519 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2520 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2521 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2522 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2523 for (cp = args->os_varp; *cp; ++cp)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2524 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2525 if (vim_isdigit(*cp))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2526 continue;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2527 if (*cp == ',' && cp > args->os_varp && *(cp-1) != ',')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2528 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2529 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2530 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2531
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2532 int *oldarray = curbuf->b_p_vts_array;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2533
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2534 if (tabstop_set(args->os_varp, &(curbuf->b_p_vts_array)) == OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2535 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2536 vim_free(oldarray);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2537 # ifdef FEAT_FOLDING
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2538 if (foldmethodIsIndent(curwin))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2539 foldUpdateAll(curwin);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2540 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2541 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2542 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2543 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2544 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2545
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2546 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2547 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2548 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2549
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2550 #if defined(FEAT_PROP_POPUP) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2551 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2552 * The 'previewpopup' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2553 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2554 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2555 did_set_previewpopup(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2556 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2557 if (parse_previewpopup(NULL) == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2558 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2559
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2560 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2561 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2562
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2563 # if defined(FEAT_QUICKFIX) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2564 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2565 * The 'completepopup' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2566 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2567 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2568 did_set_completepopup(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2569 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2570 if (parse_completepopup(NULL) == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2571 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2572
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2573 popup_close_info();
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2574 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2575 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2576 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2577 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2578
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2579 #ifdef FEAT_EVAL
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2580 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2581 * One of the '*expr' options is changed: 'balloonexpr', 'diffexpr',
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2582 * 'foldexpr', 'foldtext', 'formatexpr', 'includeexpr', 'indentexpr',
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2583 * 'patchexpr', 'printexpr' and 'charconvert'.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2584 *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2585 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2586 static void
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2587 did_set_optexpr(char_u **varp)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2588 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2589 // If the option value starts with <SID> or s:, then replace that with
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2590 // the script identifier.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2591 char_u *name = get_scriptlocal_funcname(*varp);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2592 if (name != NULL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2593 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2594 free_string_option(*varp);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2595 *varp = name;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2596 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2597
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2598 # ifdef FEAT_FOLDING
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2599 if (varp == &curwin->w_p_fde && foldmethodIsExpr(curwin))
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2600 foldUpdateAll(curwin);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2601 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2602 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2603 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2604
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2605 /*
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2606 * An option which is a list of flags is set. Valid values are in 'flags'.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2607 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2608 static char *
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2609 did_set_option_listflag(char_u **varp, char_u *flags, char *errbuf)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2610 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2611 char_u *s;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2612
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2613 for (s = *varp; *s; ++s)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2614 if (vim_strchr(flags, *s) == NULL)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2615 return illegal_char(errbuf, *s);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2616
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2617 return NULL;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2618 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2619
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2620 #ifdef FEAT_SYN_HL
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2621 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2622 * When the 'syntax' option is set, load the syntax of that name.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2623 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2624 static void
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2625 do_syntax_autocmd(int value_changed)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2626 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2627 static int syn_recursive = 0;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2628
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2629 ++syn_recursive;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2630 // Only pass TRUE for "force" when the value changed or not used
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2631 // recursively, to avoid endless recurrence.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2632 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname,
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2633 value_changed || syn_recursive == 1, curbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2634 curbuf->b_flags |= BF_SYN_SET;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2635 --syn_recursive;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2636 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2637 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2638
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2639 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2640 * When the 'filetype' option is set, trigger the FileType autocommand.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2641 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2642 static void
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2643 do_filetype_autocmd(char_u **varp, int opt_flags, int value_changed)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2644 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2645 // Skip this when called from a modeline and the filetype was already set
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2646 // to this value.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2647 if ((opt_flags & OPT_MODELINE) && !value_changed)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2648 return;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2649
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2650 static int ft_recursive = 0;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2651 int secure_save = secure;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2652
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2653 // Reset the secure flag, since the value of 'filetype' has
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2654 // been checked to be safe.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2655 secure = 0;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2656
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2657 ++ft_recursive;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2658 did_filetype = TRUE;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2659 // Only pass TRUE for "force" when the value changed or not
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2660 // used recursively, to avoid endless recurrence.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2661 apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname,
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2662 value_changed || ft_recursive == 1, curbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2663 --ft_recursive;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2664 // Just in case the old "curbuf" is now invalid.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2665 if (varp != &(curbuf->b_p_ft))
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2666 varp = NULL;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2667
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2668 secure = secure_save;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2669 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2670
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2671 #ifdef FEAT_SPELL
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2672 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2673 * When the 'spelllang' option is set, source the spell/LANG.vim file in
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2674 * 'runtimepath'.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2675 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2676 static void
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2677 do_spelllang_source(void)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2678 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2679 char_u fname[200];
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2680 char_u *p;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2681 char_u *q = curwin->w_s->b_p_spl;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2682
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2683 // Skip the first name if it is "cjk".
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2684 if (STRNCMP(q, "cjk,", 4) == 0)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2685 q += 4;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2686
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2687 // They could set 'spellcapcheck' depending on the language. Use the first
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2688 // name in 'spelllang' up to '_region' or '.encoding'.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2689 for (p = q; *p != NUL; ++p)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2690 if (!ASCII_ISALNUM(*p) && *p != '-')
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2691 break;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2692 if (p > q)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2693 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2694 vim_snprintf((char *)fname, 200, "spell/%.*s.vim",
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2695 (int)(p - q), q);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2696 source_runtime(fname, DIP_ALL);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2697 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2698 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2699 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2700
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2701 /*
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2702 * Handle string options that need some action to perform when changed.
29509
d61007cc39b3 patch 9.0.0096: flag "new_value_alloced" is always true
Bram Moolenaar <Bram@vim.org>
parents: 29395
diff changeset
2703 * The new value must be allocated.
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2704 * Returns NULL for success, or an untranslated error message for an error.
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2705 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2706 char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2707 did_set_string_option(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2708 int opt_idx, // index in options[] table
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2709 char_u **varp, // pointer to the option variable
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2710 char_u *oldval, // previous value of the option
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2711 char_u *value, // new value of the option
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2712 char *errbuf, // buffer for errors, or NULL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2713 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2714 int *value_checked) // value was checked to be safe, no
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2715 // need to set P_INSECURE
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2716 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2717 char *errmsg = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2718 int did_chartab = FALSE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2719 char_u **gvarp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2720 long_u free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2721 int value_changed = FALSE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2722 int did_swaptcap = FALSE;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2723 opt_did_set_cb_T did_set_cb = get_option_did_set_cb(opt_idx);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2724
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2725 // Get the global option to compare with, otherwise we would have to check
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2726 // two values for all local options.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2727 gvarp = (char_u **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2728
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2729 // Disallow changing some options from secure mode
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2730 if ((secure
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2731 #ifdef HAVE_SANDBOX
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2732 || sandbox != 0
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2733 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2734 ) && (get_option_flags(opt_idx) & P_SECURE))
26883
7f150a4936f2 patch 8.2.3970: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents: 26877
diff changeset
2735 errmsg = e_not_allowed_here;
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2736 // Check for a "normal" directory or file name in some options.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2737 else if (check_illegal_path_names(opt_idx, varp))
26865
bce848ec8b1b patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents: 26759
diff changeset
2738 errmsg = e_invalid_argument;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2739 else if (did_set_cb != NULL)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2740 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2741 optset_T args;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2742
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2743 args.os_varp = *varp;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2744 args.os_flags = opt_flags;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2745 args.os_oldval.string = oldval;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2746 args.os_newval.string = value;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2747 errmsg = did_set_cb(&args);
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2748 }
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2749 else if (varp == &T_NAME) // 'term'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2750 errmsg = did_set_term(&opt_idx, &free_oldval);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2751 else if ( varp == &p_isi // 'isident'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2752 || varp == &(curbuf->b_p_isk) // 'iskeyword'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2753 || varp == &p_isp // 'isprint'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2754 || varp == &p_isf) // 'isfname'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2755 errmsg = did_set_isopt(&did_chartab);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2756 #ifdef FEAT_SYN_HL
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2757 else if ( varp == &curwin->w_p_culopt // 'cursorlineopt'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2758 || gvarp == &curwin->w_allbuf_opt.wo_culopt)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2759 errmsg = did_set_cursorlineopt(varp);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2760 else if (varp == &curwin->w_p_cc) // 'colorcolumn'
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2761 errmsg = check_colorcolumn(curwin);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2762 #endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2763 else if (gvarp == &p_nf) // 'nrformats'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2764 errmsg = did_set_opt_strings(*varp, p_nf_values, TRUE);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2765 #ifdef FEAT_SESSION
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2766 else if (varp == &p_vop) // 'viewoptions'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2767 errmsg = did_set_opt_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2768 #endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2769 else if (varp == &p_sbo) // 'scrollopt'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2770 errmsg = did_set_opt_strings(p_sbo, p_scbopt_values, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2771 else if (varp == &p_wop) // 'wildoptions'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2772 errmsg = did_set_opt_strings(p_wop, p_wop_values, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2773 else if ( varp == &p_enc // 'encoding'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2774 || gvarp == &p_fenc // 'fileencoding'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2775 || varp == &p_tenc // 'termencoding'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2776 || gvarp == &p_menc) // 'makeencoding'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2777 errmsg = did_set_encoding(varp, gvarp, opt_flags);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2778 #ifdef FEAT_KEYMAP
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2779 else if (varp == &curbuf->b_p_keymap) // 'keymap'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2780 errmsg = did_set_keymap(varp, opt_flags, value_checked);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2781 #endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2782 else if (gvarp == &p_com) // 'comments'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2783 errmsg = did_set_comments(varp, errbuf);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2784 else if ( varp == &p_lcs // global 'listchars'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2785 || varp == &p_fcs) // global 'fillchars'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2786 errmsg = did_set_global_listfillchars(varp, opt_flags);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2787 else if (varp == &curwin->w_p_lcs) // local 'listchars'
29395
caaf5b270018 patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents: 29391
diff changeset
2788 errmsg = set_chars_option(curwin, varp, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2789 else if (varp == &curwin->w_p_fcs) // local 'fillchars'
29395
caaf5b270018 patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents: 29391
diff changeset
2790 errmsg = set_chars_option(curwin, varp, TRUE);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2791 #ifdef FEAT_VIMINFO
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2792 else if (varp == &p_viminfo) // 'viminfo'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2793 errmsg = did_set_viminfo(errbuf);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2794 #endif // FEAT_VIMINFO
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2795 // terminal options
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2796 else if (istermoption_idx(opt_idx) && full_screen)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2797 did_set_term_option(varp, &did_swaptcap);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2798 #ifdef CURSOR_SHAPE
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2799 else if (varp == &p_guicursor) // 'guicursor'
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2800 errmsg = parse_shape_opt(SHAPE_CURSOR);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2801 #endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2802 else if (varp == &p_slm) // 'selectmode'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2803 errmsg = did_set_opt_strings(p_slm, p_slm_values, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2804 else if (varp == &p_swb) // 'switchbuf'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2805 errmsg = did_set_opt_flags(p_swb, p_swb_values, &swb_flags, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2806 else if (varp == &p_spk) // 'splitkeep'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2807 errmsg = did_set_opt_strings(p_spk, p_spk_values, FALSE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2808 else if (varp == &p_debug) // 'debug'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2809 errmsg = did_set_opt_strings(p_debug, p_debug_values, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2810 else if (varp == &p_ead) // 'eadirection'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2811 errmsg = did_set_opt_strings(p_ead, p_ead_values, FALSE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2812 else if (gvarp == &p_bh) // 'bufhidden'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2813 errmsg = did_set_opt_strings(curbuf->b_p_bh, p_bufhidden_values,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2814 FALSE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2815 else if (gvarp == &p_cpt) // 'complete'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2816 errmsg = did_set_complete(varp, errbuf);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2817 else if (varp == &p_sloc) // 'showcmdloc'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2818 errmsg = did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2819 else if (varp == &p_bo) // 'belloff'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2820 errmsg = did_set_opt_flags(p_bo, p_bo_values, &bo_flags, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2821 else if (varp == &p_cmp) // 'casemap'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2822 errmsg = did_set_opt_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2823 #ifdef FEAT_FOLDING
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2824 else if (varp == &p_fdo) // 'foldopen'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2825 errmsg = did_set_opt_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2826 else if (varp == &p_fcl) // 'foldclose'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2827 errmsg = did_set_opt_strings(p_fcl, p_fcl_values, TRUE);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2828 #endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2829 else if (gvarp == &p_ft) // 'filetype'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2830 errmsg = did_set_filetype_or_syntax(varp, oldval, value_checked,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2831 &value_changed);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2832 #ifdef FEAT_SYN_HL
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2833 else if (gvarp == &p_syn) // 'syntax'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2834 errmsg = did_set_filetype_or_syntax(varp, oldval, value_checked,
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2835 &value_changed);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2836 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2837 #ifdef FEAT_TERMINAL
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2838 else if (varp == &curwin->w_p_wcr) // 'wincolor'
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 26175
diff changeset
2839 term_update_wincolor(curwin);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2840 # if defined(MSWIN)
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2841 else if (varp == &p_twt) // 'termwintype'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2842 errmsg = did_set_opt_strings(p_twt, p_twt_values, FALSE);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2843 # endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2844 #endif
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2845 #ifdef FEAT_EVAL
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2846 else if (
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2847 # ifdef FEAT_BEVAL
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2848 varp == &p_bexpr || // 'balloonexpr'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2849 # endif
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2850 # ifdef FEAT_DIFF
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2851 varp == &p_dex || // 'diffexpr'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2852 # endif
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2853 # ifdef FEAT_FOLDING
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2854 gvarp == &curwin->w_allbuf_opt.wo_fde || // 'foldexpr'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2855 gvarp == &curwin->w_allbuf_opt.wo_fdt || // 'foldtext'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2856 # endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2857 gvarp == &p_fex || // 'formatexpr'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2858 # ifdef FEAT_FIND_ID
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2859 gvarp == &p_inex || // 'includeexpr'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2860 # endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2861 gvarp == &p_inde || // 'indentexpr'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2862 # ifdef FEAT_DIFF
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2863 varp == &p_pex || // 'patchexpr'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2864 # endif
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2865 # ifdef FEAT_POSTSCRIPT
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2866 varp == &p_pexpr || // 'printexpr'
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2867 # endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2868 varp == &p_ccv) // 'charconvert'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2869 did_set_optexpr(varp);
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26408
diff changeset
2870 #endif
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2871 else if (varp == &p_ww) // 'whichwrap'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2872 errmsg = did_set_option_listflag(varp, (char_u *)WW_ALL, errbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2873 else if (varp == &p_shm) // 'shortmess'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2874 errmsg = did_set_option_listflag(varp, (char_u *)SHM_ALL, errbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2875 else if (varp == &(p_cpo)) // 'cpoptions'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2876 errmsg = did_set_option_listflag(varp, (char_u *)CPO_ALL, errbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2877 else if (varp == &(curbuf->b_p_fo)) // 'formatoptions'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2878 errmsg = did_set_option_listflag(varp, (char_u *)FO_ALL, errbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2879 #ifdef FEAT_CONCEAL
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2880 else if (varp == &curwin->w_p_cocu) // 'concealcursor'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2881 errmsg = did_set_option_listflag(varp, (char_u *)COCU_ALL, errbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2882 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2883 else if (varp == &p_mouse) // 'mouse'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2884 errmsg = did_set_option_listflag(varp, (char_u *)MOUSE_ALL, errbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2885 #if defined(FEAT_GUI)
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2886 else if (varp == &p_go) // 'guioptions'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2887 errmsg = did_set_option_listflag(varp, (char_u *)GO_ALL, errbuf);
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2888 #endif
26268
3aa48d4e3dc8 patch 8.2.3665: cannot use a lambda for 'tagfunc'
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
2889
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2890 // If an error is detected, restore the previous value.
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2891 if (errmsg != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2892 {
29509
d61007cc39b3 patch 9.0.0096: flag "new_value_alloced" is always true
Bram Moolenaar <Bram@vim.org>
parents: 29395
diff changeset
2893 free_string_option(*varp);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2894 *varp = oldval;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2895 // When resetting some values, need to act on it.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2896 if (did_chartab)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2897 (void)init_chartab();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2898 if (varp == &p_hl)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2899 (void)highlight_changed();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2900 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2901 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2902 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2903 #ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2904 // Remember where the option was set.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2905 set_option_sctx_idx(opt_idx, opt_flags, current_sctx);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2906 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2907 // Free string options that are in allocated memory.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2908 // Use "free_oldval", because recursiveness may change the flags under
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2909 // our fingers (esp. init_highlight()).
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2910 if (free_oldval)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2911 free_string_option(oldval);
29509
d61007cc39b3 patch 9.0.0096: flag "new_value_alloced" is always true
Bram Moolenaar <Bram@vim.org>
parents: 29395
diff changeset
2912 set_option_flag(opt_idx, P_ALLOCED);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2913
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2914 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2915 && is_global_local_option(opt_idx))
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2916 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2917 // global option with local value set to use global value; free
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2918 // the local value and make it empty
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2919 char_u *p = get_option_varp_scope(opt_idx, OPT_LOCAL);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2920 free_string_option(*(char_u **)p);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2921 *(char_u **)p = empty_option;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2922 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2923
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2924 // May set global value for local option.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2925 else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2926 set_string_option_global(opt_idx, varp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2927
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2928 // Trigger the autocommand only after setting the flags.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2929 #ifdef FEAT_SYN_HL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2930 if (varp == &(curbuf->b_p_syn))
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2931 do_syntax_autocmd(value_changed);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2932 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2933 else if (varp == &(curbuf->b_p_ft))
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2934 do_filetype_autocmd(varp, opt_flags, value_changed);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2935 #ifdef FEAT_SPELL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2936 if (varp == &(curwin->w_s->b_p_spl))
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2937 do_spelllang_source();
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2938 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2939 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2940
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2941 if (varp == &p_mouse)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2942 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2943 if (*p_mouse == NUL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2944 mch_setmouse(FALSE); // switch mouse off
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2945 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2946 setmouse(); // in case 'mouse' changed
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2947 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2948
20609
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
2949 #if defined(FEAT_LUA) || defined(PROTO)
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
2950 if (varp == &p_rtp)
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
2951 update_package_paths_in_lua();
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
2952 #endif
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
2953
27000
8c0730eca2ce patch 8.2.4029: debugging NFA regexp my crash, cached indent may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26966
diff changeset
2954 #if defined(FEAT_LINEBREAK)
8c0730eca2ce patch 8.2.4029: debugging NFA regexp my crash, cached indent may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26966
diff changeset
2955 // Changing Formatlistpattern when briopt includes the list setting:
8c0730eca2ce patch 8.2.4029: debugging NFA regexp my crash, cached indent may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26966
diff changeset
2956 // redraw
8c0730eca2ce patch 8.2.4029: debugging NFA regexp my crash, cached indent may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26966
diff changeset
2957 if ((varp == &p_flp || varp == &(curbuf->b_p_flp))
8c0730eca2ce patch 8.2.4029: debugging NFA regexp my crash, cached indent may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26966
diff changeset
2958 && curwin->w_briopt_list)
29732
89e1d67814a9 patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents: 29672
diff changeset
2959 redraw_all_later(UPD_NOT_VALID);
27000
8c0730eca2ce patch 8.2.4029: debugging NFA regexp my crash, cached indent may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26966
diff changeset
2960 #endif
8c0730eca2ce patch 8.2.4029: debugging NFA regexp my crash, cached indent may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26966
diff changeset
2961
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2962 if (curwin->w_curswant != MAXCOL
18354
9f51d0cef8da patch 8.1.2171: mouse support not always available
Bram Moolenaar <Bram@vim.org>
parents: 18303
diff changeset
2963 && (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2964 curwin->w_set_curswant = TRUE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2965
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
2966 if ((opt_flags & OPT_NO_REDRAW) == 0)
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
2967 {
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2968 #ifdef FEAT_GUI
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2969 // set when changing an option that only requires a redraw in the GUI
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2970 int redraw_gui_only = FALSE;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2971
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2972 if (varp == &p_go // 'guioptions'
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2973 || varp == &p_guifont // 'guifont'
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2974 # ifdef FEAT_GUI_TABLINE
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2975 || varp == &p_gtl // 'guitablabel'
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2976 || varp == &p_gtt // 'guitabtooltip'
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2977 # endif
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2978 # ifdef FEAT_XFONTSET
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2979 || varp == &p_guifontset // 'guifontset'
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2980 # endif
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2981 || varp == &p_guifontwide // 'guifontwide'
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2982 # ifdef FEAT_GUI_GTK
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2983 || varp == &p_guiligatures // 'guiligatures'
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2984 # endif
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2985 )
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2986 redraw_gui_only = TRUE;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2987
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
2988 // check redraw when it's not a GUI option or the GUI is active.
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
2989 if (!redraw_gui_only || gui.in_use)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2990 #endif
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
2991 check_redraw(get_option_flags(opt_idx));
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
2992 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2993
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2994 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2995 if (did_swaptcap)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2996 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2997 set_termname((char_u *)"win32");
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2998 init_highlight(TRUE, FALSE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2999 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3000 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3001
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3002 return errmsg;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3003 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3004
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3005 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3006 * Check an option that can be a range of string values.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3007 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3008 * Return OK for correct value, FAIL otherwise.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3009 * Empty is always OK.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3010 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3011 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3012 check_opt_strings(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3013 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3014 char **values,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3015 int list) // when TRUE: accept a list of values
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3016 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3017 return opt_strings_flags(val, values, NULL, list);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3018 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3019
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3020 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3021 * Handle an option that can be a range of string values.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3022 * Set a flag in "*flagp" for each string present.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3023 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3024 * Return OK for correct value, FAIL otherwise.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3025 * Empty is always OK.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3026 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3027 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3028 opt_strings_flags(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3029 char_u *val, // new value
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3030 char **values, // array of valid string values
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3031 unsigned *flagp,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3032 int list) // when TRUE: accept a list of values
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3033 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3034 int i;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3035 int len;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3036 unsigned new_flags = 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3037
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3038 while (*val)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3039 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3040 for (i = 0; ; ++i)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3041 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3042 if (values[i] == NULL) // val not found in values[]
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3043 return FAIL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3044
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3045 len = (int)STRLEN(values[i]);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3046 if (STRNCMP(values[i], val, len) == 0
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3047 && ((list && val[len] == ',') || val[len] == NUL))
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3048 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3049 val += len + (val[len] == ',');
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3050 new_flags |= (1 << i);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3051 break; // check next item in val list
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3052 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3053 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3054 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3055 if (flagp != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3056 *flagp = new_flags;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3057
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3058 return OK;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3059 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3060
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3061 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3062 * return OK if "p" is a valid fileformat name, FAIL otherwise.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3063 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3064 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3065 check_ff_value(char_u *p)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3066 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3067 return check_opt_strings(p, p_ff_values, FALSE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3068 }
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3069
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3070 /*
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3071 * Save the actual shortmess Flags and clear them temporarily to avoid that
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3072 * file messages overwrites any output from the following commands.
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3073 *
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3074 * Caller must make sure to first call save_clear_shm_value() and then
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3075 * restore_shm_value() exactly the same number of times.
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3076 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3077 void
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3078 save_clear_shm_value()
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3079 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3080 if (STRLEN(p_shm) >= SHM_LEN)
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3081 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3082 iemsg(e_internal_error_shortmess_too_long);
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3083 return;
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3084 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3085
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3086 if (++set_shm_recursive == 1)
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3087 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3088 STRCPY(shm_buf, p_shm);
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3089 set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3090 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3091 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3092
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3093 /*
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3094 * Restore the shortmess Flags set from the save_clear_shm_value() function.
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3095 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3096 void
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3097 restore_shm_value()
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3098 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3099 if (--set_shm_recursive == 0)
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3100 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3101 set_option_value_give_err((char_u *)"shm", 0L, shm_buf, 0);
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3102 vim_memset(shm_buf, 0, SHM_LEN);
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3103 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3104 }