annotate src/optionstr.c @ 32086:45142117e206 v9.0.1374

patch 9.0.1374: function for setting options not used consistently Commit: https://github.com/vim/vim/commit/c727b19e9f1df36e44321d933334c7b4961daa54 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri Mar 3 12:26:15 2023 +0000 patch 9.0.1374: function for setting options not used consistently Problem: Function for setting options not used consistently. Solution: Use a function for 'encoding' and terminal options. (Yegappan Lakshmanan, closes #12099)
author Bram Moolenaar <Bram@vim.org>
date Fri, 03 Mar 2023 13:30:03 +0100
parents 32acf287a9ae
children e7ab58f57ea3
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};
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
100 static char *(p_sws_values[]) = {"fsync", "sync", NULL};
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 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
103 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
104
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 * 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
107 * option values.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 didset_string_options(void)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 {
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_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
113 (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
114 (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
115 #ifdef FEAT_SESSION
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_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
117 (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
118 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 #ifdef FEAT_FOLDING
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 (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
121 #endif
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_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
123 (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
124 (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
125 #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
126 (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
127 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 #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
129 (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
130 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 #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
132 (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
133 #endif
28839
b93668df9160 patch 8.2.4943: changing 'switchbuf' may have no effect
Bram Moolenaar <Bram@vim.org>
parents: 28459
diff changeset
134 (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
135 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 #if defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 * Trigger the OptionSet autocommand.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 * "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
141 * "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
142 * "oldval" the old value
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 * "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
144 * are set)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 * "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
146 * are set)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 * "newval" the new value
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 void
31259
a7dba627a21b patch 9.0.0963: function name does not match autocmd event name
Bram Moolenaar <Bram@vim.org>
parents: 31192
diff changeset
150 trigger_optionset_string(
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 char_u *oldval,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 char_u *oldval_l,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 char_u *oldval_g,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 char_u *newval)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 // 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
159 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
160 || *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
161 return;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
163 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
164
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
165 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
166 (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
167 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
168 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
169 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
170 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
171 {
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_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
173 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
174 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
175 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
176 {
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_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
178 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
179 }
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
180 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
181 {
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_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
183 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
184 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
185 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
186 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
187 {
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_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
189 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
190 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
191 apply_autocmds(EVENT_OPTIONSET,
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
192 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
193 NULL);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
194 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
195 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 static char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 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
200 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 if (errbuf == NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 return "";
26917
d91aea2a612c patch 8.2.3987: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents: 26883
diff changeset
203 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
204 return errbuf;
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 * 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
209 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 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
212 {
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_bh);
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_bt);
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_fenc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 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
217 #ifdef FEAT_FIND_ID
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_def);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 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
220 # ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 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
222 # endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 #endif
28942
6cdf55afaae9 patch 8.2.4993: smart/C/lisp indenting is optional
Bram Moolenaar <Bram@vim.org>
parents: 28839
diff changeset
224 #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
225 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
226 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
227 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 #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
229 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
230 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 #if defined(FEAT_CRYPT)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 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
233 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 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
235 #if defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 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
237 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 #ifdef FEAT_CRYPT
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 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
240 #endif
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_kp);
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_mps);
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_fo);
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_flp);
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_isk);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 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
247 #ifdef FEAT_FOLDING
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 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
249 #endif
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_nf);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 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
252 #ifdef FEAT_SYN_HL
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_p_syn);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 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
255 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 #ifdef FEAT_SPELL
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_spc);
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_spf);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 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
260 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
261 #endif
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_sua);
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_cink);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 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
265 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
266 parse_cino(buf);
30853
40df8a6515f6 patch 9.0.0761: cannot use 'indentexpr' for Lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 30645
diff changeset
267 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
268 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
269 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
270 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
271 #ifdef FEAT_COMPL_FUNC
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_cfu);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 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
274 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
275 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 #ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 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
278 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 #ifdef FEAT_KEYMAP
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 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
281 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282 #ifdef FEAT_QUICKFIX
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_gp);
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_mp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 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
286 #endif
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_ep);
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_path);
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_tags);
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_tc);
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_dict);
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_tsr);
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_lw);
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_bkc);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 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
296 #ifdef FEAT_VARTABS
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_vsts);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 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
299 #endif
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 * 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
304 * 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
305 * 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
306 * check_options().
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 * 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
308 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 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
311 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 if (p != empty_option)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 vim_free(p);
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
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 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
318 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 if (*pp != empty_option)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 vim_free(*pp);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 *pp = empty_option;
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
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 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
326 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 if (*pp == NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 *pp = empty_option;
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 * 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
333 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 static void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 set_string_option_global(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 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
337 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
338 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 char_u **p, *s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 // 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
342 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
343 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
344 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 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
346 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
347 && p != varp
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 && (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
349 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 free_string_option(*p);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 *p = s;
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 * 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
357 * 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
358 * 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
359 * 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
360 * "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
361 * "set_sid".
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 set_string_option_direct(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 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
369 int set_sid UNUSED)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 char_u *s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 char_u **varp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 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
374 int idx = opt_idx;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376 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
377 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
378 idx = findoption(name);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 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
380 {
26877
06a137af96f8 patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents: 26865
diff changeset
381 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
382 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
383 return;
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
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387 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
388 return;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
390 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
391 if (s == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
392 return;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
393
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
394 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
395 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
396 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
397 free_string_option(*varp);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
398 *varp = s;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
399
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
400 // 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
401 if (both)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
402 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
403
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
404 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
405
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
406 // 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
407 // 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
408 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
409 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
410 free_string_option(*varp);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
411 *varp = empty_option;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
412 }
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
413 # ifdef FEAT_EVAL
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
414 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
415 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
416 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
417
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
418 if (set_sid == 0)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
419 script_ctx = current_sctx;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
420 else
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 {
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
422 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
423 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
424 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
425 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
426 }
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
427 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
428 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 # endif
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433 * 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
434 * 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
435 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 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
438 win_T *wp,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 int set_sid)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 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
446
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447 block_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 curwin = wp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449 curbuf = curwin->w_buffer;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450 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
451 curwin = save_curwin;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 curbuf = curwin->w_buffer;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 unblock_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455
27018
268f6a3511df patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents: 27000
diff changeset
456 #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
457 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458 * 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
459 * 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
460 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
462 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
463 buf_T *buf,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
467 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 int set_sid)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 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
471
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 block_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 curbuf = buf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 curwin->w_buffer = curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 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
476 curbuf = save_curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 curwin->w_buffer = curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
478 unblock_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
479 }
27018
268f6a3511df patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents: 27000
diff changeset
480 #endif
18100
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
483 * 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
484 *
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
485 * 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
486 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487 char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488 set_string_option(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
490 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
491 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
492 char *errbuf)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
493 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
494 char_u *s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
495 char_u **varp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
496 char_u *oldval;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 #if defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
498 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
499 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
500 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
501 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
502 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
503 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
504 #endif
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
505 char *errmsg = NULL;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
506 int value_checked = FALSE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
507
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
508 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
509 return NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
510
19675
bee179e81f28 patch 8.2.0394: Coverity complains about using NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 19265
diff changeset
511 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
512 if (s == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
513 return NULL;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
514
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
515 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
516 (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
517 ? (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
518 ? OPT_GLOBAL : OPT_LOCAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
519 : opt_flags);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
520 oldval = *varp;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
521 #if defined(FEAT_EVAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
522 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
523 {
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
524 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
525 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
526 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
527 #endif
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
528 *varp = s;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
529
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530 #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
531 if (!starting
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
532 # ifdef FEAT_CRYPT
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
533 && !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
534 # endif
31752
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 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
537 if (oldval_l != NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
538 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
539 if (oldval_g != NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
540 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
541 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
542 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
543 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544 #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
545 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
546 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
547 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
548
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549 #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
550 // 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
551 if (errmsg == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
552 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
553 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
554 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
555 vim_free(saved_oldval);
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_l);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
557 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
558 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
559 #endif
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
560 return errmsg;
18100
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 * 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
565 * 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
566 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 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
569 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 return valid_name(val, ".-_");
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
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 #ifdef FEAT_STL_OPT
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575 * 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
576 * 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
577 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 static char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579 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
580 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 int groupdepth = 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 static char errbuf[80];
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583
22721
92a100fc5e17 patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents: 22091
diff changeset
584 while (*s)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 // 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
587 while (*s && *s != '%')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589 if (!*s)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 break;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
591 s++;
31936
82da100c0e45 patch 9.0.1300: 'statusline' only supports one "%=" item
Bram Moolenaar <Bram@vim.org>
parents: 31886
diff changeset
592 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
593 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 if (*s == ')')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
600 if (--groupdepth < 0)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
601 break;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
602 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 if (*s == '-')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 while (VIM_ISDIGIT(*s))
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608 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
609 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610 if (*s == '.')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
612 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613 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
614 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 if (*s == '(')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
618 groupdepth++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
620 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621 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
622 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623 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
624 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
625 if (*s == '{')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626 {
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
627 int reevaluate = (*++s == '%');
24630
4cf4d7a71fac patch 8.2.2854: custom statusline cannot contain % items
Bram Moolenaar <Bram@vim.org>
parents: 24582
diff changeset
628
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
629 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
630 // "}" 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
631 return illegal_char(errbuf, '}');
24630
4cf4d7a71fac patch 8.2.2854: custom statusline cannot contain % items
Bram Moolenaar <Bram@vim.org>
parents: 24582
diff changeset
632 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
633 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
634 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
635 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
636 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
638 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
639 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
640 return NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
643
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 /*
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
645 * 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
646 * 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
647 * 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
648 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
649 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
650 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
651 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
652 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
653 && 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
654 ? "/\\*?[|;&<>\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
655 || ((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
656 && 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
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
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
659 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
660 * An option that accepts a list of flags is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
661 * e.g. 'viewoptions', 'switchbuf', 'casemap', etc.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
662 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
663 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
664 did_set_opt_flags(char_u *val, char **values, unsigned *flagp, int list)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
665 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
666 if (opt_strings_flags(val, values, flagp, list) == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
667 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
668
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
669 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
670 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
671
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
672 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
673 * An option that accepts a list of string values is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
674 * e.g. 'nrformats', 'scrollopt', 'wildoptions', etc.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
675 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
676 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
677 did_set_opt_strings(char_u *val, char **values, int list)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
678 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
679 return did_set_opt_flags(val, values, NULL, list);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
680 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
681
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
682 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
683 * An option which is a list of flags is set. Valid values are in 'flags'.
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
684 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
685 static char *
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
686 did_set_option_listflag(char_u *val, char_u *flags, char *errbuf)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
687 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
688 char_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
689
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
690 for (s = val; *s; ++s)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
691 if (vim_strchr(flags, *s) == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
692 return illegal_char(errbuf, *s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
693
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
694 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
695 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
696
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
697 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
698 * The 'ambiwidth' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
699 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
700 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
701 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
702 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
703 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
704 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
705
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
706 return check_chars_options();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
707 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
708
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
709 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
710 * The 'background' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
711 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
712 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
713 did_set_background(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
714 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
715 if (check_opt_strings(p_bg, p_bg_values, FALSE) == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
716 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
717
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
718 #ifdef FEAT_EVAL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
719 int dark = (*p_bg == 'd');
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
720 #endif
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
721
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
722 init_highlight(FALSE, FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
723
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
724 #ifdef FEAT_EVAL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
725 if (dark != (*p_bg == 'd')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
726 && get_var_value((char_u *)"g:colors_name") != 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
727 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
728 // The color scheme must have set 'background' back to another
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
729 // value, that's not what we want here. Disable the color
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
730 // scheme and set the colors again.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
731 do_unlet((char_u *)"g:colors_name", TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
732 free_string_option(p_bg);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
733 p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
734 check_string_option(&p_bg);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
735 init_highlight(FALSE, FALSE);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
736 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
737 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
738 #ifdef FEAT_TERMINAL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
739 term_update_colors_all();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
740 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
741
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
742 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
743 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
744
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
745 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
746 * The 'backspace' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
747 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
748 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
749 did_set_backspace(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
750 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
751 if (VIM_ISDIGIT(*p_bs))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
752 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
753 if (*p_bs > '3' || p_bs[1] != NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
754 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
755 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
756 else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
757 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
758
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
759 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
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
762 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
763 * 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
764 */
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
765 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
766 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
767 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
768 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
769 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
770 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
771
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
772 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
773 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
774 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
775 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
776 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
777
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
778 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
779 // 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
780 *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
781 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
782 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
783 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
784 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
785 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
786 + (((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
787 + (((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
788 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
789 // 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
790 (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
791 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
792 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
793 }
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
796 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
797 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
798
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 * 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
801 */
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
802 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
803 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
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 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
806 *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
807 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
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 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
810 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
811
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
812 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
813 * The 'belloff' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
814 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
815 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
816 did_set_belloff(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
817 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
818 return did_set_opt_flags(p_bo, p_bo_values, &bo_flags, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
819 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
820
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
821 #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
822 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
823 * 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
824 */
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
825 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
826 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
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 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
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 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
831 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
832 // 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
833 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
834 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
835
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
836 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
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 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
839
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
840 #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
841 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
842 * The 'browsedir' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
843 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
844 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
845 did_set_browsedir(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
846 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
847 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
848 && !mch_isdir(p_bsdir))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
849 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
850
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
851 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
852 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
853 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
854
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
855 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
856 * The 'bufhidden' 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
857 */
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
858 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
859 did_set_bufhidden(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
860 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
861 return did_set_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
862 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
863
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
864 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
865 * The 'buftype' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
866 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
867 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
868 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
869 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
870 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
871 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
872
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
873 if (curwin->w_status_height)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
874 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
875 curwin->w_redr_status = TRUE;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
876 redraw_later(UPD_VALID);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
877 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
878 curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
879 redraw_titles();
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
880
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 NULL;
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
885 * The 'casemap' 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
886 */
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
887 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
888 did_set_casemap(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
889 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
890 return did_set_opt_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
891 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
892
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
893 /*
32076
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
894 * The global 'listchars' or 'fillchars' option is changed.
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
895 */
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
896 static char *
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
897 did_set_global_listfillchars(char_u *val, int opt_lcs, int opt_flags)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
898 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
899 char *errmsg = NULL;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
900 char_u **local_ptr = opt_lcs ? &curwin->w_p_lcs : &curwin->w_p_fcs;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
901
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
902 // only apply the global value to "curwin" when it does not have a
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
903 // local value
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
904 if (opt_lcs)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
905 errmsg = set_listchars_option(curwin, val,
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
906 **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
907 else
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
908 errmsg = set_fillchars_option(curwin, val,
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
909 **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
910 if (errmsg != NULL)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
911 return errmsg;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
912
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
913 tabpage_T *tp;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
914 win_T *wp;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
915
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
916 // If the current window is set to use the global
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
917 // 'listchars'/'fillchars' value, clear the window-local value.
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
918 if (!(opt_flags & OPT_GLOBAL))
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
919 clear_string_option(local_ptr);
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
920 FOR_ALL_TAB_WINDOWS(tp, wp)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
921 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
922 // If the current window has a local value need to apply it
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
923 // again, it was changed when setting the global value.
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
924 // If no error was returned above, we don't expect an error
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
925 // here, so ignore the return value.
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
926 if (opt_lcs)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
927 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
928 if (*wp->w_p_lcs == NUL)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
929 (void)set_listchars_option(wp, wp->w_p_lcs, TRUE);
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
930 }
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
931 else
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
932 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
933 if (*wp->w_p_fcs == NUL)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
934 (void)set_fillchars_option(wp, wp->w_p_fcs, TRUE);
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
935 }
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
936 }
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
937
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
938 redraw_all_later(UPD_NOT_VALID);
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
939
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
940 return NULL;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
941 }
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
942
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
943 /*
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
944 * The 'fillchars' option or the 'listchars' option is changed.
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
945 */
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
946 char *
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
947 did_set_chars_option(optset_T *args)
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
948 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
949 char_u **varp = (char_u **)args->os_varp;
32076
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
950 char *errmsg = NULL;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
951
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
952 if ( varp == &p_lcs // global 'listchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
953 || varp == &p_fcs) // global 'fillchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
954 errmsg = did_set_global_listfillchars(*varp, varp == &p_lcs,
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
955 args->os_flags);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
956 else if (varp == &curwin->w_p_lcs) // local 'listchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
957 errmsg = set_listchars_option(curwin, *varp, TRUE);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
958 else if (varp == &curwin->w_p_fcs) // local 'fillchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
959 errmsg = set_fillchars_option(curwin, *varp, TRUE);
32076
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
960
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
961 return errmsg;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
962 }
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
963
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
964 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
965 * The 'cinoptions' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
966 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
967 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
968 did_set_cinoptions(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
969 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
970 // TODO: recognize errors
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
971 parse_cino(curbuf);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
972
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
973 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
974 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
975
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
976 #if defined(FEAT_SYN_HL) || 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
977 /*
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
978 * The 'colorcolumn' option is changed.
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
979 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
980 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
981 did_set_colorcolumn(optset_T *args UNUSED)
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
982 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
983 return check_colorcolumn(curwin);
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
984 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
985 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
986
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
987 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
988 * The 'comments' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
989 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
990 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
991 did_set_comments(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
992 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
993 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
994 char_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
995 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
996
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
997 for (s = *varp; *s; )
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
998 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
999 while (*s && *s != ':')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1000 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1001 if (vim_strchr((char_u *)COM_ALL, *s) == NULL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1002 && !VIM_ISDIGIT(*s) && *s != '-')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1003 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1004 errmsg = illegal_char(args->os_errbuf, *s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1005 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1006 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1007 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1008 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1009 if (*s++ == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1010 errmsg = e_missing_colon;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1011 else if (*s == ',' || *s == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1012 errmsg = e_zero_length_string;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1013 if (errmsg != NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1014 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1015 while (*s && *s != ',')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1016 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1017 if (*s == '\\' && s[1] != NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1018 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1019 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1020 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1021 s = skip_to_option_part(s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1022 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1023
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1024 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1025 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1026
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1027 #if defined(FEAT_FOLDING) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1028 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1029 * The 'commentstring' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1030 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1031 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1032 did_set_commentstring(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1033 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1034 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1035
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1036 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1037 return e_commentstring_must_be_empty_or_contain_str;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1038
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1039 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1040 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1041 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1042
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1043 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1044 * The 'complete' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1045 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1046 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1047 did_set_complete(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1048 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1049 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1050 char_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1051
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1052 // check if it is a valid value for 'complete' -- Acevedo
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1053 for (s = *varp; *s;)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1054 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1055 while (*s == ',' || *s == ' ')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1056 s++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1057 if (!*s)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1058 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1059 if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1060 return illegal_char(args->os_errbuf, *s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1061 if (*++s != NUL && *s != ',' && *s != ' ')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1062 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1063 if (s[-1] == 'k' || s[-1] == 's')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1064 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1065 // skip optional filename after 'k' and 's'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1066 while (*s && *s != ',' && *s != ' ')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1067 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1068 if (*s == '\\' && s[1] != NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1069 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1070 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1071 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1072 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1073 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1074 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1075 if (args->os_errbuf != NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1076 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1077 sprintf((char *)args->os_errbuf,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1078 _(e_illegal_character_after_chr), *--s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1079 return args->os_errbuf;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1080 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1081 return "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1082 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1083 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1084 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1085
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1086 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1087 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1088
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1089 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1090 * The 'completeopt' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1091 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1092 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1093 did_set_completeopt(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1094 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1095 if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1096 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1097
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1098 completeopt_was_set();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1099 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1100 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1101
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1102 #if (defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1103 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1104 * The 'completepopup' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1105 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1106 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1107 did_set_completepopup(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1108 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1109 if (parse_completepopup(NULL) == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1110 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1111
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1112 popup_close_info();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1113 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1114 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1115 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1116
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1117 #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1118 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1119 * The 'completeslash' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1120 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1121 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1122 did_set_completeslash(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1123 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1124 if (check_opt_strings(p_csl, p_csl_values, FALSE) != OK
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1125 || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1126 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1127
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1128 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1129 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1130 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1131
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1132 #if defined(FEAT_CONCEAL) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1133 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1134 * The 'concealcursor' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1135 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1136 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1137 did_set_concealcursor(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1138 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1139 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1140
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1141 return did_set_option_listflag(*varp, (char_u *)COCU_ALL, args->os_errbuf);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1142 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1143 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1144
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1145 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1146 * The 'cpoptions' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1147 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1148 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1149 did_set_cpoptions(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1150 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1151 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1152
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1153 return did_set_option_listflag(*varp, (char_u *)CPO_ALL, args->os_errbuf);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1154 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1155
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1156 #if defined(FEAT_CRYPT) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1157 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1158 * The 'cryptkey' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1159 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1160 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1161 did_set_cryptkey(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1162 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1163 // Make sure the ":set" command doesn't show the new value in the
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1164 // history.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1165 remove_key_from_history();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1166
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1167 if (STRCMP(curbuf->b_p_key, args->os_oldval.string) != 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1168 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1169 // Need to update the swapfile.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1170 ml_set_crypt_key(curbuf, args->os_oldval.string,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1171 *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1172 changed_internal();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1173 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1174
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1175 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1176 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1177
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1178 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1179 * The 'cryptmethod' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1180 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1181 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1182 did_set_cryptmethod(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1183 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1184 char_u *p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1185 char_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1186
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1187 if (args->os_flags & OPT_LOCAL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1188 p = curbuf->b_p_cm;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1189 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1190 p = p_cm;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1191 if (check_opt_strings(p, p_cm_values, TRUE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1192 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1193 else if (crypt_self_test() == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1194 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1195
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1196 // When setting the global value to empty, make it "zip".
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1197 if (*p_cm == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1198 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1199 free_string_option(p_cm);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1200 p_cm = vim_strsave((char_u *)"zip");
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1201 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1202 // When using ":set cm=name" the local value is going to be empty.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1203 // Do that here, otherwise the crypt functions will still use the
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1204 // local value.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1205 if ((args->os_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1206 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1207 free_string_option(curbuf->b_p_cm);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1208 curbuf->b_p_cm = empty_option;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1209 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1210
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1211 // Need to update the swapfile when the effective method changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1212 // Set "s" to the effective old value, "p" to the effective new
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1213 // method and compare.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1214 if ((args->os_flags & OPT_LOCAL) && *args->os_oldval.string == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1215 s = p_cm; // was previously using the global value
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1216 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1217 s = args->os_oldval.string;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1218 if (*curbuf->b_p_cm == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1219 p = p_cm; // is now using the global value
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1220 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1221 p = curbuf->b_p_cm;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1222 if (STRCMP(s, p) != 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1223 ml_set_crypt_key(curbuf, curbuf->b_p_key, s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1224
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1225 // If the global value changes need to update the swapfile for all
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1226 // buffers using that value.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1227 if ((args->os_flags & OPT_GLOBAL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1228 && STRCMP(p_cm, args->os_oldval.string) != 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1229 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1230 buf_T *buf;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1231
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1232 FOR_ALL_BUFFERS(buf)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1233 if (buf != curbuf && *buf->b_p_cm == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1234 ml_set_crypt_key(buf, buf->b_p_key, args->os_oldval.string);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1235 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1236 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1237 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1238 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1239
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1240 #if (defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1241 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1242 * The 'cscopequickfix' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1243 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1244 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1245 did_set_cscopequickfix(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1246 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1247 char_u *p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1248
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1249 if (p_csqf == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1250 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1251
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1252 p = p_csqf;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1253 while (*p != NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1254 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1255 if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1256 || p[1] == NUL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1257 || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1258 || (p[2] != NUL && p[2] != ','))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1259 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1260 else if (p[2] == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1261 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1262 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1263 p += 3;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1264 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1265
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1266 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1267 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1268 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1269
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1270 #if defined(FEAT_SYN_HL) || defined(PROTO)
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1271 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1272 * 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
1273 */
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1274 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1275 did_set_cursorlineopt(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
1276 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1277 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1278
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1279 if (**varp == NUL || fill_culopt_flags(*varp, curwin) != 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
1280 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
1281
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1282 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
1283 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1284 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1285
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1286 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1287 * The 'debug' 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
1288 */
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 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1290 did_set_debug(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
1291 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1292 return did_set_opt_strings(p_debug, p_debug_values, 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
1293 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1294
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1295 #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
1296 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1297 * The 'diffopt' 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
1298 */
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
1299 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1300 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
1301 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1302 if (diffopt_changed() == FAIL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1303 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
1304
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1305 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
1306 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1307 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1308
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1309 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1310 * The 'display' 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
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 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1313 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
1314 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1315 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1316 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1317
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1318 (void)init_chartab();
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1319 return NULL;
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1320 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1321
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1322 /*
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1323 * The 'eadirection' option is changed.
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1324 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1325 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1326 did_set_eadirection(optset_T *args UNUSED)
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1327 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1328 return did_set_opt_strings(p_ead, p_ead_values, FALSE);
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1329 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1330
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1331 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1332 * 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
1333 * 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
1334 */
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1335 char *
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1336 did_set_encoding(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
1337 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1338 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1339 char_u **gvarp;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1340 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
1341 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
1342
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1343 // Get the global option to compare with, otherwise we would have to check
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1344 // two values for all local options.
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1345 gvarp = (char_u **)get_option_varp_scope(args->os_idx, OPT_GLOBAL);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1346
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1347 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
1348 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1349 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
1350 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
1351 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
1352 // 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
1353 // 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
1354 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
1355 else
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 // 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
1358 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
1359 // 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
1360 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
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 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1363 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
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 // 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
1366 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
1367 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
1368 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1369 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
1370 *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
1371 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1372 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
1373 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1374 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
1375 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
1376 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1377 }
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 #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
1380 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
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 // 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
1383 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
1384 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
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 #endif
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 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
1389 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1390 #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
1391 // 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
1392 // (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
1393 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
1394 (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
1395 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1396
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1397 // 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
1398 // '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
1399 // 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
1400 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
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 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
1403 || 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
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 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
1406 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
1407 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
1408 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1409 }
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 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
1412 // $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
1413 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
1414 {
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1415 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
1416 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
1417 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1418 #endif
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1421 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
1422 }
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1425 * The 'eventignore' 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
1426 */
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
1427 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1428 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
1429 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1430 if (check_ei() == FAIL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1431 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
1432 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
1433 }
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 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1436 * 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
1437 */
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
1438 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
1439 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
1440 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1441 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1442
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
1443 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
1444 return e_cannot_make_changes_modifiable_is_off;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1445 else if (check_opt_strings(*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
1446 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
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 // 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
1449 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
1450 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
1451 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1452 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
1453 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
1454 // 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
1455 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
1456 // 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
1457 // 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
1458 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
1459 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
1460
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1461 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
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
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 * 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
1466 */
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
1467 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
1468 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
1469 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1470 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
1471 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
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 // 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
1474 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
1475 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
1476 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1477 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
1478
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1479 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
1480 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1481
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1482 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1483 * The 'filetype' or the 'syntax' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1484 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1485 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1486 did_set_filetype_or_syntax(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1487 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1488 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1489
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1490 if (!valid_filetype(*varp))
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1491 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1492
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1493 args->os_value_changed = STRCMP(args->os_oldval.string, *varp) != 0;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1494
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1495 // Since we check the value, there is no need to set P_INSECURE,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1496 // even when the value comes from a modeline.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1497 args->os_value_checked = TRUE;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1498
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1499 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1500 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1501
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1502 #if defined(FEAT_FOLDING) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1503 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1504 * The 'foldclose' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1505 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1506 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1507 did_set_foldclose(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1508 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1509 return did_set_opt_strings(p_fcl, p_fcl_values, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1510 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1511 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1512
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1513 #if (defined(FEAT_EVAL) && defined(FEAT_FOLDING)) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1514 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1515 * The 'foldexpr' 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
1516 */
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
1517 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1518 did_set_foldexpr(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1519 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1520 (void)did_set_optexpr(args);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1521 if (foldmethodIsExpr(curwin))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1522 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1523 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1524 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1525 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1526
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1527 #if defined(FEAT_FOLDING) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1528 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1529 * The 'foldignore' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1530 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1531 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1532 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
1533 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1534 if (foldmethodIsIndent(curwin))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1535 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1536 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1537 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1538
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1539 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1540 * The 'foldmarker' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1541 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1542 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1543 did_set_foldmarker(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1544 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1545 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1546 char_u *p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1547
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1548 p = vim_strchr(*varp, ',');
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1549 if (p == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1550 return e_comma_required;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1551 else if (p == *varp || p[1] == NUL)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1552 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1553 else if (foldmethodIsMarker(curwin))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1554 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
1555
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1556 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
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1559 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1560 * The 'foldmethod' 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
1561 */
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
1562 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1563 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
1564 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1565 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1566
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1567 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1568 || *curwin->w_p_fdm == 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
1569 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
1570
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1571 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1572 if (foldmethodIsDiff(curwin))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1573 newFoldLevel();
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1574 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
1575 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1576
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1577 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1578 * The 'foldopen' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1579 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1580 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1581 did_set_foldopen(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1582 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1583 return did_set_opt_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1584 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1585 #endif
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1588 * The 'formatoptions' 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
1589 */
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
1590 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1591 did_set_formatoptions(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
1592 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1593 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1594
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1595 return did_set_option_listflag(*varp, (char_u *)FO_ALL, args->os_errbuf);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1596 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1597
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1598 #if defined(CURSOR_SHAPE) || defined(PROTO)
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1599 /*
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1600 * The 'guicursor' option is changed.
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1601 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1602 char *
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1603 did_set_guicursor(optset_T *args UNUSED)
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1604 {
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1605 return parse_shape_opt(SHAPE_CURSOR);
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1606 }
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1607 #endif
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1608
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
1609 #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
1610 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1611 * 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
1612 */
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
1613 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
1614 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
1615 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1616 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
1617 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
1618
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1619 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
1620 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1621 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
1622 # 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
1623 // 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
1624 // 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
1625 // 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
1626 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
1627 {
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
1628 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
1629 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
1630 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
1631 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1632 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1633 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
1634 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1635 # 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
1636 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
1637 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1638 // 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
1639 // 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
1640 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
1641 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
1642 }
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1644 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1645 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
1646 }
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1649 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
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
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
1652 # 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
1653 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1654 * 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
1655 */
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
1656 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
1657 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
1658 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1659 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
1660
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1661 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
1662 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
1663 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
1664 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
1665
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1666 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
1667 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1668 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1669
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1670 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1671 * 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
1672 */
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
1673 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
1674 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
1675 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1676 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
1677
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1678 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
1679 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
1680 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
1681 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
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 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
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 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1686
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
1687 #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
1688 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1689 * 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
1690 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1691 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
1692 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
1693 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1694 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
1695 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
1696 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1697 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1698
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1699 #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
1700 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1701 * 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
1702 */
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
1703 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
1704 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
1705 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1706 char_u **varp = (char_u **)args->os_varp;
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1707 char *errmsg;
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1708
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1709 errmsg = did_set_option_listflag(*varp, (char_u *)GO_ALL, args->os_errbuf);
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1710 if (errmsg != NULL)
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1711 return errmsg;
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1712
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
1713 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
1714 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
1715 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1716 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1717
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1718 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
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
1719 /*
ca6bc7c04163 patch 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 * 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
1721 */
ca6bc7c04163 patch 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 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
1723 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
1724 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1725 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
1726 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
1727 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1728 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1729
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1730 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1731 * The 'helpfile' 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
1732 */
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
1733 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1734 did_set_helpfile(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1735 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1736 // May compute new values for $VIM and $VIMRUNTIME
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1737 if (didset_vim)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1738 vim_unsetenv_ext((char_u *)"VIM");
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1739 if (didset_vimruntime)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1740 vim_unsetenv_ext((char_u *)"VIMRUNTIME");
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1741 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1742 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1743
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1744 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1745 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1746 * The 'helplang' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1747 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1748 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1749 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
1750 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1751 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
1752
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1753 // Check for "", "ab", "ab,cd", etc.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1754 for (char_u *s = p_hlg; *s != NUL; s += 3)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1755 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1756 if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1757 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1758 errmsg = e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1759 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1760 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1761 if (s[2] == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1762 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1763 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1764
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1765 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
1766 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1767 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1768
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1769 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1770 * The 'highlight' 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
1771 */
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
1772 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1773 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
1774 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1775 if (highlight_changed() == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1776 return e_invalid_argument; // invalid flags
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1777
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1778 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1779 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1780
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1781 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1782 * The 'titlestring' or the 'iconstring' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1783 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1784 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1785 parse_titleiconstring(optset_T *args UNUSED, int flagval UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1786 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1787 #ifdef FEAT_STL_OPT
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1788 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1789
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1790 // NULL => statusline syntax
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1791 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1792 stl_syntax |= flagval;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1793 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1794 stl_syntax &= ~flagval;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1795 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1796 did_set_title();
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1797
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1798 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
1799 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1800
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1801 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1802 * The 'iconstring' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1803 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1804 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1805 did_set_iconstring(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1806 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1807 int flagval = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1808
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1809 #ifdef FEAT_STL_OPT
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1810 flagval = STL_IN_ICON;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1811 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1812
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1813 return parse_titleiconstring(args, flagval);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1814 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1815
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1816 #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1817 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1818 * The 'imactivatekey' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1819 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1820 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1821 did_set_imactivatekey(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1822 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1823 if (!im_xim_isvalid_imactivate())
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1824 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1825 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1826 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1827 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1828
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1829 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1830 * The 'isident' or the 'iskeyword' or the 'isprint' or the 'isfname' option is
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1831 * 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
1832 */
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
1833 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1834 did_set_isopt(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
1835 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1836 // 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[]
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1837 // If the new option is invalid, use old value.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1838 // 'lisp' option: refill g_chartab[] for '-' char.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1839 if (init_chartab() == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1840 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1841 args->os_restore_chartab = TRUE;// need to restore the chartab.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1842 return e_invalid_argument; // error in value
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1843 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1844
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1845 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
1846 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1847
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1848 #if defined(FEAT_KEYMAP) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1849 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1850 * The 'keymap' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1851 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1852 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1853 did_set_keymap(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1854 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1855 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1856 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1857
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1858 if (!valid_filetype(*varp))
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1859 errmsg = e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1860 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1861 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1862 int secure_save = secure;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1863
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1864 // Reset the secure flag, since the value of 'keymap' has
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1865 // been checked to be safe.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1866 secure = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1867
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1868 // load or unload key mapping tables
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1869 errmsg = keymap_init();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1870
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1871 secure = secure_save;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1872
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1873 // Since we check the value, there is no need to set P_INSECURE,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1874 // even when the value comes from a modeline.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1875 args->os_value_checked = TRUE;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1876 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1877
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1878 if (errmsg == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1879 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1880 if (*curbuf->b_p_keymap != NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1881 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1882 // Installed a new keymap, switch on using it.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1883 curbuf->b_p_iminsert = B_IMODE_LMAP;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1884 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1885 curbuf->b_p_imsearch = B_IMODE_LMAP;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1886 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1887 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1888 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1889 // Cleared the keymap, may reset 'iminsert' and 'imsearch'.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1890 if (curbuf->b_p_iminsert == B_IMODE_LMAP)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1891 curbuf->b_p_iminsert = B_IMODE_NONE;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1892 if (curbuf->b_p_imsearch == B_IMODE_LMAP)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1893 curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1894 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1895 if ((args->os_flags & OPT_LOCAL) == 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1896 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1897 set_iminsert_global();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1898 set_imsearch_global();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1899 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1900 status_redraw_curbuf();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1901 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1902
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1903 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1904 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1905 #endif
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 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1908 * 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
1909 */
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
1910 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
1911 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
1912 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1913 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
1914 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
1915
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1916 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
1917 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
1918 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
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
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 * 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
1923 */
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
1924 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
1925 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
1926 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1927 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
1928 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
1929
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 NULL;
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1933 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1934 * The 'lispoptions' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1935 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1936 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1937 did_set_lispoptions(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1938 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1939 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1940
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1941 if (**varp != NUL
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1942 && STRCMP(*varp, "expr:0") != 0
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1943 && STRCMP(*varp, "expr:1") != 0)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1944 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1945
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1946 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1947 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1948
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1949 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1950 * The 'matchpairs' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1951 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1952 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1953 did_set_matchpairs(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1954 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1955 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1956 char_u *p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1957
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1958 if (has_mbyte)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1959 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1960 for (p = *varp; *p != NUL; ++p)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1961 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1962 int x2 = -1;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1963 int x3 = -1;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1964
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1965 p += mb_ptr2len(p);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1966 if (*p != NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1967 x2 = *p++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1968 if (*p != NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1969 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1970 x3 = mb_ptr2char(p);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1971 p += mb_ptr2len(p);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1972 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1973 if (x2 != ':' || x3 == -1 || (*p != NUL && *p != ','))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1974 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1975 if (*p == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1976 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1977 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1978 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1979 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1980 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1981 // Check for "x:y,x:y"
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1982 for (p = *varp; *p != NUL; p += 4)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1983 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1984 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1985 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1986 if (p[3] == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1987 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1988 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1989 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1990
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1991 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1992 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1993
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1994 #if defined(FEAT_SPELL) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1995 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1996 * The 'mkspellmem' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1997 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1998 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1999 did_set_mkspellmem(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2000 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2001 if (spell_check_msm() != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2002 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2003
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2004 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2005 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2006 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2007
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2008 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2009 * The 'mouse' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2010 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2011 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2012 did_set_mouse(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2013 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2014 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2015
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2016 return did_set_option_listflag(*varp, (char_u *)MOUSE_ALL,
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2017 args->os_errbuf);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2018 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2019
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2020 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2021 * 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
2022 */
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
2023 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
2024 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
2025 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2026 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
2027 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
2028 #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
2029 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
2030 // 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
2031 // 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
2032 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
2033 #endif
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 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
2036 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2037
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2038 #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2039 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2040 did_set_mouseshape(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2041 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2042 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2043
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2044 errmsg = parse_shape_opt(SHAPE_MOUSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2045 update_mouseshape(-1);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2046
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2047 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2048 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2049 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2050
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2051 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2052 * The 'nrformats' option is changed.
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2053 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2054 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2055 did_set_nrformats(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2056 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2057 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2058
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2059 return did_set_opt_strings(*varp, p_nf_values, TRUE);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2060 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2061
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2062 #if defined(FEAT_EVAL) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2063 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2064 * One of the '*expr' options is changed: 'balloonexpr', 'diffexpr',
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2065 * 'foldexpr', 'foldtext', 'formatexpr', 'includeexpr', 'indentexpr',
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2066 * 'patchexpr', 'printexpr' and 'charconvert'.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2067 *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2068 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2069 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2070 did_set_optexpr(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2071 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2072 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2073
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2074 // If the option value starts with <SID> or s:, then replace that with
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2075 // the script identifier.
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2076 char_u *name = get_scriptlocal_funcname(*varp);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2077 if (name != NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2078 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2079 free_string_option(*varp);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2080 *varp = name;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2081 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2082
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2083 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2084 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2085 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2086
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2087 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2088 * The 'pastetoggle' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2089 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2090 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2091 did_set_pastetoggle(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2092 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2093 char_u *p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2094
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2095 // translate key codes like in a mapping
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2096 if (*p_pt)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2097 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2098 (void)replace_termcodes(p_pt, &p,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2099 REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2100 if (p != NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2101 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2102 free_string_option(p_pt);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2103 p_pt = p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2104 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2105 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2106
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2107 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2108 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2109
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2110 #if defined(FEAT_PROP_POPUP) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2111 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2112 * The 'previewpopup' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2113 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2114 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2115 did_set_previewpopup(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2116 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2117 if (parse_previewpopup(NULL) == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2118 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2119
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2120 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2121 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2122 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2123
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2124 #if defined(FEAT_POSTSCRIPT) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2125 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2126 * The 'printencoding' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2127 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2128 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2129 did_set_printencoding(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2130 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2131 char_u *s, *p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2132
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2133 // Canonize 'printencoding' if VIM standard one
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2134 p = enc_canonize(p_penc);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2135 if (p != NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2136 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2137 vim_free(p_penc);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2138 p_penc = p;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2139 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2140 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2141 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2142 // Ensure lower case and '-' for '_'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2143 for (s = p_penc; *s != NUL; s++)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2144 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2145 if (*s == '_')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2146 *s = '-';
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2147 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2148 *s = TOLOWER_ASC(*s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2149 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2150 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2151
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2152 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2153 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2154 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2155
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2156 #if defined(FEAT_STL_OPT) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2157 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2158 * The 'statusline' or the 'tabline' or the 'rulerformat' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2159 * "rulerformat" is TRUE if the 'rulerformat' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2160 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2161 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2162 parse_statustabline_rulerformat(optset_T *args, int rulerformat)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2163 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2164 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2165 char_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2166 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2167 int wid;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2168
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2169 if (rulerformat) // reset ru_wid first
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2170 ru_wid = 0;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2171 s = *varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2172 if (rulerformat && *s == '%')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2173 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2174 // set ru_wid if 'ruf' starts with "%99("
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2175 if (*++s == '-') // ignore a '-'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2176 s++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2177 wid = getdigits(&s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2178 if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2179 ru_wid = wid;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2180 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2181 errmsg = check_stl_option(p_ruf);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2182 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2183 // check 'statusline' or 'tabline' only if it doesn't start with "%!"
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2184 else if (rulerformat || s[0] != '%' || s[1] != '!')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2185 errmsg = check_stl_option(s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2186 if (rulerformat && errmsg == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2187 comp_col();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2188
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2189 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2190 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2191 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2192
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2193 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2194 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2195 * The 'renderoptions' 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
2196 */
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
2197 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2198 did_set_renderoptions(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2199 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2200 if (!gui_mch_set_rendering_options(p_rop))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2201 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2202
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2203 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2204 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2205 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2206
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2207 #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2208 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2209 * The 'rightleftcmd' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2210 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2211 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2212 did_set_rightleftcmd(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
2213 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2214 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2215
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2216 // Currently only "search" is a supported value.
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2217 if (**varp != NUL && STRCMP(*varp, "search") != 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
2218 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
2219
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2220 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2221 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2222 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2223
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2224 #if defined(FEAT_STL_OPT) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2225 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2226 * The 'rulerformat' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2227 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2228 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2229 did_set_rulerformat(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2230 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2231 return parse_statustabline_rulerformat(args, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2232 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2233 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2234
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2235 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2236 * The 'scrollopt' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2237 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2238 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2239 did_set_scrollopt(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2240 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2241 return did_set_opt_strings(p_sbo, p_scbopt_values, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2242 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2243
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2244 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2245 * The 'selection' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2246 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2247 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2248 did_set_selection(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2249 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2250 if (*p_sel == NUL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2251 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2252 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2253
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2254 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
2255 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2256
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2257 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2258 * The 'selectmode' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2259 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2260 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2261 did_set_selectmode(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2262 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2263 return did_set_opt_strings(p_slm, p_slm_values, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2264 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2265
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2266 #if defined(FEAT_SESSION) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2267 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2268 * The 'sessionoptions' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2269 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2270 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2271 did_set_sessionoptions(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2272 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2273 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2274 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2275 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2276 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2277 // Don't allow both "sesdir" and "curdir".
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2278 (void)opt_strings_flags(args->os_oldval.string, p_ssop_values,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2279 &ssop_flags, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2280 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2281 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2282
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2283 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2284 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2285 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2286
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2287 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2288 * The 'shortmess' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2289 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2290 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2291 did_set_shortmess(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2292 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2293 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2294
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2295 return did_set_option_listflag(*varp, (char_u *)SHM_ALL, args->os_errbuf);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2296 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2297
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2298 #if defined(FEAT_LINEBREAK) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2299 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2300 * The 'showbreak' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2301 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2302 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2303 did_set_showbreak(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2304 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2305 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2306 char_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2307
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2308 for (s = *varp; *s; )
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2309 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2310 if (ptr2cells(s) != 1)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2311 return e_showbreak_contains_unprintable_or_wide_character;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2312 MB_PTR_ADV(s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2313 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2314
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2315 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2316 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2317 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2318
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2319 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2320 * The 'showcmdloc' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2321 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2322 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2323 did_set_showcmdloc(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2324 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2325 return did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2326 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2327
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2328 #if defined(FEAT_SIGNS) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2329 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2330 * The 'signcolumn' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2331 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2332 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2333 did_set_signcolumn(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2334 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2335 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2336
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2337 if (check_opt_strings(*varp, p_scl_values, FALSE) != OK)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2338 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2339 // When changing the 'signcolumn' to or from 'number', recompute the
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2340 // width of the number column if 'number' or 'relativenumber' is set.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2341 if (((*args->os_oldval.string == 'n' && args->os_oldval.string[1] == 'u')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2342 || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u'))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2343 && (curwin->w_p_nu || curwin->w_p_rnu))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2344 curwin->w_nrwidth_line_count = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2345
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2346 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2347 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2348 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2349
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
2350 #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
2351 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2352 * The 'spellcapcheck' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2353 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2354 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2355 did_set_spellcapcheck(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2356 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2357 // compile the regexp program.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2358 return compile_cap_prog(curwin->w_s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2359 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2360
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2361 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2362 * 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
2363 */
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
2364 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
2365 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
2366 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2367 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2368
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2369 if (!valid_spellfile(*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
2370 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
2371
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2372 // 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
2373 // wordlists.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2374 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
2375 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2376
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2377 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2378 * 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
2379 */
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
2380 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
2381 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
2382 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2383 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2384
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2385 if (!valid_spelllang(*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
2386 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
2387
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2388 // 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
2389 // wordlists.
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 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
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2393 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2394 * 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
2395 */
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
2396 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
2397 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
2398 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2399 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2400
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2401 if (**varp != NUL && STRCMP("camel", *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
2402 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
2403
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2404 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
2405 }
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 '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
2409 */
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
2410 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
2411 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
2412 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2413 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
2414 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
2415
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2416 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
2417 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2418 #endif
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2421 * The 'splitkeep' 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
2422 */
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
2423 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2424 did_set_splitkeep(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
2425 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2426 return did_set_opt_strings(p_spk, p_spk_values, FALSE);
31859
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
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2429 #if defined(FEAT_STL_OPT) || 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 /*
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
2431 * 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
2432 */
ca6bc7c04163 patch 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_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
2435 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2436 return parse_statustabline_rulerformat(args, FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2437 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2438 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2439
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2440 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2441 * The 'swapsync' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2442 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2443 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2444 did_set_swapsync(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2445 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2446 return did_set_opt_strings(p_sws, p_sws_values, 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
2447 }
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2448
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2449 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2450 * The 'switchbuf' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2451 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2452 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2453 did_set_switchbuf(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2454 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2455 return did_set_opt_flags(p_swb, p_swb_values, &swb_flags, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2456 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2457
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2458 #if defined(FEAT_STL_OPT) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2459 /*
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
2460 * 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
2461 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2462 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
2463 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
2464 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2465 return parse_statustabline_rulerformat(args, 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
2466 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2467 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2468
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2469 /*
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 * 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
2471 */
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
2472 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
2473 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
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 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
2476 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
2477
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
2478 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
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 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
2481 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
2482 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2483 else
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 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
2486 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
2487 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2488
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
2489 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
2490 // 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
2491 *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
2492 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
2493 || 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
2494 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
2495
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2496 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
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2499 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2500 * The 'term' 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
2501 */
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2502 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2503 did_set_term(int *opt_idx, long_u *free_oldval)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2504 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2505 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2506
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2507 if (T_NAME[0] == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2508 errmsg = e_cannot_set_term_to_empty_string;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2509 #ifdef FEAT_GUI
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2510 else if (gui.in_use)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2511 errmsg = e_cannot_change_term_in_GUI;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2512 else if (term_is_gui(T_NAME))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2513 errmsg = e_use_gui_to_start_GUI;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2514 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2515 else if (set_termname(T_NAME) == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2516 errmsg = e_not_found_in_termcap;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2517 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2518 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2519 // Screen colors may have changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2520 redraw_later_clear();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2521
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2522 // Both 'term' and 'ttytype' point to T_NAME, only set the
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2523 // P_ALLOCED flag on 'term'.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2524 *opt_idx = findoption((char_u *)"term");
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2525 if (*opt_idx >= 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2526 *free_oldval = (get_option_flags(*opt_idx) & P_ALLOCED);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2527 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2528
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2529 return errmsg;
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2530 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2531
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2532 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2533 * Some terminal option (t_xxx) is changed
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2534 */
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2535 char *
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2536 did_set_term_option(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
2537 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2538 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2539
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2540 if (!full_screen)
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2541 return NULL;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2542
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2543 // ":set t_Co=0" and ":set t_Co=1" do ":set t_Co="
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2544 if (varp == &T_CCO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2545 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2546 int colors = atoi((char *)T_CCO);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2547
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2548 // Only reinitialize colors if t_Co value has really changed to
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2549 // avoid expensive reload of colorscheme if t_Co is set to the
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2550 // same value multiple times.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2551 if (colors != t_colors)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2552 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2553 t_colors = colors;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2554 if (t_colors <= 1)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2555 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2556 vim_free(T_CCO);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2557 T_CCO = empty_option;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2558 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2559 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2560 if (is_term_win32())
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2561 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2562 swap_tcap();
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2563 args->os_did_swaptcap = TRUE;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2564 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2565 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2566 // We now have a different color setup, initialize it again.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2567 init_highlight(TRUE, FALSE);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2568 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2569 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2570 ttest(FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2571 if (varp == &T_ME)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2572 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2573 out_str(T_ME);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2574 redraw_later(UPD_CLEAR);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2575 #if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2576 // Since t_me has been set, this probably means that the user
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2577 // wants to use this as default colors. Need to reset default
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2578 // background/foreground colors.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2579 # ifdef VIMDLL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2580 if (!gui.in_use && !gui.starting)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2581 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2582 mch_set_normal_colors();
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2583 #endif
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2584 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2585 if (varp == &T_BE && termcap_active)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2586 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2587 MAY_WANT_TO_LOG_THIS;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2588
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2589 if (*T_BE == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2590 // When clearing t_BE we assume the user no longer wants
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2591 // bracketed paste, thus disable it by writing t_BD.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2592 out_str(T_BD);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2593 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2594 out_str(T_BE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2595 }
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2596
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2597 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
2598 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2599
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
2600 #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
2601 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2602 * 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
2603 */
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
2604 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
2605 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
2606 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2607 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
2608 && 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
2609 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
2610
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2611 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
2612 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2613
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2614 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2615 * 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
2616 */
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
2617 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
2618 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
2619 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2620 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
2621
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2622 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
2623 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
2624
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2625 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
2626 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
2627 || (*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
2628 || *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
2629 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
2630
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2631 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
2632 }
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2633
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2634 # if defined(MSWIN) || defined(PROTO)
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2635 /*
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2636 * The 'termwintype' option is changed.
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2637 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2638 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2639 did_set_termwintype(optset_T *args UNUSED)
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2640 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2641 return did_set_opt_strings(p_twt, p_twt_values, FALSE);
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2642 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2643 # endif
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2644 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2645
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2646 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2647 * The 'titlestring' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2648 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2649 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2650 did_set_titlestring(optset_T *args)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2651 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2652 int flagval = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2653
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2654 #ifdef FEAT_STL_OPT
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2655 flagval = STL_IN_TITLE;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2656 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2657 return parse_titleiconstring(args, flagval);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2658 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2659
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2660 #if (defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2661 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2662 * The 'toolbar' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2663 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2664 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2665 did_set_toolbar(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2666 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2667 if (opt_strings_flags(p_toolbar, p_toolbar_values,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2668 &toolbar_flags, TRUE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2669 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2670
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2671 out_flush();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2672 gui_mch_show_toolbar((toolbar_flags &
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2673 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2674 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2675 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2676 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2677
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2678 #if (defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2679 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2680 * The 'toolbariconsize' option is changed. GTK+ 2 only.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2681 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2682 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2683 did_set_toolbariconsize(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2684 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2685 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2686 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2687
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2688 out_flush();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2689 gui_mch_show_toolbar((toolbar_flags &
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2690 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2691 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2692 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2693 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2694
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2695 #if defined(UNIX) || defined(VMS) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2696 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2697 * The 'ttymouse' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2698 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2699 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2700 did_set_ttymouse(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2701 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2702 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2703
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2704 // Switch the mouse off before changing the escape sequences used for
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2705 // that.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2706 mch_setmouse(FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2707 if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2708 errmsg = e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2709 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2710 check_mouse_termcode();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2711 if (termcap_active)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2712 setmouse(); // may switch it on again
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2713
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2714 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2715 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2716 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2717
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
2718 #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
2719 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2720 * 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
2721 */
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
2722 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
2723 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
2724 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2725 char_u **varp = (char_u **)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
2726 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
2727
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2728 if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*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
2729 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2730 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
2731 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2732 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
2733 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
2734 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2735 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2736 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2737 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2738 for (cp = *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
2739 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2740 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
2741 continue;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2742 if (*cp == ',' && cp > *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
2743 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2744 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
2745 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2746
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2747 int *oldarray = curbuf->b_p_vsts_array;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2748 if (tabstop_set(*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
2749 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2750 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
2751 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
2752 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2753 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2754 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
2755 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2756
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2757 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
2758 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2759
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2760 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2761 * 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
2762 */
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
2763 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
2764 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
2765 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2766 char_u **varp = (char_u **)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
2767 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
2768
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2769 if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*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
2770 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2771 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
2772 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2773 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
2774 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
2775 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2776 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2777 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2778 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2779 for (cp = *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
2780 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2781 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
2782 continue;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2783 if (*cp == ',' && cp > *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
2784 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2785 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
2786 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2787
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2788 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
2789
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2790 if (tabstop_set(*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
2791 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2792 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
2793 # 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
2794 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
2795 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
2796 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2797 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2798 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2799 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
2800 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2801
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2802 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
2803 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2804 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2805
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2806 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2807 * The 'verbosefile' 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
2808 */
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
2809 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2810 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
2811 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2812 verbose_stop();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2813 if (*p_vfile != NUL && verbose_open() == FAIL)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2814 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
2815
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2816 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
2817 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2818
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2819 #if defined(FEAT_SESSION) || 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
2820 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2821 * The 'viewoptions' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2822 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2823 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2824 did_set_viewoptions(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2825 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2826 return did_set_opt_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2827 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2828 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2829
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2830 #if defined(FEAT_VIMINFO) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2831 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2832 * The 'viminfo' 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
2833 */
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
2834 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2835 did_set_viminfo(optset_T *args)
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2836 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2837 char_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2838 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2839
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2840 for (s = p_viminfo; *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
2841 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2842 // Check it's a valid character
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2843 if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2844 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2845 errmsg = illegal_char(args->os_errbuf, *s);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2846 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2847 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2848 if (*s == 'n') // name is always last one
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2849 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2850 else if (*s == 'r') // skip until next ','
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2851 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2852 while (*++s && *s != ',')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2853 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2854 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2855 else if (*s == '%')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2856 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2857 // optional number
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2858 while (vim_isdigit(*++s))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2859 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2860 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2861 else if (*s == '!' || *s == 'h' || *s == 'c')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2862 ++s; // no extra chars
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2863 else // must have a number
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2864 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2865 while (vim_isdigit(*++s))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2866 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2867
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2868 if (!VIM_ISDIGIT(*(s - 1)))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2869 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2870 if (args->os_errbuf != NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2871 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2872 sprintf(args->os_errbuf,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2873 _(e_missing_number_after_angle_str_angle),
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2874 transchar_byte(*(s - 1)));
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2875 errmsg = args->os_errbuf;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2876 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2877 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2878 errmsg = "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2879 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2880 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2881 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2882 if (*s == ',')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2883 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2884 else if (*s)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2885 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2886 if (args->os_errbuf != NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2887 errmsg = e_missing_comma;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2888 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2889 errmsg = "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2890 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2891 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2892 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2893 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2894 errmsg = e_must_specify_a_value;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2895
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2896 return errmsg;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2897 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2898 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2899
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2900 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2901 * The 'virtualedit' option is changed.
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2902 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2903 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2904 did_set_virtualedit(optset_T *args)
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2905 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2906 char_u *ve = p_ve;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2907 unsigned int *flags = &ve_flags;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2908
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2909 if (args->os_flags & OPT_LOCAL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2910 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2911 ve = curwin->w_p_ve;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2912 flags = &curwin->w_ve_flags;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2913 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2914
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2915 if ((args->os_flags & OPT_LOCAL) && *ve == NUL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2916 // make the local value empty: use the global value
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2917 *flags = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2918 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2919 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2920 if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2921 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2922 else if (STRCMP(ve, args->os_oldval.string) != 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2923 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2924 // Recompute cursor position in case the new 've' setting
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2925 // changes something.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2926 validate_virtcol();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2927 coladvance(curwin->w_virtcol);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2928 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2929 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2930
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2931 return NULL;
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2932 }
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2933
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2934 /*
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2935 * The 'whichwrap' option is changed.
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2936 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2937 char *
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2938 did_set_whichwrap(optset_T *args)
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2939 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2940 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2941
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2942 return did_set_option_listflag(*varp, (char_u *)WW_ALL, args->os_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
2943 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2944
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2945 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2946 * The 'wildmode' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2947 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2948 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2949 did_set_wildmode(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2950 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2951 if (check_opt_wim() == FAIL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2952 return e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2953 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2954 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2955
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2956 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2957 * The 'wildoptions' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2958 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2959 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2960 did_set_wildoptions(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2961 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2962 return did_set_opt_strings(p_wop, p_wop_values, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2963 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2964
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2965 #if defined(FEAT_WAK) || defined(PROTO)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2966 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2967 * The 'winaltkeys' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2968 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2969 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2970 did_set_winaltkeys(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2971 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2972 char *errmsg = NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2973
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2974 if (*p_wak == NUL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2975 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2976 errmsg = e_invalid_argument;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2977 # ifdef FEAT_MENU
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2978 # if defined(FEAT_GUI_MOTIF)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2979 else if (gui.in_use)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2980 gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2981 # elif defined(FEAT_GUI_GTK)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2982 else if (gui.in_use)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2983 gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2984 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2985 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2986 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2987 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2988 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2989
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2990 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2991 * The 'wincolor' option is changed.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2992 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2993 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2994 did_set_wincolor(optset_T *args UNUSED)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2995 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2996 #ifdef FEAT_TERMINAL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2997 term_update_wincolor(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2998 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2999 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
3000 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
3001
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3002 #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
3003 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3004 * 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
3005 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3006 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
3007 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
3008 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3009 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
3010
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3011 ++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
3012 // 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
3013 // 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
3014 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
3015 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
3016 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
3017 --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
3018 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3019 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3020
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3021 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3022 * 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
3023 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3024 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
3025 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
3026 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3027 // 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
3028 // 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
3029 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
3030 return;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3031
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3032 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
3033 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
3034
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3035 // 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
3036 // 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
3037 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
3038
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3039 ++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
3040 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
3041 // 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
3042 // 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
3043 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
3044 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
3045 --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
3046 // 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
3047 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
3048 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
3049
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3050 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
3051 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3052
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3053 #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
3054 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3055 * 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
3056 * 'runtimepath'.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3057 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3058 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
3059 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
3060 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3061 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
3062 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
3063 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
3064
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3065 // 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
3066 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
3067 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
3068
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3069 // 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
3070 // 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
3071 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
3072 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
3073 break;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3074 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
3075 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3076 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
3077 (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
3078 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
3079 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3080 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3081 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3082
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3083 /*
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3084 * 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
3085 * 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
3086 * 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
3087 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3088 char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3089 did_set_string_option(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3090 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
3091 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
3092 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
3093 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
3094 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
3095 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
3096 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
3097 // 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
3098 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3099 char *errmsg = NULL;
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3100 int restore_chartab = FALSE;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3101 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
3102 int value_changed = FALSE;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3103 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3104 int did_swaptcap = FALSE;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3105 #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
3106 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
3107
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3108 // 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
3109 if ((secure
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3110 #ifdef HAVE_SANDBOX
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3111 || sandbox != 0
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3112 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3113 ) && (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
3114 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
3115 // 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
3116 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
3117 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
3118 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
3119 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3120 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
3121
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3122 CLEAR_FIELD(args);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3123 args.os_varp = (char_u *)varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3124 args.os_idx = opt_idx;
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
3125 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
3126 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
3127 args.os_newval.string = value;
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
3128 args.os_errbuf = errbuf;
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3129 // Invoke the option specific callback function to validate and apply
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3130 // the new option 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
3131 errmsg = did_set_cb(&args);
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3132
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3133 // The 'filetype' and 'syntax' option callback functions may change
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3134 // the os_value_changed field.
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3135 value_changed = args.os_value_changed;
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3136 // The 'keymap', 'filetype' and 'syntax' option callback functions
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3137 // may change the os_value_checked field.
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3138 *value_checked = args.os_value_checked;
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3139 // The 'isident', 'iskeyword', 'isprint' and 'isfname' options may
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3140 // change the character table. On failure, this needs to be restored.
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3141 restore_chartab = args.os_restore_chartab;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3142 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3143 // The 't_xxx' terminal options may swap the termcap entries.
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3144 did_swaptcap = args.os_did_swaptcap;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3145 #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
3146 }
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3147 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
3148 errmsg = did_set_term(&opt_idx, &free_oldval);
26268
3aa48d4e3dc8 patch 8.2.3665: cannot use a lambda for 'tagfunc'
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
3149
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3150 // 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
3151 if (errmsg != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3152 {
29509
d61007cc39b3 patch 9.0.0096: flag "new_value_alloced" is always true
Bram Moolenaar <Bram@vim.org>
parents: 29395
diff changeset
3153 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
3154 *varp = oldval;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3155 // When resetting some values, need to act on it.
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3156 if (restore_chartab)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3157 (void)init_chartab();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3158 if (varp == &p_hl)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3159 (void)highlight_changed();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3160 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3161 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3162 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3163 #ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3164 // 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
3165 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
3166 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3167 // 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
3168 // 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
3169 // 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
3170 if (free_oldval)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3171 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
3172 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
3173
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3174 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
3175 && 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
3176 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3177 // 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
3178 // 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
3179 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
3180 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
3181 *(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
3182 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3183
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3184 // 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
3185 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
3186 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
3187
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3188 // 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
3189 #ifdef FEAT_SYN_HL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3190 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
3191 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
3192 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3193 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
3194 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
3195 #ifdef FEAT_SPELL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3196 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
3197 do_spelllang_source();
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3198 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3199 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3200
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3201 if (varp == &p_mouse)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3202 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3203 if (*p_mouse == NUL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3204 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
3205 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3206 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
3207 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3208
20609
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3209 #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
3210 if (varp == &p_rtp)
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3211 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
3212 #endif
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3213
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
3214 #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
3215 // 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
3216 // 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
3217 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
3218 && 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
3219 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
3220 #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
3221
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3222 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
3223 && (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
3224 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
3225
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3226 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
3227 {
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3228 #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
3229 // 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
3230 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
3231
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3232 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
3233 || 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
3234 # 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
3235 || 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
3236 || 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
3237 # 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
3238 # 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
3239 || 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
3240 # 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
3241 || 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
3242 # 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
3243 || 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
3244 # 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
3245 )
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3246 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
3247
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3248 // 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
3249 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
3250 #endif
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3251 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
3252 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3253
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3254 #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
3255 if (did_swaptcap)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3256 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3257 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
3258 init_highlight(TRUE, FALSE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3259 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3260 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3261
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3262 return errmsg;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3263 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3264
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3265 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3266 * 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
3267 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3268 * 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
3269 * Empty is always OK.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3270 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3271 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3272 check_opt_strings(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3273 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3274 char **values,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3275 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
3276 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3277 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
3278 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3279
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3280 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3281 * 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
3282 * 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
3283 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3284 * 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
3285 * Empty is always OK.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3286 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3287 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3288 opt_strings_flags(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3289 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
3290 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
3291 unsigned *flagp,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3292 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
3293 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3294 int i;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3295 int len;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3296 unsigned new_flags = 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3297
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3298 while (*val)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3299 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3300 for (i = 0; ; ++i)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3301 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3302 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
3303 return FAIL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3304
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3305 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
3306 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
3307 && ((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
3308 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3309 val += len + (val[len] == ',');
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3310 new_flags |= (1 << i);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3311 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
3312 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3313 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3314 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3315 if (flagp != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3316 *flagp = new_flags;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3317
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3318 return OK;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3319 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3320
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3321 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3322 * 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
3323 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3324 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3325 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
3326 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3327 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
3328 }
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3329
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3330 /*
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
3331 * 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
3332 * 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
3333 *
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3334 * 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
3335 * 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
3336 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3337 void
32009
4545f58c8490 patch 9.0.1336: functions without arguments are not always declared properly
Bram Moolenaar <Bram@vim.org>
parents: 31996
diff changeset
3338 save_clear_shm_value(void)
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3339 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3340 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
3341 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3342 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
3343 return;
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3344 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3345
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3346 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
3347 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3348 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
3349 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
3350 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3351 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3352
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3353 /*
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3354 * 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
3355 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3356 void
32009
4545f58c8490 patch 9.0.1336: functions without arguments are not always declared properly
Bram Moolenaar <Bram@vim.org>
parents: 31996
diff changeset
3357 restore_shm_value(void)
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3358 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3359 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
3360 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3361 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
3362 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
3363 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3364 }