annotate src/optionstr.c @ 32076:32acf287a9ae v9.0.1369

patch 9.0.1369: still some "else if" constructs for setting options Commit: https://github.com/vim/vim/commit/c6ff21e876af0e3ad59664dd0f69359c4b6e9f1d Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Mar 2 14:46:48 2023 +0000 patch 9.0.1369: still some "else if" constructs for setting options Problem: Still some "else if" constructs for setting options. Solution: Add a few more functions for handling options. (Yegappan Lakshmanan, closes #12090)
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Mar 2023 16:00:05 +0100
parents ef85a4440947
children 45142117e206
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 *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
686 did_set_option_listflag(char_u *varp, char_u *flags, char *errbuf)
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
690 for (s = varp; *s; ++s)
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 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
949 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
950
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
951 if ( args->os_varp == p_lcs // global 'listchars'
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
952 || args->os_varp == p_fcs) // global 'fillchars'
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
953 errmsg = did_set_global_listfillchars(args->os_varp,
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
954 args->os_varp == p_lcs,
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
955 args->os_flags);
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
956 else if (args->os_varp == curwin->w_p_lcs) // local 'listchars'
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
957 errmsg = set_listchars_option(curwin, args->os_varp, TRUE);
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
958 else if (args->os_varp == curwin->w_p_fcs) // local 'fillchars'
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
959 errmsg = set_fillchars_option(curwin, args->os_varp, TRUE);
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 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
993 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
994 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
995
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
996 for (s = args->os_varp; *s; )
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
997 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
998 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
999 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1000 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
1001 && !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
1002 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1003 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
1004 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1005 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1006 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1007 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1008 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
1009 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
1010 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
1011 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
1012 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
1013 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1014 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
1015 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1016 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
1017 ++s;
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 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1020 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
1021 }
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 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1024 }
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 #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
1027 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1028 * 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
1029 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1030 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1031 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
1032 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1033 if (*args->os_varp != NUL && strstr((char *)args->os_varp, "%s") == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1034 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
1035
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1036 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1037 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1038 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1039
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 * 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
1042 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1043 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1044 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
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_u *s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1047
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1048 // check if it is a valid value for 'complete' -- Acevedo
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1049 for (s = args->os_varp; *s;)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1050 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1051 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
1052 s++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1053 if (!*s)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1054 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1055 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
1056 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
1057 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
1058 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1059 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
1060 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1061 // 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
1062 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
1063 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1064 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
1065 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1066 ++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 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1069 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1070 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1071 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
1072 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1073 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
1074 _(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
1075 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
1076 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1077 return "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1078 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1079 }
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1082 return NULL;
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 * 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
1087 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1088 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1089 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
1090 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1091 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
1092 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
1093
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1094 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
1095 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1096 }
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 #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
1099 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1100 * 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
1101 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1102 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1103 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
1104 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1105 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
1106 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
1107
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1108 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
1109 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1110 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1111 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1112
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1113 #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
1114 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1115 * 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
1116 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1117 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1118 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
1119 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1120 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
1121 || 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
1122 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
1123
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1124 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1125 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1126 #endif
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 #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
1129 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1130 * 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
1131 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1132 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1133 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
1134 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1135 return did_set_option_listflag(args->os_varp, (char_u *)COCU_ALL,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1136 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
1137 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1138 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1139
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1140 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1141 * 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
1142 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1143 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1144 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
1145 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1146 return did_set_option_listflag(args->os_varp, (char_u *)CPO_ALL,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1147 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
1148 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1149
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1150 #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
1151 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1152 * 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
1153 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1154 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1155 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
1156 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1157 // 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
1158 // history.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1159 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
1160
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1161 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
1162 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1163 // 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
1164 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
1165 *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
1166 changed_internal();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1167 }
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 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1170 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1171
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1172 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1173 * 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
1174 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1175 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1176 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
1177 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1178 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
1179 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
1180
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1181 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
1182 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
1183 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1184 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
1185 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
1186 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
1187 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
1188 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
1189
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1190 // 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
1191 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
1192 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1193 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
1194 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
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 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
1197 // 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
1198 // local value.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1199 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
1200 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1201 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
1202 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
1203 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1204
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1205 // 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
1206 // 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
1207 // 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
1208 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
1209 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
1210 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1211 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
1212 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
1213 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
1214 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1215 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
1216 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
1217 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
1218
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1219 // 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
1220 // 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
1221 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
1222 && 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
1223 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1224 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
1225
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1226 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
1227 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
1228 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
1229 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1230 return NULL;
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 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1233
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1234 #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
1235 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1236 * 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
1237 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1238 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1239 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
1240 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1241 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
1242
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1243 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
1244 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1245
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1246 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
1247 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
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 (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
1250 || 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
1251 || 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
1252 || (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
1253 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
1254 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
1255 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1256 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1257 p += 3;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1258 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1259
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1260 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1261 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1262 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1263
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1264 #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
1265 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1266 * 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
1267 */
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1268 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1269 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
1270 {
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1271 if (*args->os_varp == NUL
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1272 || fill_culopt_flags(args->os_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
1273 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
1274
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1275 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
1276 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1277 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1278
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1279 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1280 * 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
1281 */
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
1282 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1283 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
1284 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1285 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
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1288 #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
1289 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1290 * 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
1291 */
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
1292 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1293 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
1294 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1295 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
1296 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
1297
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1298 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1299 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1300 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1301
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1302 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1303 * 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
1304 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1305 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1306 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
1307 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1308 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
1309 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
1310
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1311 (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
1312 return NULL;
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1313 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1314
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1315 /*
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1316 * 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
1317 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1318 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1319 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
1320 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1321 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
1322 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1323
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1324 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1325 * 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
1326 * 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
1327 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1328 static char *
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1329 did_set_encoding(char_u **varp, char_u **gvarp, int opt_flags)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1330 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1331 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
1332 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
1333
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1334 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
1335 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1336 if (!curbuf->b_p_ma && opt_flags != OPT_GLOBAL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1337 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
1338 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
1339 // 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
1340 // 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
1341 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
1342 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1343 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1344 // 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
1345 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
1346 // 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
1347 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
1348 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1349 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1350 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
1351 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1352 // 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
1353 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
1354 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
1355 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1356 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
1357 *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
1358 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1359 if (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
1360 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1361 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
1362 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
1363 }
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1366 #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
1367 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
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 // 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
1370 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
1371 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
1372 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1373 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1374
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1375 if (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
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 #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
1378 // 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
1379 // (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
1380 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
1381 (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
1382 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1383
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1384 // 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
1385 // '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
1386 // 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
1387 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
1388 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1389 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
1390 || 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
1391 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1392 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
1393 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
1394 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
1395 }
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1398 #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
1399 // $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
1400 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
1401 {
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1402 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
1403 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
1404 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1405 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1406 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1407
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1408 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
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1412 * 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
1413 */
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
1414 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1415 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
1416 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1417 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
1418 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
1419 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
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
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 * 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
1424 */
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
1425 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
1426 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
1427 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1428 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
1429 return e_cannot_make_changes_modifiable_is_off;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1430 else if (check_opt_strings(args->os_varp, p_ff_values, FALSE) != OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1433 // 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
1434 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
1435 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
1436 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1437 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
1438 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
1439 // 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
1440 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
1441 // 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
1442 // 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
1443 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
1444 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
1445
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 NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1447 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1448
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1449 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1450 * 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
1451 */
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
1452 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
1453 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
1454 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1455 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
1456 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
1457
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1458 // 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
1459 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
1460 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
1461 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1462 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
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 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
1465 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1466
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1467 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1468 * 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
1469 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1470 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1471 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
1472 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1473 if (!valid_filetype(args->os_varp))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1474 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
1475
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1476 args->os_value_changed =
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1477 STRCMP(args->os_oldval.string, args->os_varp) != 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1478
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1479 // 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
1480 // 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
1481 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
1482
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1483 return NULL;
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1486 #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
1487 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1488 * 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
1489 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1490 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1491 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
1492 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1493 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
1494 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1495 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1496
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1497 #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
1498 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1499 * 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
1500 */
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
1501 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1502 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
1503 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1504 (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
1505 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
1506 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1507 return NULL;
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 #endif
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 #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
1512 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1513 * 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
1514 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1515 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1516 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
1517 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1518 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
1519 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1520 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1521 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1522
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1523 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1524 * 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
1525 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1526 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1527 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
1528 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1529 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
1530
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1531 p = vim_strchr(args->os_varp, ',');
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1532 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
1533 return e_comma_required;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1534 else if (p == args->os_varp || 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
1535 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
1536 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
1537 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
1538
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1539 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
1540 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1541
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1542 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1543 * 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
1544 */
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
1545 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1546 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
1547 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1548 if (check_opt_strings(args->os_varp, p_fdm_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
1549 || *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
1550 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
1551
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1552 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1553 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
1554 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
1555 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
1556 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1557
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1558 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1559 * 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
1560 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1561 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1562 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
1563 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1564 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
1565 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1566 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1567
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1568 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1569 * 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
1570 */
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
1571 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1572 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
1573 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1574 return did_set_option_listflag(args->os_varp, (char_u *)FO_ALL,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1575 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
1576 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1577
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1578 #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
1579 /*
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1580 * 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
1581 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1582 char *
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1583 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
1584 {
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1585 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
1586 }
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1587 #endif
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1588
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1589 #if defined(FEAT_GUI) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1590 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1591 * The 'guifont' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1592 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1593 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1594 did_set_guifont(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1595 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1596 char_u *p;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1597 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1598
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1599 if (gui.in_use)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1600 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1601 p = p_guifont;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1602 # if defined(FEAT_GUI_GTK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1603 // Put up a font dialog and let the user select a new value.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1604 // If this is cancelled go back to the old value but don't
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1605 // give an error message.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1606 if (STRCMP(p, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1607 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1608 p = gui_mch_font_dialog(args->os_oldval.string);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1609 free_string_option(p_guifont);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1610 p_guifont = (p != NULL) ? p : vim_strsave(args->os_oldval.string);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1611 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1612 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1613 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1614 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1615 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1616 if (STRCMP(p_guifont, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1617 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1618 // Dialog was cancelled: Keep the old value without giving
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1619 // an error message.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1620 free_string_option(p_guifont);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1621 p_guifont = vim_strsave(args->os_oldval.string);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1622 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1623 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1624 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1625 errmsg = e_invalid_fonts;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1626 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1627 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1628
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1629 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1630 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1631
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1632 # if defined(FEAT_XFONTSET) || defined(PROTO)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1633 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1634 * The 'guifontset' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1635 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1636 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1637 did_set_guifontset(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1638 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1639 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1640
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1641 if (STRCMP(p_guifontset, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1642 errmsg = e_cant_select_fontset;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1643 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1644 errmsg = e_invalid_fontset;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1645
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1646 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1647 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1648 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1649
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1650 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1651 * The 'guifontwide' option is changed.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1652 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1653 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1654 did_set_guifontwide(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1655 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1656 char *errmsg = NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1657
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1658 if (STRCMP(p_guifontwide, "*") == 0)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1659 errmsg = e_cant_select_wide_font;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1660 else if (gui_get_wide_font() == FAIL)
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1661 errmsg = e_invalid_wide_font;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1662
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1663 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1664 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1665 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1666
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1667 #if defined(FEAT_GUI_GTK) || defined(PROTO)
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1668 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1669 * The 'guiligatures' option is changed.
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1670 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1671 char *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1672 did_set_guiligatures(optset_T *args UNUSED)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1673 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1674 gui_set_ligatures();
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1675 return NULL;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1676 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1677 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1678
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1679 #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
1680 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1681 * 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
1682 */
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
1683 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
1684 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
1685 {
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1686 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
1687
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1688 errmsg = did_set_option_listflag(args->os_varp, (char_u *)GO_ALL,
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1689 args->os_errbuf);
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1690 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
1691 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
1692
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
1693 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
1694 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
1695 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1696 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1697
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1698 #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
1699 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1700 * 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
1701 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1702 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
1703 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
1704 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1705 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
1706 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
1707 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1708 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1709
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1710 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1711 * 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
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 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1714 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
1715 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1716 // 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
1717 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
1718 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
1719 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
1720 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
1721 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1722 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1723
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1724 #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
1725 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1726 * 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
1727 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1728 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1729 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
1730 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1731 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
1732
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1733 // 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
1734 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
1735 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1736 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
1737 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1738 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
1739 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1740 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1741 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
1742 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1743 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1744
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1745 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
1746 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1747 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1748
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1749 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1750 * 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
1751 */
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
1752 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1753 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
1754 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1755 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
1756 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
1757
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1758 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1759 }
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1762 * 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
1763 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1764 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1765 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
1766 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1767 #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
1768 // NULL => statusline syntax
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1769 if (vim_strchr(args->os_varp, '%')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1770 && check_stl_option(args->os_varp) == NULL)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1771 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
1772 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1773 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
1774 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1775 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
1776
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1777 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
1778 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1779
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1780 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1781 * 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
1782 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1783 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1784 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
1785 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1786 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
1787
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1788 #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
1789 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
1790 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1791
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1792 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
1793 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1794
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1795 #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
1796 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1797 * 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
1798 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1799 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1800 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
1801 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1802 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
1803 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
1804 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1805 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1806 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1807
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 * 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
1810 * 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
1811 */
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
1812 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1813 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
1814 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1815 // '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
1816 // 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
1817 // '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
1818 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
1819 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1820 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
1821 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
1822 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1823
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1824 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
1825 }
32070
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 #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
1828 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1829 * 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
1830 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1831 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1832 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
1833 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1834 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
1835
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1836 if (!valid_filetype(args->os_varp))
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1837 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
1838 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1839 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1840 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
1841
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1842 // 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
1843 // 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
1844 secure = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1845
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1846 // 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
1847 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
1848
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1849 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
1850
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1851 // 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
1852 // 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
1853 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
1854 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1855
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1856 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
1857 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1858 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
1859 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1860 // 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
1861 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
1862 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
1863 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
1864 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1865 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1866 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1867 // 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
1868 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
1869 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
1870 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
1871 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
1872 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1873 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
1874 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1875 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
1876 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
1877 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1878 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
1879 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1880
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1881 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1882 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1883 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1884
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1885 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1886 * 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
1887 */
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
1888 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
1889 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
1890 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1891 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
1892 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
1893
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1894 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
1895 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
1896 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
1897 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1898
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1899 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1900 * 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
1901 */
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
1902 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
1903 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
1904 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1905 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
1906 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
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 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
1909 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1910
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1911 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1912 * 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
1913 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1914 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1915 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
1916 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1917 if (*args->os_varp != NUL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1918 && STRCMP(args->os_varp, "expr:0") != 0
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1919 && STRCMP(args->os_varp, "expr:1") != 0)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1920 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
1921
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1922 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1923 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1924
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1925 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1926 * 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
1927 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1928 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1929 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
1930 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1931 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
1932
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1933 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
1934 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1935 for (p = args->os_varp; *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
1936 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1937 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
1938 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
1939
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1940 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
1941 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
1942 x2 = *p++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1943 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
1944 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1945 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
1946 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
1947 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1948 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
1949 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
1950 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
1951 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1952 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1953 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1954 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1955 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1956 // Check for "x:y,x:y"
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1957 for (p = args->os_varp; *p != NUL; p += 4)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1958 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1959 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
1960 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
1961 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
1962 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1963 }
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1966 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1967 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1968
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1969 #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
1970 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1971 * 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
1972 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1973 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1974 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
1975 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1976 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
1977 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
1978
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1979 return NULL;
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 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1982
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 * 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
1985 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1986 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1987 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
1988 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1989 return did_set_option_listflag(args->os_varp, (char_u *)MOUSE_ALL,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1990 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
1991 }
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 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1994 * 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
1995 */
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
1996 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
1997 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
1998 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1999 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
2000 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
2001 #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
2002 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
2003 // 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
2004 // 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
2005 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
2006 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2007
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2008 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
2009 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2010
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2011 #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
2012 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2013 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
2014 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2015 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
2016
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2017 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
2018 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
2019
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2020 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2021 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2022 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2023
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2024 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2025 * 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
2026 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2027 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2028 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
2029 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2030 return did_set_opt_strings(args->os_varp, p_nf_values, TRUE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2031 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2032
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2033 #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
2034 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2035 * Returns TRUE if the option pointed by "varp" or "gvarp" is one of the
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2036 * '*expr' options: 'balloonexpr', 'diffexpr', 'foldexpr', 'foldtext',
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2037 * 'formatexpr', 'includeexpr', 'indentexpr', 'patchexpr', 'printexpr' or
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2038 * 'charconvert'.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2039 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2040 static int
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2041 is_expr_option(char_u **varp, char_u **gvarp)
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2042 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2043 return (
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2044 # ifdef FEAT_BEVAL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2045 varp == &p_bexpr || // 'balloonexpr'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2046 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2047 # ifdef FEAT_DIFF
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2048 varp == &p_dex || // 'diffexpr'
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 # ifdef FEAT_FOLDING
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2051 gvarp == &curwin->w_allbuf_opt.wo_fde || // 'foldexpr'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2052 gvarp == &curwin->w_allbuf_opt.wo_fdt || // 'foldtext'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2053 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2054 gvarp == &p_fex || // 'formatexpr'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2055 # ifdef FEAT_FIND_ID
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2056 gvarp == &p_inex || // 'includeexpr'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2057 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2058 gvarp == &p_inde || // 'indentexpr'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2059 # ifdef FEAT_DIFF
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2060 varp == &p_pex || // 'patchexpr'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2061 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2062 # ifdef FEAT_POSTSCRIPT
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2063 varp == &p_pexpr || // 'printexpr'
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2064 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2065 varp == &p_ccv); // 'charconvert'
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2066 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2067
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2068 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2069 * 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
2070 * '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
2071 * '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
2072 *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2073 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2074 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2075 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
2076 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2077 // 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
2078 // the script identifier.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2079 char_u *name = get_scriptlocal_funcname(args->os_varp);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2080 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
2081 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2082 free_string_option(args->os_varp);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2083 args->os_varp = name;
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2086 return NULL;
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 #endif
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2091 * 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
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 *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2094 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
2095 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2096 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
2097
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2098 // 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
2099 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
2100 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2101 (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
2102 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
2103 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
2104 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2105 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
2106 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
2107 }
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 return NULL;
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2113 #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
2114 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2115 * 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
2116 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2117 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2118 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
2119 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2120 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
2121 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
2122
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2123 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2124 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2125 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2126
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2127 #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
2128 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2129 * 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
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 *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2132 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
2133 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2134 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
2135
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2136 // 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
2137 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
2138 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
2139 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2140 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
2141 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
2142 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2143 else
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 // 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
2146 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
2147 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2148 if (*s == '_')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2149 *s = '-';
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2150 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2151 *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
2152 }
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2155 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2156 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2157 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2158
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2159 #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
2160 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2161 * 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
2162 * "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
2163 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2164 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2165 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
2166 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2167 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
2168 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
2169 int wid;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2170
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2171 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
2172 ru_wid = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2173 s = args->os_varp;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2174 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
2175 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2176 // 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
2177 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
2178 s++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2179 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
2180 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
2181 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
2182 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2183 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
2184 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2185 // 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
2186 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
2187 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
2188 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
2189 comp_col();
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 return errmsg;
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 #endif
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 #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
2196 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2197 * 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
2198 */
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
2199 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2200 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
2201 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2202 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
2203 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
2204
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2205 return NULL;
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 #endif
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 #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
2210 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2211 * 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
2212 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2213 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2214 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
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.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2217 if (*args->os_varp != NUL && STRCMP(args->os_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 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2293 return did_set_option_listflag(args->os_varp, (char_u *)SHM_ALL,
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2294 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
2295 }
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 #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
2298 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2299 * 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
2300 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2301 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2302 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
2303 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2304 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
2305
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2306 for (s = args->os_varp; *s; )
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2307 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2308 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
2309 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
2310 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
2311 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2312
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2313 return NULL;
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 #endif
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2318 * 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
2319 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2320 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2321 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
2322 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2323 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
2324 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2325
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2326 #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
2327 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2328 * 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
2329 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2330 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2331 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
2332 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2333 if (check_opt_strings(args->os_varp, p_scl_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
2334 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
2335 // 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
2336 // 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
2337 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
2338 || (*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
2339 && (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
2340 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
2341
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2342 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2343 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2344 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2345
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
2346 #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
2347 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2348 * 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
2349 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2350 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2351 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
2352 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2353 // 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
2354 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
2355 }
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 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2358 * 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
2359 */
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
2360 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
2361 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
2362 {
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
2363 if (!valid_spellfile(args->os_varp))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2364 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
2365
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2366 // 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
2367 // wordlists.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2368 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
2369 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2370
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 * 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
2373 */
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
2374 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
2375 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
2376 {
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
2377 if (!valid_spelllang(args->os_varp))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2378 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
2379
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2380 // 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
2381 // wordlists.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2382 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
2383 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2384
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2385 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2386 * 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
2387 */
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
2388 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
2389 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
2390 {
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
2391 if (*args->os_varp != NUL && STRCMP("camel", args->os_varp) != 0)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2392 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
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 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
2395 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2396
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2397 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2398 * 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
2399 */
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
2400 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
2401 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
2402 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2403 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
2404 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
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 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
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 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2409
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2410 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2411 * 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
2412 */
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
2413 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2414 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
2415 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2416 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
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
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2419 #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
2420 /*
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
2421 * 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
2422 */
ca6bc7c04163 patch 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 *
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2424 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
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 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
2427 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2428 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2429
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2430 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2431 * 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
2432 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2433 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2434 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
2435 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2436 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
2437 }
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2438
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2439 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2440 * 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
2441 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2442 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2443 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
2444 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2445 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
2446 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2447
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2448 #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
2449 /*
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
2450 * 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
2451 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2452 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
2453 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
2454 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2455 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
2456 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2457 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2458
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2459 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2460 * 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
2461 */
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
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_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
2464 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2465 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
2466 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
2467
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2468 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
2469 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2470 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
2471 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
2472 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2473 else
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 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
2476 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
2477 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2478
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
2479 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
2480 // 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
2481 *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
2482 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
2483 || 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
2484 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
2485
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2486 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
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2489 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2490 * 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
2491 */
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2492 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2493 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
2494 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2495 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
2496
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2497 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
2498 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
2499 #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
2500 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
2501 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
2502 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
2503 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
2504 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2505 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
2506 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
2507 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2508 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2509 // 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
2510 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
2511
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2512 // 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
2513 // 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
2514 *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
2515 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
2516 *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
2517 }
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 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
2520 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2521
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2522 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2523 * 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
2524 */
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2525 static void
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2526 did_set_term_option(char_u **varp, int *did_swaptcap 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
2527 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2528 // ":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
2529 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
2530 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2531 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
2532
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2533 // 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
2534 // 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
2535 // 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
2536 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
2537 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2538 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
2539 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
2540 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2541 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
2542 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
2543 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2544 #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
2545 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
2546 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2547 swap_tcap();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2548 *did_swaptcap = TRUE;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2549 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2550 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2551 // 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
2552 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
2553 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2554 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2555 ttest(FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2556 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
2557 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2558 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
2559 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
2560 #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
2561 // 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
2562 // 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
2563 // 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
2564 # ifdef VIMDLL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2565 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
2566 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2567 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
2568 #endif
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2569 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2570 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
2571 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2572 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
2573
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2574 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
2575 // 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
2576 // 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
2577 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
2578 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2579 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
2580 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2581 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2582
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
2583 #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
2584 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2585 * 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
2586 */
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
2587 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
2588 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
2589 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2590 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
2591 && 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
2592 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
2593
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2594 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
2595 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2596
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2597 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2598 * 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
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 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
2601 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
2602 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2603 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
2604
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2605 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
2606 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
2607
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2608 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
2609 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
2610 || (*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
2611 || *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
2612 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
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 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
2615 }
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2616
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2617 # 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
2618 /*
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2619 * 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
2620 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2621 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2622 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
2623 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2624 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
2625 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2626 # 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
2627 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2628
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2629 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2630 * 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
2631 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2632 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2633 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
2634 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2635 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
2636
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2637 #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
2638 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
2639 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2640 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
2641 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2642
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2643 #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
2644 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2645 * 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
2646 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2647 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2648 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
2649 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2650 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
2651 &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
2652 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
2653
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2654 out_flush();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2655 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
2656 (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
2657 return NULL;
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 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2660
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2661 #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
2662 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2663 * 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
2664 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2665 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2666 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
2667 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2668 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
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(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
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 '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
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_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
2684 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2685 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
2686
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2687 // 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
2688 // that.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2689 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
2690 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
2691 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
2692 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2693 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
2694 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
2695 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
2696
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2697 return errmsg;
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 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2700
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
2701 #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
2702 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2703 * 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
2704 */
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
2705 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
2706 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
2707 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2708 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
2709
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
2710 if (!(args->os_varp[0]) || (args->os_varp[0] == '0' && !(args->os_varp[1])))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2711 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2712 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
2713 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2714 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
2715 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
2716 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2717 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2718 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2719 {
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
2720 for (cp = args->os_varp; *cp; ++cp)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2721 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2722 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
2723 continue;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2724 if (*cp == ',' && cp > args->os_varp && *(cp-1) != ',')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2725 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2726 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
2727 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2728
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2729 int *oldarray = curbuf->b_p_vsts_array;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2730 if (tabstop_set(args->os_varp, &(curbuf->b_p_vsts_array)) == OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
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 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
2733 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
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 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2736 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
2737 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2738
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2739 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
2740 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2741
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2742 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2743 * 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
2744 */
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
2745 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
2746 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
2747 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2748 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
2749
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
2750 if (!(args->os_varp[0]) || (args->os_varp[0] == '0' && !(args->os_varp[1])))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2751 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2752 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
2753 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2754 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
2755 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
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 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2758 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2759 {
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
2760 for (cp = args->os_varp; *cp; ++cp)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2761 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2762 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
2763 continue;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2764 if (*cp == ',' && cp > args->os_varp && *(cp-1) != ',')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2765 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2766 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
2767 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2768
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2769 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
2770
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
2771 if (tabstop_set(args->os_varp, &(curbuf->b_p_vts_array)) == OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
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(oldarray);
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2774 # 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
2775 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
2776 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
2777 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2778 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2779 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2780 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
2781 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2782
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2783 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
2784 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2785 #endif
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2788 * 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
2789 */
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
2790 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2791 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
2792 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2793 verbose_stop();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2794 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
2795 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
2796
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2797 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
2798 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2799
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2800 #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
2801 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2802 * 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
2803 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2804 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2805 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
2806 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2807 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
2808 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2809 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2810
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2811 #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
2812 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2813 * 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
2814 */
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
2815 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2816 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
2817 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2818 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
2819 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
2820
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2821 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
2822 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2823 // 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
2824 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
2825 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2826 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
2827 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2828 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2829 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
2830 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2831 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
2832 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2833 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
2834 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2835 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2836 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
2837 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2838 // optional number
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2839 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
2840 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2841 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2842 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
2843 ++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
2844 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
2845 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2846 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
2847 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2848
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2849 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
2850 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2851 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
2852 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2853 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
2854 _(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
2855 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
2856 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
2857 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2858 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2859 errmsg = "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2860 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2861 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2862 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2863 if (*s == ',')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2864 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2865 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
2866 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2867 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
2868 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
2869 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2870 errmsg = "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2871 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2872 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2873 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2874 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
2875 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
2876
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2877 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
2878 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2879 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2880
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2881 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2882 * 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
2883 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2884 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2885 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
2886 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2887 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
2888 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
2889
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2890 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
2891 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2892 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
2893 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
2894 }
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 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
2897 // 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
2898 *flags = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2899 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2900 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2901 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
2902 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
2903 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
2904 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2905 // 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
2906 // changes something.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2907 validate_virtcol();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2908 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
2909 }
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2912 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
2913 }
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2914
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2915 /*
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2916 * 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
2917 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2918 char *
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2919 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
2920 {
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2921 return did_set_option_listflag(args->os_varp, (char_u *)WW_ALL,
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2922 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
2923 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2924
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2925 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2926 * 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
2927 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2928 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2929 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
2930 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2931 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
2932 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
2933 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2934 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2935
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2936 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2937 * 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
2938 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2939 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2940 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
2941 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2942 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
2943 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2944
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2945 #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
2946 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2947 * 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
2948 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2949 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2950 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
2951 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2952 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
2953
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2954 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
2955 || 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
2956 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
2957 # 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
2958 # 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
2959 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
2960 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
2961 # 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
2962 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
2963 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
2964 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2965 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2966 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2967 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2968 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2969
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2970 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2971 * 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
2972 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2973 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2974 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
2975 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2976 #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
2977 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
2978 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2979 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2980 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2981
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2982 #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
2983 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2984 * 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
2985 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2986 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
2987 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
2988 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2989 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
2990
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2991 ++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
2992 // 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
2993 // 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
2994 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
2995 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
2996 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
2997 --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
2998 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2999 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3000
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3001 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3002 * 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
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 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
3005 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
3006 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3007 // 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
3008 // 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
3009 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
3010 return;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3011
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3012 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
3013 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
3014
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3015 // 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
3016 // 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
3017 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
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 ++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
3020 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
3021 // 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
3022 // 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
3023 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
3024 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
3025 --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
3026 // 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
3027 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
3028 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
3029
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3030 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
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
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3033 #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
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 * 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
3036 * 'runtimepath'.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3037 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3038 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
3039 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
3040 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3041 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
3042 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
3043 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
3044
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3045 // 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
3046 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
3047 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
3048
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3049 // 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
3050 // 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
3051 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
3052 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
3053 break;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3054 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
3055 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3056 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
3057 (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
3058 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
3059 }
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 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3062
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3063 /*
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3064 * 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
3065 * 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
3066 * 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
3067 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3068 char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3069 did_set_string_option(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3070 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
3071 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
3072 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
3073 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
3074 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
3075 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
3076 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
3077 // 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
3078 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3079 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
3080 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
3081 char_u **gvarp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3082 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
3083 int value_changed = FALSE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3084 int did_swaptcap = FALSE;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3085 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
3086
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3087 // Get the global option to compare with, otherwise we would have to check
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3088 // two values for all local options.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3089 gvarp = (char_u **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3090
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3091 // 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
3092 if ((secure
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3093 #ifdef HAVE_SANDBOX
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3094 || sandbox != 0
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3095 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3096 ) && (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
3097 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
3098 // 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
3099 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
3100 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
3101 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
3102 {
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3103 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
3104
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3105 args.os_varp = *varp;
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3106 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
3107 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
3108 args.os_newval.string = value;
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3109 args.os_value_checked = FALSE;
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3110 args.os_value_changed = FALSE;
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3111 args.os_restore_chartab = FALSE;
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
3112 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
3113 // 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
3114 // 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
3115 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
3116
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
3117 #ifdef FEAT_EVAL
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3118 // The '*expr' option (e.g. diffexpr, foldexpr, etc.), callback
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3119 // functions may modify '*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
3120 if (errmsg == NULL && is_expr_option(varp, gvarp))
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
3121 *varp = args.os_varp;
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
3122 #endif
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3123 // 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
3124 // 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
3125 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
3126 // 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
3127 // 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
3128 *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
3129 // 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
3130 // 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
3131 restore_chartab = args.os_restore_chartab;
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
3132 }
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3133 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
3134 errmsg = did_set_term(&opt_idx, &free_oldval);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3135 else if ( varp == &p_enc // 'encoding'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3136 || gvarp == &p_fenc // 'fileencoding'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3137 || varp == &p_tenc // 'termencoding'
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3138 || gvarp == &p_menc) // 'makeencoding'
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
3139 errmsg = did_set_encoding(varp, gvarp, opt_flags);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3140 // terminal options
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3141 else if (istermoption_idx(opt_idx) && full_screen)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
3142 did_set_term_option(varp, &did_swaptcap);
26268
3aa48d4e3dc8 patch 8.2.3665: cannot use a lambda for 'tagfunc'
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
3143
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3144 // 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
3145 if (errmsg != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3146 {
29509
d61007cc39b3 patch 9.0.0096: flag "new_value_alloced" is always true
Bram Moolenaar <Bram@vim.org>
parents: 29395
diff changeset
3147 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
3148 *varp = oldval;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3149 // 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
3150 if (restore_chartab)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3151 (void)init_chartab();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3152 if (varp == &p_hl)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3153 (void)highlight_changed();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3154 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3155 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3156 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3157 #ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3158 // 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
3159 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
3160 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3161 // 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
3162 // 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
3163 // 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
3164 if (free_oldval)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3165 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
3166 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
3167
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3168 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
3169 && 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
3170 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3171 // 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
3172 // 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
3173 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
3174 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
3175 *(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
3176 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3177
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3178 // 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
3179 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
3180 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
3181
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3182 // 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
3183 #ifdef FEAT_SYN_HL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3184 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
3185 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
3186 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3187 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
3188 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
3189 #ifdef FEAT_SPELL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3190 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
3191 do_spelllang_source();
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 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3194
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3195 if (varp == &p_mouse)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3196 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3197 if (*p_mouse == NUL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3198 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
3199 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3200 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
3201 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3202
20609
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3203 #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
3204 if (varp == &p_rtp)
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3205 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
3206 #endif
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3207
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
3208 #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
3209 // 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
3210 // 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
3211 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
3212 && 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
3213 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
3214 #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
3215
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3216 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
3217 && (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
3218 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
3219
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3220 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
3221 {
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3222 #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
3223 // 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
3224 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
3225
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3226 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
3227 || 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
3228 # 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
3229 || 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
3230 || 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
3231 # 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
3232 # 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
3233 || 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
3234 # 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
3235 || 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
3236 # 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
3237 || 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
3238 # 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
3239 )
ca6bc7c04163 patch 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 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
3241
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3242 // 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
3243 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
3244 #endif
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3245 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
3246 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3247
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3248 #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
3249 if (did_swaptcap)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3250 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3251 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
3252 init_highlight(TRUE, FALSE);
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 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3255
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3256 return errmsg;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3257 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3258
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 * 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
3261 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3262 * 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
3263 * Empty is always OK.
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 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3266 check_opt_strings(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3267 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3268 char **values,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3269 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
3270 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3271 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
3272 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3273
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3274 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3275 * 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
3276 * 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
3277 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3278 * 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
3279 * Empty is always OK.
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 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3282 opt_strings_flags(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3283 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
3284 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
3285 unsigned *flagp,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3286 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
3287 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3288 int i;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3289 int len;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3290 unsigned new_flags = 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3291
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3292 while (*val)
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 for (i = 0; ; ++i)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3295 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3296 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
3297 return FAIL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3298
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3299 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
3300 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
3301 && ((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
3302 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3303 val += len + (val[len] == ',');
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3304 new_flags |= (1 << i);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3305 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
3306 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3307 }
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 if (flagp != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3310 *flagp = new_flags;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3311
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3312 return OK;
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3316 * 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
3317 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3318 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3319 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
3320 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3321 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
3322 }
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3323
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3324 /*
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
3325 * 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
3326 * 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
3327 *
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3328 * 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
3329 * 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
3330 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3331 void
32009
4545f58c8490 patch 9.0.1336: functions without arguments are not always declared properly
Bram Moolenaar <Bram@vim.org>
parents: 31996
diff changeset
3332 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
3333 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3334 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
3335 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3336 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
3337 return;
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3338 }
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 (++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
3341 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3342 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
3343 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
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
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 * 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
3349 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3350 void
32009
4545f58c8490 patch 9.0.1336: functions without arguments are not always declared properly
Bram Moolenaar <Bram@vim.org>
parents: 31996
diff changeset
3351 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
3352 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3353 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
3354 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3355 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
3356 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
3357 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3358 }