annotate src/optionstr.c @ 32525:bb5458706799 v9.0.1594

patch 9.0.1594: some internal error messages are translated Commit: https://github.com/vim/vim/commit/68ebcee0237d927dd5386073499162389d4d708a Author: RestorerZ <restorer@mail2k.ru> Date: Wed May 31 17:12:14 2023 +0100 patch 9.0.1594: some internal error messages are translated Problem: Some internal error messages are translated. Solution: Consistently do not translate internal error messages. (closes #12459)
author Bram Moolenaar <Bram@vim.org>
date Wed, 31 May 2023 18:15:04 +0200
parents 3c2c1cb61004
children 448aef880252
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
32299
3d4e28569a6d patch 9.0.1481: decrypting with libsodium may fail if the library changes
Bram Moolenaar <Bram@vim.org>
parents: 32144
diff changeset
32 "xchacha20", "xchacha20v2",
24970
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
32417
3c2c1cb61004 patch 9.0.1540: reverse() on string doesn't work in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 32299
diff changeset
137 #if defined(FEAT_EVAL) || defined(PROTO)
18100
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()");
32525
bb5458706799 patch 9.0.1594: some internal error messages are translated
Bram Moolenaar <Bram@vim.org>
parents: 32417
diff changeset
382 siemsg("For option %s", name);
18100
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
32144
f3987fde6dea patch 9.0.1403: unused variables and functions
Bram Moolenaar <Bram@vim.org>
parents: 32120
diff changeset
432 #if defined(FEAT_PROP_POPUP) || \
f3987fde6dea patch 9.0.1403: unused variables and functions
Bram Moolenaar <Bram@vim.org>
parents: 32120
diff changeset
433 (defined(FEAT_DIFF) && defined(FEAT_FOLDING)) || defined(PROTO)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
434 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435 * 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
436 * 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
437 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 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
440 win_T *wp,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 int set_sid)
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 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
448
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449 block_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450 curwin = wp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
451 curbuf = curwin->w_buffer;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 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
453 curwin = save_curwin;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 curbuf = curwin->w_buffer;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455 unblock_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456 }
32144
f3987fde6dea patch 9.0.1403: unused variables and functions
Bram Moolenaar <Bram@vim.org>
parents: 32120
diff changeset
457 #endif
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458
27018
268f6a3511df patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents: 27000
diff changeset
459 #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
460 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 * 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
462 * 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
463 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 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
466 buf_T *buf,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
467 char_u *name,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 int opt_flags,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 int set_sid)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 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
474
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 block_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 curbuf = buf;
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 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
479 curbuf = save_curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
480 curwin->w_buffer = curbuf;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
481 unblock_autocmds();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 }
27018
268f6a3511df patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents: 27000
diff changeset
483 #endif
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
484
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
485 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
486 * 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
487 *
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
488 * 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
489 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
490 char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
491 set_string_option(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
492 int opt_idx,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
493 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
494 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
495 char *errbuf)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
496 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 char_u *s;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
498 char_u **varp;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
499 char_u *oldval;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
500 #if defined(FEAT_EVAL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
501 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
502 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
503 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
504 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
505 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
506 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
507 #endif
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
508 char *errmsg = NULL;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
509 int value_checked = FALSE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
510
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
511 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
512 return NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
513
19675
bee179e81f28 patch 8.2.0394: Coverity complains about using NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 19265
diff changeset
514 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
515 if (s == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
516 return NULL;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
517
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
518 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
519 (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
520 ? (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
521 ? OPT_GLOBAL : OPT_LOCAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
522 : opt_flags);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
523 oldval = *varp;
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
524 #if defined(FEAT_EVAL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
525 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
526 {
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
527 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
528 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
529 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530 #endif
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
531 *varp = s;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
532
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
533 #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
534 if (!starting
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
535 # ifdef FEAT_CRYPT
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
536 && !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
537 # endif
31752
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
538 )
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
539 {
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
540 if (oldval_l != NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
541 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
542 if (oldval_g != NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
543 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
544 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
545 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
546 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547 #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
548 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
549 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
550 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
551
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552 #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
553 // 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
554 if (errmsg == NULL)
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
555 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
556 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
557 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
558 vim_free(saved_oldval);
3365a601e73b patch 9.0.1208: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents: 31463
diff changeset
559 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
560 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
561 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
562 #endif
28457
4dcccb2673fe patch 8.2.4753: error from setting an option is silently ignored
Bram Moolenaar <Bram@vim.org>
parents: 28455
diff changeset
563 return errmsg;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 * 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
568 * 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
569 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571 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
572 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 return valid_name(val, ".-_");
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
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 #ifdef FEAT_STL_OPT
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 * 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
579 * 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
580 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 static char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 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
583 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 int groupdepth = 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 static char errbuf[80];
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586
22721
92a100fc5e17 patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents: 22091
diff changeset
587 while (*s)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589 // 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
590 while (*s && *s != '%')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
591 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592 if (!*s)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
593 break;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 s++;
31936
82da100c0e45 patch 9.0.1300: 'statusline' only supports one "%=" item
Bram Moolenaar <Bram@vim.org>
parents: 31886
diff changeset
595 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
596 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
600 if (*s == ')')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
601 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
602 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603 if (--groupdepth < 0)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 break;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 if (*s == '-')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
609 while (VIM_ISDIGIT(*s))
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 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
612 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613 if (*s == '.')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 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
617 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
618 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 if (*s == '(')
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 groupdepth++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
622 continue;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 if (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
625 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626 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
627 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
628 if (*s == '{')
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
629 {
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
630 int reevaluate = (*++s == '%');
24630
4cf4d7a71fac patch 8.2.2854: custom statusline cannot contain % items
Bram Moolenaar <Bram@vim.org>
parents: 24582
diff changeset
631
28455
8f4f16efeeb3 patch 8.2.4752: wrong 'statusline' value can cause illegal memory access
Bram Moolenaar <Bram@vim.org>
parents: 28451
diff changeset
632 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
633 // "}" 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
634 return illegal_char(errbuf, '}');
24630
4cf4d7a71fac patch 8.2.2854: custom statusline cannot contain % items
Bram Moolenaar <Bram@vim.org>
parents: 24582
diff changeset
635 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
636 s++;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 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
638 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
639 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
640 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 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
642 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
643 return NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
645 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647 /*
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
648 * 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
649 * 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
650 * 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
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 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
653 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
654 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
655 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
656 && 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
657 ? "/\\*?[|;&<>\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
658 || ((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
659 && 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
660 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
661
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
662 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
663 * 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
664 * 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
665 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
666 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
667 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
668 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
669 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
670 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
671
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
672 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
673 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
674
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 * 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
677 * 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
678 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
679 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
680 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
681 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
682 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
683 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
684
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
685 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
686 * 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
687 */
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
688 static char *
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
689 did_set_option_listflag(char_u *val, char_u *flags, char *errbuf)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
690 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
691 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
692
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
693 for (s = val; *s; ++s)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
694 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
695 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
696
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
697 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
698 }
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
701 * 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
702 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
703 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
704 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
705 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
706 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
707 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
708
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
709 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
710 }
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
713 * 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
714 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
715 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
716 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
717 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
718 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
719 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
720
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
721 #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
722 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
723 #endif
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
724
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
725 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
726
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
727 #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
728 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
729 && 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
730 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
731 // 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
732 // 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
733 // 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
734 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
735 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
736 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
737 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
738 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
739 }
32070
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 #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
742 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
743 #endif
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 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
746 }
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
749 * 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
750 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
751 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
752 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
753 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
754 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
755 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
756 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
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 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
760 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
761
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
762 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
763 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
764
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
765 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
766 * 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
767 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
768 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
769 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
770 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
771 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
772 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
773 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
774
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
775 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
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 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
778 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
779 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
780
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
781 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
782 // 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
783 *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
784 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
785 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
786 if (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
787 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
788 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
789 + (((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
790 + (((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
791 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
792 // 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
793 (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
794 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
795 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
796 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
797 }
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 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
800 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
801
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
802 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
803 * 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
804 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
805 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
806 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
807 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
808 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
809 *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
810 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
811
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
812 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
813 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
814
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
815 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
816 * 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
817 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
818 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
819 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
820 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
821 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
822 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
823
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
824 #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
825 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
826 * 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
827 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
828 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
829 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
830 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
831 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
832
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
833 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
834 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
835 // 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
836 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
837 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
838
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
839 return errmsg;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
840 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
841 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
842
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
843 #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
844 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
845 * 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
846 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
847 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
848 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
849 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
850 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
851 && !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
852 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
853
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
854 return NULL;
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 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
857
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
858 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
859 * 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
860 */
32055
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
861 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
862 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
863 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
864 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
865 }
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
868 * 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
869 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
870 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
871 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
872 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
873 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
874 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
875
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
876 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
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 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
879 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
880 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
881 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
882 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
883
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
884 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
885 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
886
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
887 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
888 * 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
889 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
890 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
891 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
892 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
893 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
894 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
895
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
896 /*
32076
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
897 * 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
898 */
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
899 static char *
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
900 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
901 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
902 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
903 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
904
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
905 // 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
906 // local value
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
907 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
908 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
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 else
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
911 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
912 **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
913 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
914 return errmsg;
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 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
917 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
918
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
919 // 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
920 // '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
921 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
922 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
923 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
924 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
925 // 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
926 // 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
927 // 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
928 // 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
929 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
930 {
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
931 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
932 (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
933 }
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
934 else
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 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
937 (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
938 }
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
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
941 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
942
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
943 return NULL;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
944 }
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 /*
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
947 * 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
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 *
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
950 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
951 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
952 char_u **varp = (char_u **)args->os_varp;
32076
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
953 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
954
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
955 if ( varp == &p_lcs // global 'listchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
956 || varp == &p_fcs) // global 'fillchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
957 errmsg = did_set_global_listfillchars(*varp, varp == &p_lcs,
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
958 args->os_flags);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
959 else if (varp == &curwin->w_p_lcs) // local 'listchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
960 errmsg = set_listchars_option(curwin, *varp, TRUE);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
961 else if (varp == &curwin->w_p_fcs) // local 'fillchars'
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
962 errmsg = set_fillchars_option(curwin, *varp, TRUE);
32076
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
963
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
964 return errmsg;
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
965 }
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
966
32acf287a9ae patch 9.0.1369: still some "else if" constructs for setting options
Bram Moolenaar <Bram@vim.org>
parents: 32070
diff changeset
967 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
968 * 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
969 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
970 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
971 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
972 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
973 // 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
974 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
975
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
976 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
977 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
978
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
979 #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
980 /*
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
981 * 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
982 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
983 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
984 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
985 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
986 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
987 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
988 #endif
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
991 * 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
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 *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
994 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
995 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
996 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
997 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
998 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
999
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1000 for (s = *varp; *s; )
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1001 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1002 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
1003 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1004 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
1005 && !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
1006 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1007 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
1008 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1009 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1010 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1011 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1012 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
1013 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
1014 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
1015 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
1016 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
1017 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1018 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
1019 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1020 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
1021 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1022 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1023 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1024 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
1025 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1026
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1027 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1028 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1029
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1030 #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
1031 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1032 * 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
1033 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1034 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1035 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
1036 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1037 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1038
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1039 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1040 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
1041
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1042 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1043 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1044 #endif
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1047 * 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
1048 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1049 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1050 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
1051 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1052 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1053 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
1054
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1055 // check if it is a valid value for 'complete' -- Acevedo
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1056 for (s = *varp; *s;)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1057 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1058 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
1059 s++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1060 if (!*s)
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1061 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1062 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
1063 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
1064 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
1065 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1066 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
1067 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1068 // 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
1069 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
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 (*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
1072 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1073 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1074 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1075 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1076 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1077 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1078 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
1079 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1080 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
1081 _(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
1082 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
1083 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1084 return "";
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 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1087 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1088
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1089 return NULL;
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1092 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1093 * 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
1094 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1095 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1096 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
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 (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
1099 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
1100
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1101 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
1102 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1103 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1104
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1105 #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
1106 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1107 * 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
1108 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1109 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1110 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
1111 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1112 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
1113 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
1114
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1115 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
1116 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1117 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1118 #endif
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 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
1121 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1122 * 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
1123 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1124 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1125 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
1126 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1127 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
1128 || 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
1129 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
1130
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1131 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1132 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1133 #endif
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 #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
1136 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1137 * 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
1138 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1139 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1140 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
1141 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1142 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1143
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1144 return did_set_option_listflag(*varp, (char_u *)COCU_ALL, args->os_errbuf);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1145 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1146 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1147
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1148 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1149 * 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
1150 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1151 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1152 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
1153 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1154 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1155
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1156 return did_set_option_listflag(*varp, (char_u *)CPO_ALL, args->os_errbuf);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1157 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1158
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1159 #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
1160 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1161 * 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
1162 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1163 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1164 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
1165 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1166 // 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
1167 // history.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1168 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
1169
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1170 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
1171 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1172 // 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
1173 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
1174 *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
1175 changed_internal();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1176 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1177
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1178 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1179 }
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1182 * 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
1183 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1184 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1185 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
1186 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1187 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
1188 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
1189
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1190 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
1191 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
1192 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1193 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
1194 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
1195 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
1196 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
1197 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
1198
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1199 // 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
1200 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
1201 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1202 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
1203 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
1204 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1205 // 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
1206 // 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
1207 // local value.
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 | 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
1209 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1210 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
1211 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
1212 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1213
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1214 // 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
1215 // 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
1216 // 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
1217 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
1218 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
1219 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1220 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
1221 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
1222 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
1223 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1224 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
1225 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
1226 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
1227
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1228 // 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
1229 // 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
1230 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
1231 && 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
1232 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1233 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
1234
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1235 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
1236 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
1237 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
1238 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1239 return NULL;
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 #endif
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 (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
1244 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1245 * 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
1246 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1247 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1248 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
1249 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1250 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
1251
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1252 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
1253 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1254
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1255 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
1256 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
1257 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1258 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
1259 || 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
1260 || 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
1261 || (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
1262 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
1263 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
1264 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1265 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1266 p += 3;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1267 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1268
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1269 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1270 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1271 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1272
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1273 #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
1274 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1275 * 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
1276 */
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1277 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1278 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
1279 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1280 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1281
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1282 if (**varp == NUL || fill_culopt_flags(*varp, curwin) != OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1283 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
1284
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1285 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
1286 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1287 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1288
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 '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
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_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
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 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
1296 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1297
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1298 #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
1299 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1300 * 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
1301 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1302 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1303 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
1304 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1305 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
1306 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
1307
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1308 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
1309 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1310 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1311
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1312 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1313 * 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
1314 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1315 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1316 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
1317 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1318 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
1319 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
1320
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1321 (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
1322 return NULL;
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
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1325 /*
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1326 * 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
1327 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1328 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1329 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
1330 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1331 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
1332 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1333
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
1334 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1335 * 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
1336 * 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
1337 */
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1338 char *
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1339 did_set_encoding(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1340 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1341 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1342 char_u **gvarp;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1343 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
1344 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
1345
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1346 // Get the global option to compare with, otherwise we would have to check
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1347 // two values for all local options.
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1348 gvarp = (char_u **)get_option_varp_scope(args->os_idx, OPT_GLOBAL);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1349
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1350 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
1351 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1352 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
1353 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
1354 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
1355 // 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
1356 // 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
1357 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
1358 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1359 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1360 // 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
1361 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
1362 // 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
1363 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
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 (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
1367 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1368 // 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
1369 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
1370 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
1371 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1372 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
1373 *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
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 (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
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 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
1378 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
1379 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1380 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1381
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1382 #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
1383 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
1384 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1385 // 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
1386 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
1387 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
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 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1390
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1391 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
1392 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1393 #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
1394 // 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
1395 // (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
1396 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
1397 (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
1398 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1399
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1400 // 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
1401 // '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
1402 // 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
1403 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
1404 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1405 if (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
1406 || 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
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 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
1409 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
1410 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
1411 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1412 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1413
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1414 #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
1415 // $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
1416 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
1417 {
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1418 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
1419 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
1420 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1421 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1422 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1423
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1424 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
1425 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1426
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1427 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1428 * 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
1429 */
31996
ca6bc7c04163 patch 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 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1431 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
1432 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1433 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
1434 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
1435 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1436 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1437
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1438 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1439 * 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
1440 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1441 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
1442 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
1443 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1444 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1445
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1446 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
1447 return e_cannot_make_changes_modifiable_is_off;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1448 else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1449 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
1450
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1451 // 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
1452 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
1453 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
1454 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1455 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
1456 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
1457 // 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
1458 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
1459 // 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
1460 // 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
1461 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
1462 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
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 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1468 * 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
1469 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1470 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
1471 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
1472 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1473 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
1474 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
1475
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1476 // 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
1477 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
1478 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
1479 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1480 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
1481
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1482 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
1483 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1484
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1485 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1486 * 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
1487 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1488 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1489 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
1490 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1491 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1492
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1493 if (!valid_filetype(*varp))
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1494 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
1495
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1496 args->os_value_changed = STRCMP(args->os_oldval.string, *varp) != 0;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1497
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1498 // 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
1499 // 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
1500 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
1501
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1502 return NULL;
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1505 #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
1506 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1507 * 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
1508 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1509 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1510 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
1511 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1512 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
1513 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1514 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1515
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1516 #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
1517 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1518 * 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
1519 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1520 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1521 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
1522 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1523 (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
1524 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
1525 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1526 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1527 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1528 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1529
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1530 #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
1531 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1532 * 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
1533 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1534 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1535 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
1536 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1537 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
1538 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1539 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1540 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1541
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1542 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1543 * 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
1544 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1545 char *
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_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
1547 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1548 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1549 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
1550
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1551 p = vim_strchr(*varp, ',');
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1552 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
1553 return e_comma_required;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1554 else if (p == *varp || p[1] == NUL)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1555 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
1556 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
1557 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
1558
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1559 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
1560 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1561
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1562 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1563 * 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
1564 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1565 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1566 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
1567 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1568 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1569
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1570 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1571 || *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
1572 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
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 foldUpdateAll(curwin);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1575 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
1576 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
1577 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
1578 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1579
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1580 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1581 * 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
1582 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1583 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1584 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
1585 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1586 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
1587 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1588 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1589
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1590 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1591 * 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
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 *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1594 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
1595 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1596 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1597
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1598 return did_set_option_listflag(*varp, (char_u *)FO_ALL, args->os_errbuf);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1599 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1600
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1601 #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
1602 /*
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1603 * 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
1604 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1605 char *
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1606 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
1607 {
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1608 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
1609 }
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1610 #endif
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1611
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1612 #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
1613 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1614 * 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
1615 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1616 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
1617 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
1618 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1619 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
1620 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
1621
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1622 if (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
1623 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1624 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
1625 # 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
1626 // 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
1627 // 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
1628 // 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
1629 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
1630 {
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1631 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
1632 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
1633 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
1634 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1635 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1636 if (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
1637 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1638 # 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
1639 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
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 // 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
1642 // 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
1643 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
1644 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
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 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1647 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1648 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
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1652 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
1653 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1654
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1655 # 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
1656 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1657 * 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
1658 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1659 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
1660 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
1661 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1662 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
1663
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1664 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
1665 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
1666 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
1667 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
1668
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1669 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
1670 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1671 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1672
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 * 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
1675 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1676 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
1677 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
1678 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1679 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
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 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
1682 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
1683 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
1684 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
1685
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1686 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
1687 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1688 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1689
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1690 #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
1691 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1692 * 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
1693 */
ca6bc7c04163 patch 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 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
1695 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
1696 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1697 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
1698 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
1699 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1700 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1701
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1702 #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
1703 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1704 * 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
1705 */
31996
ca6bc7c04163 patch 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 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
1707 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
1708 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1709 char_u **varp = (char_u **)args->os_varp;
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1710 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
1711
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1712 errmsg = did_set_option_listflag(*varp, (char_u *)GO_ALL, args->os_errbuf);
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
1713 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
1714 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
1715
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1716 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
1717 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
1718 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1719 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1720
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1721 #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
1722 /*
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1723 * 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
1724 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1725 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
1726 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
1727 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1728 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
1729 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
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 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1732
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1733 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1734 * 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
1735 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1736 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1737 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
1738 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1739 // 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
1740 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
1741 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
1742 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
1743 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
1744 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1745 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1746
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1747 #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
1748 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1749 * 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
1750 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1751 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1752 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
1753 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1754 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
1755
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1756 // 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
1757 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
1758 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1759 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
1760 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1761 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
1762 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1763 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1764 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
1765 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1766 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1767
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1768 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
1769 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1770 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1771
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1772 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1773 * 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
1774 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1775 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1776 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
1777 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1778 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
1779 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
1780
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1781 return NULL;
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1784 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1785 * 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
1786 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1787 static char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1788 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
1789 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1790 #ifdef FEAT_STL_OPT
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1791 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1792
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1793 // NULL => statusline syntax
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1794 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1795 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
1796 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1797 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
1798 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1799 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
1800
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1801 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
1802 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1803
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1804 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1805 * 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
1806 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1807 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1808 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
1809 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1810 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
1811
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1812 #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
1813 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
1814 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1815
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1816 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
1817 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1818
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1819 #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
1820 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1821 * 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
1822 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1823 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1824 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
1825 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1826 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
1827 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
1828 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1829 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1830 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1831
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1832 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1833 * 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
1834 * 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
1835 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1836 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1837 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
1838 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1839 // '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
1840 // 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
1841 // '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
1842 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
1843 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1844 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
1845 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
1846 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1847
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1848 return NULL;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1849 }
32070
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 #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
1852 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1853 * 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
1854 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1855 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1856 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
1857 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1858 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1859 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
1860
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1861 if (!valid_filetype(*varp))
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1862 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
1863 else
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 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
1866
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1867 // 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
1868 // 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
1869 secure = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1870
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1871 // 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
1872 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
1873
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1874 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
1875
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1876 // 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
1877 // 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
1878 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
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 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
1882 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1883 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
1884 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1885 // 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
1886 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
1887 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
1888 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
1889 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1890 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1891 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1892 // 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
1893 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
1894 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
1895 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
1896 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
1897 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1898 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
1899 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1900 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
1901 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
1902 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1903 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
1904 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1905
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1906 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1907 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1908 #endif
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 * 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
1912 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1913 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
1914 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
1915 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1916 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
1917 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
1918
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1919 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
1920 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
1921 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
1922 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1923
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1924 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1925 * 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
1926 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
1927 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
1928 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
1929 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1930 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
1931 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
1932
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1933 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
1934 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1935
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
1936 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1937 * 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
1938 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1939 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1940 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
1941 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1942 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1943
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1944 if (**varp != NUL
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1945 && STRCMP(*varp, "expr:0") != 0
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1946 && STRCMP(*varp, "expr:1") != 0)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1947 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
1948
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1949 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1950 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1951
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1952 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1953 * 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
1954 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1955 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1956 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
1957 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1958 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1959 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
1960
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1961 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
1962 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1963 for (p = *varp; *p != NUL; ++p)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1964 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1965 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
1966 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
1967
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1968 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
1969 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
1970 x2 = *p++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1971 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
1972 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1973 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
1974 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
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 (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
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 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
1979 break;
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 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1982 else
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 // Check for "x:y,x:y"
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
1985 for (p = *varp; *p != NUL; p += 4)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1986 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1987 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
1988 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
1989 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
1990 break;
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
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1994 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1995 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1996
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1997 #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
1998 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
1999 * 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
2000 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2001 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2002 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
2003 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2004 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
2005 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
2006
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2007 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2008 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2009 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2010
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2011 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2012 * 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
2013 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2014 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2015 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
2016 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2017 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2018
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2019 return did_set_option_listflag(*varp, (char_u *)MOUSE_ALL,
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2020 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
2021 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2022
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 * 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
2025 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2026 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
2027 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
2028 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2029 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
2030 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
2031 #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
2032 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
2033 // 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
2034 // 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
2035 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
2036 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2037
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2038 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
2039 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2040
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2041 #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
2042 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2043 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
2044 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2045 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
2046
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2047 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
2048 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
2049
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2050 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2051 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2052 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2053
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2054 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2055 * 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
2056 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2057 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2058 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
2059 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2060 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2061
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2062 return did_set_opt_strings(*varp, p_nf_values, TRUE);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2063 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2064
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2065 #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
2066 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2067 * 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
2068 * '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
2069 * '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
2070 *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2071 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2072 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2073 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
2074 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2075 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2076
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2077 // If 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.
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2079 char_u *name = get_scriptlocal_funcname(*varp);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
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 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2082 free_string_option(*varp);
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2083 *varp = name;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
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 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2167 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2168 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
2169 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
2170 int wid;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2171
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2172 if (rulerformat) // 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
2173 ru_wid = 0;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2174 s = *varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2175 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
2176 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2177 // 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
2178 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
2179 s++;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2180 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
2181 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
2182 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
2183 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2184 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
2185 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2186 // 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
2187 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
2188 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
2189 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
2190 comp_col();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2191
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2192 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2193 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2194 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2195
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2196 #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
2197 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2198 * 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
2199 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2200 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2201 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
2202 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2203 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
2204 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
2205
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2206 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2207 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2208 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2209
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2210 #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
2211 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2212 * 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
2213 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2214 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2215 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
2216 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2217 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2218
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2219 // Currently only "search" is a supported value.
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2220 if (**varp != NUL && STRCMP(*varp, "search") != 0)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2221 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
2222
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2223 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2224 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2225 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2226
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2227 #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
2228 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2229 * 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
2230 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2231 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2232 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
2233 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2234 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
2235 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2236 #endif
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2239 * 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
2240 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2241 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2242 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
2243 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2244 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
2245 }
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2248 * 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
2249 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2250 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2251 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
2252 {
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2253 if (*p_sel == NUL || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2254 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
2255
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2256 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
2257 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2258
32070
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 * 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
2261 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2262 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2263 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
2264 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2265 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
2266 }
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 #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
2269 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2270 * 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
2271 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2272 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2273 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
2274 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2275 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
2276 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
2277 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
2278 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2279 // 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
2280 (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
2281 &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
2282 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
2283 }
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 return NULL;
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 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2288
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 * 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
2291 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2292 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2293 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
2294 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2295 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2296
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2297 return did_set_option_listflag(*varp, (char_u *)SHM_ALL, args->os_errbuf);
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2298 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2299
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2300 #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
2301 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2302 * 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
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 *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2305 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
2306 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2307 char_u **varp = (char_u **)args->os_varp;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2308 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
2309
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2310 for (s = *varp; *s; )
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2311 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2312 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
2313 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
2314 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
2315 }
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 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2318 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2319 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2320
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2321 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2322 * 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
2323 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2324 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2325 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
2326 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2327 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
2328 }
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 #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
2331 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2332 * 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
2333 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2334 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2335 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
2336 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2337 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2338
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2339 if (check_opt_strings(*varp, p_scl_values, FALSE) != OK)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2340 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
2341 // 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
2342 // 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
2343 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
2344 || (*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
2345 && (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
2346 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
2347
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2348 return NULL;
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 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2351
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2352 #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
2353 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2354 * 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
2355 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2356 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2357 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
2358 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2359 // 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
2360 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
2361 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2362
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2363 /*
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 * 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
2365 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2366 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
2367 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
2368 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2369 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2370
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2371 if (!valid_spellfile(*varp))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2372 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
2373
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2374 // 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
2375 // wordlists.
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2376 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
2377 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2378
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 * 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
2381 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2382 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
2383 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
2384 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2385 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2386
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2387 if (!valid_spelllang(*varp))
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2388 return e_invalid_argument;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2389
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2390 // 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
2391 // wordlists.
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 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
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
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 * 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
2397 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2398 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
2399 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
2400 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2401 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2402
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2403 if (**varp != NUL && STRCMP(*varp, "camel") != 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
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
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 * 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
2411 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2412 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
2413 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
2414 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2415 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
2416 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
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 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
2419 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2420 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2421
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2422 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2423 * 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
2424 */
31996
ca6bc7c04163 patch 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 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2426 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
2427 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2428 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
2429 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2430
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2431 #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
2432 /*
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2433 * 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
2434 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2435 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
2436 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
2437 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2438 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
2439 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2440 #endif
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2443 * 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
2444 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2445 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2446 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
2447 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2448 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
2449 }
ca6bc7c04163 patch 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
ca6bc7c04163 patch 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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2452 * 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
2453 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2454 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2455 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
2456 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2457 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
2458 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2459
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2460 #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
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 * 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
2463 */
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2464 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
2465 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
2466 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2467 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
2468 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2469 #endif
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2470
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2471 /*
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2472 * 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
2473 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2474 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
2475 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
2476 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2477 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
2478 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
2479
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2480 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
2481 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2482 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
2483 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
2484 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2485 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2486 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2487 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
2488 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
2489 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2490
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2491 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
2492 // 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
2493 *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
2494 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
2495 || 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
2496 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
2497
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2498 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
2499 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2500
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2501 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2502 * 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
2503 */
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2504 char *
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2505 did_set_term(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
2506 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2507 if (T_NAME[0] == NUL)
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2508 return e_cannot_set_term_to_empty_string;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2509 #ifdef FEAT_GUI
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2510 if (gui.in_use)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2511 return e_cannot_change_term_in_GUI;
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2512 if (term_is_gui(T_NAME))
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2513 return e_use_gui_to_start_GUI;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2514 #endif
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2515 if (set_termname(T_NAME) == FAIL)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2516 return e_not_found_in_termcap;
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2517
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2518 // Screen colors may have changed.
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2519 redraw_later_clear();
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2520
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2521 return NULL;
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2522 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2523
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 * 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
2526 */
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2527 char *
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2528 did_set_term_option(optset_T *args)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2529 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2530 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2531
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2532 if (!full_screen)
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2533 return NULL;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2534
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2535 // ":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
2536 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
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 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
2539
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2540 // 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
2541 // 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
2542 // 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
2543 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
2544 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2545 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
2546 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
2547 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2548 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
2549 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
2550 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2551 #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
2552 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
2553 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2554 swap_tcap();
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2555 args->os_did_swaptcap = TRUE;
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2556 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2557 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2558 // 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
2559 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
2560 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2561 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2562 ttest(FALSE);
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2563 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
2564 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2565 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
2566 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
2567 #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
2568 // 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
2569 // 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
2570 // 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
2571 # ifdef VIMDLL
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2572 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
2573 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2574 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
2575 #endif
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2576 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2577 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
2578 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2579 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
2580
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2581 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
2582 // 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
2583 // 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
2584 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
2585 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2586 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
2587 }
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2588
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2589 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
2590 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2591
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2592 #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
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 * 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
2595 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2596 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
2597 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
2598 {
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2599 if (*curwin->w_p_twk != NUL && string_to_key(curwin->w_p_twk, TRUE) == 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
2600 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
2601
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2602 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
2603 }
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 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2606 * 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
2607 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2608 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
2609 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
2610 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2611 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
2612
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2613 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
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
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2616 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
2617 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
2618 || (*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
2619 || *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
2620 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
2621
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2622 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
2623 }
32027
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2624
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2625 # 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
2626 /*
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2627 * 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
2628 */
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2629 char *
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2630 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
2631 {
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2632 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
2633 }
ef124f222fc2 patch 9.0.1345: too many "else if" statements for handling options
Bram Moolenaar <Bram@vim.org>
parents: 32009
diff changeset
2634 # 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
2635 #endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2636
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2637 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2638 * 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
2639 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2640 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2641 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
2642 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2643 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
2644
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2645 #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
2646 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
2647 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2648 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
2649 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2650
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2651 #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
2652 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2653 * 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
2654 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2655 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2656 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
2657 {
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2658 if (opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags,
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2659 TRUE) != OK)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2660 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
2661
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2662 out_flush();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2663 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
2664 (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
2665 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2666 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2667 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2668
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2669 #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
2670 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2671 * 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
2672 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2673 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2674 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
2675 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2676 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
2677 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
2678
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2679 out_flush();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2680 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
2681 (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
2682 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2683 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2684 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2685
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2686 #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
2687 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2688 * 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
2689 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2690 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2691 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
2692 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2693 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
2694
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2695 // 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
2696 // that.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2697 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
2698 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
2699 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
2700 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2701 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
2702 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
2703 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
2704
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2705 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2706 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2707 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2708
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2709 #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
2710 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2711 * 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
2712 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2713 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
2714 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
2715 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2716 char_u **varp = (char_u **)args->os_varp;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2717 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
2718
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2719 if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*varp)[1])))
32120
97255d909654 patch 9.0.1391: "clear" macros are not always used
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
2720 VIM_CLEAR(curbuf->b_p_vsts_array);
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 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2722 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2723 for (cp = *varp; *cp; ++cp)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2724 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2725 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
2726 continue;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2727 if (*cp == ',' && cp > *varp && *(cp-1) != ',')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2728 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2729 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
2730 }
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 int *oldarray = curbuf->b_p_vsts_array;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2733 if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)) == OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
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 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
2736 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
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 else
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 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
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 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
2743 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2744
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2745 /*
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2746 * 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
2747 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2748 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
2749 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
2750 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2751 char_u **varp = (char_u **)args->os_varp;
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2752 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
2753
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2754 if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*varp)[1])))
32120
97255d909654 patch 9.0.1391: "clear" macros are not always used
Bram Moolenaar <Bram@vim.org>
parents: 32096
diff changeset
2755 VIM_CLEAR(curbuf->b_p_vts_array);
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2756 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2757 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2758 for (cp = *varp; *cp; ++cp)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2759 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2760 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
2761 continue;
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2762 if (*cp == ',' && cp > *varp && *(cp-1) != ',')
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2763 continue;
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2764 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
2765 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2766
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2767 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
2768
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2769 if (tabstop_set(*varp, &(curbuf->b_p_vts_array)) == OK)
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2770 {
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2771 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
2772 # 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
2773 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
2774 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
2775 # endif
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2776 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2777 else
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2778 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
2779 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2780
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2781 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
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 #endif
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2786 * 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
2787 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2788 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2789 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
2790 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2791 verbose_stop();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2792 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
2793 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
2794
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 NULL;
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
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2798 #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
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 * 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
2801 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2802 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2803 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
2804 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2805 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
2806 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2807 #endif
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 #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
2810 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2811 * 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
2812 */
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
2813 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2814 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
2815 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2816 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
2817 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
2818
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2819 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
2820 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2821 // 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
2822 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
2823 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2824 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
2825 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2826 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2827 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
2828 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2829 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
2830 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2831 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
2832 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2833 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2834 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
2835 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2836 // optional number
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2837 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
2838 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2839 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2840 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
2841 ++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
2842 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
2843 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2844 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
2845 ;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2846
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2847 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
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 (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
2850 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2851 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
2852 _(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
2853 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
2854 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
2855 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2856 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2857 errmsg = "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2858 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2859 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2860 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2861 if (*s == ',')
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2862 ++s;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2863 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
2864 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2865 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
2866 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
2867 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2868 errmsg = "";
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2869 break;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2870 }
31859
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2871 }
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2872 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
2873 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
2874
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2875 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
2876 }
8b15e4161605 patch 9.0.1262: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31845
diff changeset
2877 #endif
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 /*
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2880 * 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
2881 */
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2882 char *
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2883 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
2884 {
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2885 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
2886 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
2887
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2888 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
2889 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2890 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
2891 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
2892 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2893
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2894 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
2895 // 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
2896 *flags = 0;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2897 else
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2898 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2899 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
2900 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
2901 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
2902 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2903 // 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
2904 // changes something.
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2905 validate_virtcol();
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2906 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
2907 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2908 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2909
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2910 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
2911 }
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2912
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 * 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
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 char *
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
2917 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
2918 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2919 char_u **varp = (char_u **)args->os_varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2920
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
2921 return did_set_option_listflag(*varp, (char_u *)WW_ALL, args->os_errbuf);
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2922 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2923
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2924 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2925 * 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
2926 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2927 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2928 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
2929 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2930 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
2931 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
2932 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2933 }
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 * 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
2937 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2938 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2939 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
2940 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2941 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
2942 }
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 #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
2945 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2946 * The '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
2947 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2948 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2949 did_set_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
2950 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2951 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
2952
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
2953 if (*p_wak == NUL || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
32070
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2954 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
2955 # 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
2956 # 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
2957 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
2958 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
2959 # 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
2960 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
2961 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
2962 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2963 # endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2964 return errmsg;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2965 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2966 #endif
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 /*
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2969 * 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
2970 */
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2971 char *
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2972 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
2973 {
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2974 #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
2975 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
2976 #endif
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2977 return NULL;
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2978 }
ef85a4440947 patch 9.0.1366: functions for setting options are in random order
Bram Moolenaar <Bram@vim.org>
parents: 32055
diff changeset
2979
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2980 #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
2981 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2982 * 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
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 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
2985 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
2986 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2987 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
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 ++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
2990 // 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
2991 // 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
2992 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
2993 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
2994 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
2995 --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
2996 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
2997 #endif
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 /*
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3000 * 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
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 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
3003 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
3004 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3005 // 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
3006 // 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
3007 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
3008 return;
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3009
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3010 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
3011 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
3012
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3013 // 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
3014 // 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
3015 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
3016
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3017 ++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
3018 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
3019 // 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
3020 // 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
3021 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
3022 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
3023 --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
3024 // 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
3025 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
3026 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
3027
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3028 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
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
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3031 #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
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 * 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
3034 * 'runtimepath'.
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3035 */
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3036 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
3037 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
3038 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3039 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
3040 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
3041 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
3042
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3043 // 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
3044 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
3045 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
3046
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3047 // 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
3048 // 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
3049 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
3050 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
3051 break;
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 (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
3053 {
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3054 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
3055 (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
3056 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
3057 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3058 }
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3059 #endif
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 /*
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3062 * 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
3063 * 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
3064 * 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
3065 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3066 char *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3067 did_set_string_option(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3068 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
3069 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
3070 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
3071 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
3072 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
3073 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
3074 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
3075 // 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
3076 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3077 char *errmsg = NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3078 long_u free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3079 opt_did_set_cb_T did_set_cb = get_option_did_set_cb(opt_idx);
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3080 optset_T args;
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3081
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3082 // 'ttytype' is an alias for 'term'. Both 'term' and 'ttytype' point to
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3083 // T_NAME. If 'term' or 'ttytype' is modified, then use the index for the
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3084 // 'term' option. Only set the P_ALLOCED flag on 'term'.
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3085 if (varp == &T_NAME)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3086 {
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3087 opt_idx = findoption((char_u *)"term");
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3088 if (opt_idx >= 0)
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3089 {
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3090 free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3091 did_set_cb = get_option_did_set_cb(opt_idx);
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3092 }
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3093 }
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3094
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3095 CLEAR_FIELD(args);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3096
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3097 // 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
3098 if ((secure
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3099 #ifdef HAVE_SANDBOX
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3100 || sandbox != 0
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3101 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3102 ) && (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
3103 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
3104 // 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
3105 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
3106 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
3107 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
3108 {
32086
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3109 args.os_varp = (char_u *)varp;
45142117e206 patch 9.0.1374: function for setting options not used consistently
Bram Moolenaar <Bram@vim.org>
parents: 32076
diff changeset
3110 args.os_idx = opt_idx;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3111 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
3112 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
3113 args.os_newval.string = value;
32043
6095218c9056 patch 9.0.1353: too many "else if" statements to handle option values
Bram Moolenaar <Bram@vim.org>
parents: 32027
diff changeset
3114 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
3115 // 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
3116 // 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
3117 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
3118
8a3f659c7b5e patch 9.0.1359: too many "else if" statements in handling options
Bram Moolenaar <Bram@vim.org>
parents: 32043
diff changeset
3119 // 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
3120 // 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
3121 *value_checked = args.os_value_checked;
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3122 }
26268
3aa48d4e3dc8 patch 8.2.3665: cannot use a lambda for 'tagfunc'
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
3123
31869
f5bbf51d65f7 patch 9.0.1267: the did_set_string_option function is too long
Bram Moolenaar <Bram@vim.org>
parents: 31863
diff changeset
3124 // 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
3125 if (errmsg != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3126 {
29509
d61007cc39b3 patch 9.0.0096: flag "new_value_alloced" is always true
Bram Moolenaar <Bram@vim.org>
parents: 29395
diff changeset
3127 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
3128 *varp = oldval;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3129 // When resetting some values, need to act on it.
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3130 if (args.os_restore_chartab)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3131 (void)init_chartab();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3132 if (varp == &p_hl)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3133 (void)highlight_changed();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3134 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3135 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3136 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3137 #ifdef FEAT_EVAL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3138 // 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
3139 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
3140 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3141 // 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
3142 // 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
3143 // 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
3144 if (free_oldval)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3145 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
3146 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
3147
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3148 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
3149 && 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
3150 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3151 // 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
3152 // 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
3153 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
3154 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
3155 *(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
3156 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3157
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3158 // 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
3159 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
3160 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
3161
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3162 // 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
3163 #ifdef FEAT_SYN_HL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3164 if (varp == &(curbuf->b_p_syn))
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3165 do_syntax_autocmd(args.os_value_changed);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3166 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3167 else if (varp == &(curbuf->b_p_ft))
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3168 do_filetype_autocmd(varp, opt_flags, args.os_value_changed);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3169 #ifdef FEAT_SPELL
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3170 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
3171 do_spelllang_source();
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3172 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3173 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3174
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3175 if (varp == &p_mouse)
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 if (*p_mouse == NUL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3178 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
3179 else
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3180 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
3181 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3182
20609
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3183 #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
3184 if (varp == &p_rtp)
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3185 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
3186 #endif
054ba681412d patch 8.2.0858: not easy to require Lua modules
Bram Moolenaar <Bram@vim.org>
parents: 20415
diff changeset
3187
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
3188 #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
3189 // 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
3190 // 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
3191 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
3192 && 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
3193 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
3194 #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
3195
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3196 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
3197 && (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
3198 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
3199
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3200 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
3201 {
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3202 #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
3203 // 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
3204 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
3205
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3206 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
3207 || 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
3208 # 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
3209 || 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
3210 || 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
3211 # 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
3212 # 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
3213 || 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
3214 # 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
3215 || 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
3216 # 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
3217 || 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
3218 # 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
3219 )
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3220 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
3221
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3222 // 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
3223 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
3224 #endif
24079
a9ff8368d35f patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
3225 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
3226 }
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3227
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3228 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
32096
e7ab58f57ea3 patch 9.0.1379: functions for handling options are not ordered
Bram Moolenaar <Bram@vim.org>
parents: 32086
diff changeset
3229 if (args.os_did_swaptcap)
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3230 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3231 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
3232 init_highlight(TRUE, FALSE);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3233 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3234 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3235
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3236 return errmsg;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3237 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3238
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3239 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3240 * 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
3241 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3242 * 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
3243 * Empty is always OK.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3244 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3245 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3246 check_opt_strings(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3247 char_u *val,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3248 char **values,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3249 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
3250 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3251 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
3252 }
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 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3255 * 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
3256 * 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
3257 *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3258 * 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
3259 * Empty is always OK.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3260 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3261 static int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3262 opt_strings_flags(
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3263 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
3264 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
3265 unsigned *flagp,
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3266 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
3267 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3268 int i;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3269 int len;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3270 unsigned new_flags = 0;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3271
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3272 while (*val)
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 for (i = 0; ; ++i)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3275 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3276 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
3277 return FAIL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3278
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3279 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
3280 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
3281 && ((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
3282 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3283 val += len + (val[len] == ',');
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3284 new_flags |= (1 << i);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3285 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
3286 }
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 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3289 if (flagp != NULL)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3290 *flagp = new_flags;
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 return OK;
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
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 * 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
3297 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3298 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3299 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
3300 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3301 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
3302 }
31463
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3303
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3304 /*
31996
ca6bc7c04163 patch 9.0.1330: handling new value of an option has a long "else if" chain
Bram Moolenaar <Bram@vim.org>
parents: 31962
diff changeset
3305 * 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
3306 * 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
3307 *
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3308 * 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
3309 * 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
3310 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3311 void
32009
4545f58c8490 patch 9.0.1336: functions without arguments are not always declared properly
Bram Moolenaar <Bram@vim.org>
parents: 31996
diff changeset
3312 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
3313 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3314 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
3315 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3316 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
3317 return;
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3318 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3319
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3320 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
3321 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3322 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
3323 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
3324 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3325 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3326
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 * 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
3329 */
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3330 void
32009
4545f58c8490 patch 9.0.1336: functions without arguments are not always declared properly
Bram Moolenaar <Bram@vim.org>
parents: 31996
diff changeset
3331 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
3332 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3333 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
3334 {
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3335 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
3336 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
3337 }
db72745d328c patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Bram Moolenaar <Bram@vim.org>
parents: 31457
diff changeset
3338 }