annotate src/optionstr.c @ 33420:aa7cd2253130 v9.0.1968

patch 9.0.1968: cmdline completion should consider key option Commit: https://github.com/vim/vim/commit/6ee7b521fa7531ef356ececc8be7575c3800f872 Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Sun Oct 1 09:13:22 2023 +0200 patch 9.0.1968: cmdline completion should consider key option Problem: cmdline completion should consider key option Solution: Disable cmdline completion for key option, slightly refactor how P_NO_CMD_EXPAND is handled Harden crypto 'key' option: turn off cmdline completion, disable set-= "set-=" can be used maliciously with a crypto key, as it allows an attacker (who either has access to the computer or a plugin author) to guess a substring by observing the modified state. Simply turn off set+=/-=/^= for this option as there is no good reason for them to be used. Update docs to make that clear as well. Also, don't allow cmdline completion for 'key' as it just shows ***** which is not useful and confusing to the user what it means (if the user accidentally hits enter they will have replaced their key with "*****" instead). Move logic to better location, don't use above 32-bit for flags Move P_NO_CMD_EXPAND to use the unused 0x20 instead of going above 32-bits, as currently the flags parameter is only 32-bits on some systems. Left a comment to warn that future additions will need to change how the flags work either by making it 64-bit or split into two member vars. Also, move the logic for detecting P_NO_CMD_EXPAND earlier so it's not up to each handler to decide, and you won't see the temporary "..." that Vim shows while waiting for completion handler to complete. closes: #13224 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 01 Oct 2023 09:30:03 +0200
parents 9b35b4c6df4c
children 18f4a04384f3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2 *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4 *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
7 * See README.txt for an overview of the Vim source code.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
8 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
9
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
10 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
11 * optionstr.c: Functions related to string options
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
12 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
13
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
14 #include "vim.h"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
15
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
16 static char_u shm_buf[SHM_LEN];
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
17 static int set_shm_recursive = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
18
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
19 static char *(p_ambw_values[]) = {"single", "double", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
20 static char *(p_bg_values[]) = {"light", "dark", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
21 static char *(p_bkc_values[]) = {"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
22 static char *(p_bo_values[]) = {"all", "backspace", "cursor", "complete",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
23 "copy", "ctrlg", "error", "esc", "ex",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
24 "hangul", "insertmode", "lang", "mess",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
25 "showmatch", "operator", "register", "shell",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
26 "spell", "term", "wildmode", NULL};
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
27 #if defined(FEAT_LINEBREAK)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
28 // Note: Keep this in sync with briopt_check()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
29 static char *(p_briopt_values[]) = {"shift:", "min:", "sbr", "list:", "column:", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
30 #endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
31 #if defined(FEAT_DIFF)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
32 // Note: Keep this in sync with diffopt_changed()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
33 static char *(p_dip_values[]) = {"filler", "context:", "iblank", "icase", "iwhite", "iwhiteall", "iwhiteeol", "horizontal", "vertical", "closeoff", "hiddenoff", "foldcolumn:", "followwrap", "internal", "indent-heuristic", "algorithm:", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
34 static char *(p_dip_algorithm_values[]) = {"myers", "minimal", "patience", "histogram", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
35 #endif
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
36 static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", "unsigned", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
37 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
38 #ifdef FEAT_CLIPBOARD
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
39 // Note: Keep this in sync with did_set_clipboard()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
40 static char *(p_cb_values[]) = {"unnamed", "unnamedplus", "autoselect", "autoselectplus", "autoselectml", "html", "exclude:", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
41 #endif
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
42 #ifdef FEAT_CRYPT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
43 static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
44 # ifdef FEAT_SODIUM
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
45 "xchacha20", "xchacha20v2",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
46 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
47 NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
48 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
49 static char *(p_cmp_values[]) = {"internal", "keepascii", NULL};
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
50 #ifdef FEAT_SYN_HL
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
51 // Note: Keep this in sync with fill_culopt_flags()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
52 static char *(p_culopt_values[]) = {"line", "screenline", "number", "both", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
53 #endif
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
54 static char *(p_dy_values[]) = {"lastline", "truncate", "uhex", NULL};
33311
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
55 static char *(p_jop_values[]) = {"stack", NULL};
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
56 #ifdef FEAT_FOLDING
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
57 static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
58 "quickfix", "search", "tag", "insert",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
59 "undo", "jump", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
60 #endif
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
61 // Note: Keep this in sync with match_keyprotocol()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
62 static char *(p_kpc_protocol_values[]) = {"none", "mok2", "kitty", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
63 #ifdef FEAT_PROP_POPUP
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
64 // Note: Keep this in sync with parse_popup_option()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
65 static char *(p_popup_option_values[]) = {"height:", "width:", "highlight:", "border:", "align:", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
66 static char *(p_popup_option_border_values[]) = {"on", "off", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
67 static char *(p_popup_option_align_values[]) = {"item", "menu", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
68 #endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
69 #if defined(FEAT_SPELL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
70 // Note: Keep this in sync with spell_check_sps()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
71 static char *(p_sps_values[]) = {"best", "fast", "double", "expr:", "file:", "timeout:", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
72 #endif
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
73 #ifdef FEAT_SESSION
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
74 // Also used for 'viewoptions'! Keep in sync with SSOP_ flags.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
75 static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
76 "localoptions", "options", "help", "blank", "globals", "slash", "unix",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
77 "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", "skiprtp",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
78 NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
79 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
80 // Keep in sync with SWB_ flags in option.h
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
81 static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", "vsplit", "uselast", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
82 static char *(p_spk_values[]) = {"cursor", "screen", "topline", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
83 static char *(p_tc_values[]) = {"followic", "ignore", "match", "followscs", "smart", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
84 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
85 static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
86 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
87 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
88 static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", "huge", "giant", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
89 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
90 #if defined(UNIX) || defined(VMS)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
91 static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", "sgr", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
92 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
93 static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", "none", "NONE", NULL};
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
94 // Note: Keep this in sync with check_opt_wim()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
95 static char *(p_wim_values[]) = {"full", "longest", "list", "lastused", NULL};
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
96 static char *(p_wop_values[]) = {"fuzzy", "tagfile", "pum", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
97 #ifdef FEAT_WAK
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
98 static char *(p_wak_values[]) = {"yes", "menu", "no", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
99 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
100 static char *(p_mousem_values[]) = {"extend", "popup", "popup_setpos", "mac", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
101 static char *(p_sel_values[]) = {"inclusive", "exclusive", "old", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
102 static char *(p_slm_values[]) = {"mouse", "key", "cmd", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
103 static char *(p_km_values[]) = {"startsel", "stopsel", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
104 #ifdef FEAT_BROWSE
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
105 static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
106 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
107 static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
108 static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
109 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
110 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", "prompt", "popup", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
111 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
112 static char *(p_bs_values[]) = {"indent", "eol", "start", "nostop", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
113 #ifdef FEAT_FOLDING
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
114 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
115 # ifdef FEAT_DIFF
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
116 "diff",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
117 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
118 NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
119 static char *(p_fcl_values[]) = {"all", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
120 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
121 static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "popup", "popuphidden", "noinsert", "noselect", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
122 #ifdef BACKSLASH_IN_FILENAME
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
123 static char *(p_csl_values[]) = {"slash", "backslash", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
124 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
125 #ifdef FEAT_SIGNS
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
126 static char *(p_scl_values[]) = {"yes", "no", "auto", "number", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
127 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
128 #if defined(MSWIN) && defined(FEAT_TERMINAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
129 static char *(p_twt_values[]) = {"winpty", "conpty", "", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
130 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
131 static char *(p_sloc_values[]) = {"last", "statusline", "tabline", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
132 static char *(p_sws_values[]) = {"fsync", "sync", NULL};
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
133
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
134 static int check_opt_strings(char_u *val, char **values, int list);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
135 static int opt_strings_flags(char_u *val, char **values, unsigned *flagp, int list);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
136
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
137 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
138 * After setting various option values: recompute variables that depend on
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
139 * option values.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
140 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
141 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
142 didset_string_options(void)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
143 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
144 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
145 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
146 (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
147 #ifdef FEAT_SESSION
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
148 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
149 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
150 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
151 #ifdef FEAT_FOLDING
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
152 (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
153 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
154 (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
33311
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
155 (void)opt_strings_flags(p_jop, p_jop_values, &jop_flags, TRUE);
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
156 (void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
157 (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
158 #if defined(UNIX) || defined(VMS)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
159 (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
160 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
161 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
162 (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
163 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
164 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
165 (void)opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
166 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
167 (void)opt_strings_flags(p_swb, p_swb_values, &swb_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
168 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
169
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
170 #if defined(FEAT_EVAL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
171 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
172 * Trigger the OptionSet autocommand.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
173 * "opt_idx" is the index of the option being set.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
174 * "opt_flags" can be OPT_LOCAL etc.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
175 * "oldval" the old value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
176 * "oldval_l" the old local value (only non-NULL if global and local value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
177 * are set)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
178 * "oldval_g" the old global value (only non-NULL if global and local value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
179 * are set)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
180 * "newval" the new value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
181 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
182 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
183 trigger_optionset_string(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
184 int opt_idx,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
185 int opt_flags,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
186 char_u *oldval,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
187 char_u *oldval_l,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
188 char_u *oldval_g,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
189 char_u *newval)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
190 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
191 // Don't do this recursively.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
192 if (oldval == NULL || newval == NULL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
193 || *get_vim_var_str(VV_OPTION_TYPE) != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
194 return;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
195
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
196 char_u buf_type[7];
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
197
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
198 sprintf((char *)buf_type, "%s",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
199 (opt_flags & OPT_LOCAL) ? "local" : "global");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
200 set_vim_var_string(VV_OPTION_OLD, oldval, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
201 set_vim_var_string(VV_OPTION_NEW, newval, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
202 set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
203 if (opt_flags & OPT_LOCAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
204 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
205 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
206 set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
207 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
208 if (opt_flags & OPT_GLOBAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
209 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
210 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
211 set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
212 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
213 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
214 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
215 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
216 set_vim_var_string(VV_OPTION_OLDLOCAL, oldval_l, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
217 set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval_g, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
218 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
219 if (opt_flags & OPT_MODELINE)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
220 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
221 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
222 set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, -1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
223 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
224 apply_autocmds(EVENT_OPTIONSET,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
225 get_option_fullname(opt_idx), NULL, FALSE,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
226 NULL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
227 reset_v_option_vars();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
228 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
229 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
230
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
231 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
232 illegal_char(char *errbuf, int c)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
233 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
234 if (errbuf == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
235 return "";
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
236 sprintf((char *)errbuf, _(e_illegal_character_str), (char *)transchar(c));
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
237 return errbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
238 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
239
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
240 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
241 * Check string options in a buffer for NULL value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
242 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
243 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
244 check_buf_options(buf_T *buf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
245 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
246 check_string_option(&buf->b_p_bh);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
247 check_string_option(&buf->b_p_bt);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
248 check_string_option(&buf->b_p_fenc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
249 check_string_option(&buf->b_p_ff);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
250 #ifdef FEAT_FIND_ID
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
251 check_string_option(&buf->b_p_def);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
252 check_string_option(&buf->b_p_inc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
253 # ifdef FEAT_EVAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
254 check_string_option(&buf->b_p_inex);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
255 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
256 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
257 #if defined(FEAT_EVAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
258 check_string_option(&buf->b_p_inde);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
259 check_string_option(&buf->b_p_indk);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
260 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
261 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
262 check_string_option(&buf->b_p_bexpr);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
263 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
264 #if defined(FEAT_CRYPT)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
265 check_string_option(&buf->b_p_cm);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
266 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
267 check_string_option(&buf->b_p_fp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
268 #if defined(FEAT_EVAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
269 check_string_option(&buf->b_p_fex);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
270 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
271 #ifdef FEAT_CRYPT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
272 check_string_option(&buf->b_p_key);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
273 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
274 check_string_option(&buf->b_p_kp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
275 check_string_option(&buf->b_p_mps);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
276 check_string_option(&buf->b_p_fo);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
277 check_string_option(&buf->b_p_flp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
278 check_string_option(&buf->b_p_isk);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
279 check_string_option(&buf->b_p_com);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
280 #ifdef FEAT_FOLDING
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
281 check_string_option(&buf->b_p_cms);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
282 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
283 check_string_option(&buf->b_p_nf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
284 check_string_option(&buf->b_p_qe);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
285 #ifdef FEAT_SYN_HL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
286 check_string_option(&buf->b_p_syn);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
287 check_string_option(&buf->b_s.b_syn_isk);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
288 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
289 #ifdef FEAT_SPELL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
290 check_string_option(&buf->b_s.b_p_spc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
291 check_string_option(&buf->b_s.b_p_spf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
292 check_string_option(&buf->b_s.b_p_spl);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
293 check_string_option(&buf->b_s.b_p_spo);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
294 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
295 check_string_option(&buf->b_p_sua);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
296 check_string_option(&buf->b_p_cink);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
297 check_string_option(&buf->b_p_cino);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
298 check_string_option(&buf->b_p_cinsd);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
299 parse_cino(buf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
300 check_string_option(&buf->b_p_lop);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
301 check_string_option(&buf->b_p_ft);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
302 check_string_option(&buf->b_p_cinw);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
303 check_string_option(&buf->b_p_cpt);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
304 #ifdef FEAT_COMPL_FUNC
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
305 check_string_option(&buf->b_p_cfu);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
306 check_string_option(&buf->b_p_ofu);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
307 check_string_option(&buf->b_p_tsrfu);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
308 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
309 #ifdef FEAT_EVAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
310 check_string_option(&buf->b_p_tfu);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
311 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
312 #ifdef FEAT_KEYMAP
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
313 check_string_option(&buf->b_p_keymap);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
314 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
315 #ifdef FEAT_QUICKFIX
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
316 check_string_option(&buf->b_p_gp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
317 check_string_option(&buf->b_p_mp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
318 check_string_option(&buf->b_p_efm);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
319 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
320 check_string_option(&buf->b_p_ep);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
321 check_string_option(&buf->b_p_path);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
322 check_string_option(&buf->b_p_tags);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
323 check_string_option(&buf->b_p_tc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
324 check_string_option(&buf->b_p_dict);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
325 check_string_option(&buf->b_p_tsr);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
326 check_string_option(&buf->b_p_lw);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
327 check_string_option(&buf->b_p_bkc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
328 check_string_option(&buf->b_p_menc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
329 #ifdef FEAT_VARTABS
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
330 check_string_option(&buf->b_p_vsts);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
331 check_string_option(&buf->b_p_vts);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
332 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
333 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
334
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
335 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
336 * Free the string allocated for an option.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
337 * Checks for the string being empty_option. This may happen if we're out of
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
338 * memory, vim_strsave() returned NULL, which was replaced by empty_option by
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
339 * check_options().
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
340 * Does NOT check for P_ALLOCED flag!
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
341 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
342 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
343 free_string_option(char_u *p)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
344 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
345 if (p != empty_option)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
346 vim_free(p);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
347 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
348
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
349 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
350 clear_string_option(char_u **pp)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
351 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
352 if (*pp != empty_option)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
353 vim_free(*pp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
354 *pp = empty_option;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
355 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
356
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
357 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
358 check_string_option(char_u **pp)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
359 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
360 if (*pp == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
361 *pp = empty_option;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
362 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
363
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
364 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
365 * Set global value for string option when it's a local option.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
366 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
367 static void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
368 set_string_option_global(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
369 int opt_idx, // option index
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
370 char_u **varp) // pointer to option variable
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
371 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
372 char_u **p, *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
373
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
374 // the global value is always allocated
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
375 if (is_window_local_option(opt_idx))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
376 p = (char_u **)GLOBAL_WO(varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
377 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
378 p = (char_u **)get_option_var(opt_idx);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
379 if (!is_global_option(opt_idx)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
380 && p != varp
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
381 && (s = vim_strsave(*varp)) != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
382 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
383 free_string_option(*p);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
384 *p = s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
385 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
386 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
387
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
388 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
389 * Set a string option to a new value (without checking the effect).
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
390 * The string is copied into allocated memory.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
391 * if ("opt_idx" == -1) "name" is used, otherwise "opt_idx" is used.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
392 * When "set_sid" is zero set the scriptID to current_sctx.sc_sid. When
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
393 * "set_sid" is SID_NONE don't set the scriptID. Otherwise set the scriptID to
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
394 * "set_sid".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
395 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
396 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
397 set_string_option_direct(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
398 char_u *name,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
399 int opt_idx,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
400 char_u *val,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
401 int opt_flags, // OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
402 int set_sid UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
403 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
404 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
405 char_u **varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
406 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
407 int idx = opt_idx;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
408
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
409 if (idx == -1) // use name
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
410 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
411 idx = findoption(name);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
412 if (idx < 0) // not found (should not happen)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
413 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
414 semsg(_(e_internal_error_str), "set_string_option_direct()");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
415 siemsg("For option %s", name);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
416 return;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
417 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
418 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
419
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
420 if (is_hidden_option(idx)) // can't set hidden option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
421 return;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
422
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
423 s = vim_strsave(val);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
424 if (s == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
425 return;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
426
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
427 varp = (char_u **)get_option_varp_scope(idx,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
428 both ? OPT_LOCAL : opt_flags);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
429 if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
430 free_string_option(*varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
431 *varp = s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
432
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
433 // For buffer/window local option may also set the global value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
434 if (both)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
435 set_string_option_global(idx, varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
436
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
437 set_option_flag(idx, P_ALLOCED);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
438
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
439 // When setting both values of a global option with a local value,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
440 // make the local value empty, so that the global value is used.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
441 if (is_global_local_option(idx) && both)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
442 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
443 free_string_option(*varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
444 *varp = empty_option;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
445 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
446 # ifdef FEAT_EVAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
447 if (set_sid != SID_NONE)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
448 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
449 sctx_T script_ctx;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
450
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
451 if (set_sid == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
452 script_ctx = current_sctx;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
453 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
454 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
455 script_ctx.sc_sid = set_sid;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
456 script_ctx.sc_seq = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
457 script_ctx.sc_lnum = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
458 script_ctx.sc_version = 1;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
459 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
460 set_option_sctx_idx(idx, opt_flags, script_ctx);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
461 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
462 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
463 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
464
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
465 #if defined(FEAT_PROP_POPUP) || \
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
466 (defined(FEAT_DIFF) && defined(FEAT_FOLDING)) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
467 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
468 * Like set_string_option_direct(), but for a window-local option in "wp".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
469 * Blocks autocommands to avoid the old curwin becoming invalid.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
470 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
471 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
472 set_string_option_direct_in_win(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
473 win_T *wp,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
474 char_u *name,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
475 int opt_idx,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
476 char_u *val,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
477 int opt_flags,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
478 int set_sid)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
479 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
480 win_T *save_curwin = curwin;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
481
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
482 block_autocmds();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
483 curwin = wp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
484 curbuf = curwin->w_buffer;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
485 set_string_option_direct(name, opt_idx, val, opt_flags, set_sid);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
486 curwin = save_curwin;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
487 curbuf = curwin->w_buffer;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
488 unblock_autocmds();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
489 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
490 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
491
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
492 #if defined(FEAT_PROP_POPUP) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
493 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
494 * Like set_string_option_direct(), but for a buffer-local option in "buf".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
495 * Blocks autocommands to avoid the old curbuf becoming invalid.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
496 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
497 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
498 set_string_option_direct_in_buf(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
499 buf_T *buf,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
500 char_u *name,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
501 int opt_idx,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
502 char_u *val,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
503 int opt_flags,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
504 int set_sid)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
505 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
506 buf_T *save_curbuf = curbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
507
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
508 block_autocmds();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
509 curbuf = buf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
510 curwin->w_buffer = curbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
511 set_string_option_direct(name, opt_idx, val, opt_flags, set_sid);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
512 curbuf = save_curbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
513 curwin->w_buffer = curbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
514 unblock_autocmds();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
515 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
516 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
517
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
518 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
519 * Set a string option to a new value, and handle the effects.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
520 *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
521 * Returns NULL on success or an untranslated error message on error.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
522 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
523 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
524 set_string_option(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
525 int opt_idx,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
526 char_u *value,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
527 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
528 char *errbuf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
529 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
530 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
531 char_u **varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
532 char_u *oldval;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
533 #if defined(FEAT_EVAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
534 char_u *oldval_l = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
535 char_u *oldval_g = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
536 char_u *saved_oldval = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
537 char_u *saved_oldval_l = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
538 char_u *saved_oldval_g = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
539 char_u *saved_newval = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
540 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
541 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
542 int value_checked = FALSE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
543
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
544 if (is_hidden_option(opt_idx)) // don't set hidden option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
545 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
546
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
547 s = vim_strsave(value == NULL ? (char_u *)"" : value);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
548 if (s == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
549 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
550
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
551 varp = (char_u **)get_option_varp_scope(opt_idx,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
552 (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
553 ? (is_global_local_option(opt_idx)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
554 ? OPT_GLOBAL : OPT_LOCAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
555 : opt_flags);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
556 oldval = *varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
557 #if defined(FEAT_EVAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
558 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
559 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
560 oldval_l = *(char_u **)get_option_varp_scope(opt_idx, OPT_LOCAL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
561 oldval_g = *(char_u **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
562 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
563 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
564 *varp = s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
565
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
566 #if defined(FEAT_EVAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
567 if (!starting
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
568 # ifdef FEAT_CRYPT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
569 && !is_crypt_key_option(opt_idx)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
570 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
571 )
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
572 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
573 if (oldval_l != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
574 saved_oldval_l = vim_strsave(oldval_l);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
575 if (oldval_g != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
576 saved_oldval_g = vim_strsave(oldval_g);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
577 saved_oldval = vim_strsave(oldval);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
578 saved_newval = vim_strsave(s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
579 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
580 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
581 if ((errmsg = did_set_string_option(opt_idx, varp, oldval, value, errbuf,
33420
aa7cd2253130 patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents: 33404
diff changeset
582 opt_flags, OP_NONE, &value_checked)) == NULL)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
583 did_set_option(opt_idx, opt_flags, TRUE, value_checked);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
584
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
585 #if defined(FEAT_EVAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
586 // call autocommand after handling side effects
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
587 if (errmsg == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
588 trigger_optionset_string(opt_idx, opt_flags,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
589 saved_oldval, saved_oldval_l,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
590 saved_oldval_g, saved_newval);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
591 vim_free(saved_oldval);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
592 vim_free(saved_oldval_l);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
593 vim_free(saved_oldval_g);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
594 vim_free(saved_newval);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
595 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
596 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
597 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
598
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
599 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
600 * Return TRUE if "val" is a valid 'filetype' name.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
601 * Also used for 'syntax' and 'keymap'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
602 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
603 static int
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
604 valid_filetype(char_u *val)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
605 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
606 return valid_name(val, ".-_");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
607 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
608
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
609 #ifdef FEAT_STL_OPT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
610 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
611 * Check validity of options with the 'statusline' format.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
612 * Return an untranslated error message or NULL.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
613 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
614 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
615 check_stl_option(char_u *s)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
616 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
617 int groupdepth = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
618 static char errbuf[80];
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
619
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
620 while (*s)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
621 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
622 // Check for valid keys after % sequences
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
623 while (*s && *s != '%')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
624 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
625 if (!*s)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
626 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
627 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
628 if (*s == '%' || *s == STL_TRUNCMARK || *s == STL_SEPARATE)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
629 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
630 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
631 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
632 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
633 if (*s == ')')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
634 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
635 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
636 if (--groupdepth < 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
637 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
638 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
639 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
640 if (*s == '-')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
641 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
642 while (VIM_ISDIGIT(*s))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
643 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
644 if (*s == STL_USER_HL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
645 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
646 if (*s == '.')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
647 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
648 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
649 while (*s && VIM_ISDIGIT(*s))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
650 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
651 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
652 if (*s == '(')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
653 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
654 groupdepth++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
655 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
656 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
657 if (vim_strchr(STL_ALL, *s) == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
658 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
659 return illegal_char(errbuf, *s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
660 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
661 if (*s == '{')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
662 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
663 int reevaluate = (*++s == '%');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
664
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
665 if (reevaluate && *++s == '}')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
666 // "}" is not allowed immediately after "%{%"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
667 return illegal_char(errbuf, '}');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
668 while ((*s != '}' || (reevaluate && s[-1] != '%')) && *s)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
669 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
670 if (*s != '}')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
671 return e_unclosed_expression_sequence;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
672 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
673 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
674 if (groupdepth != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
675 return e_unbalanced_groups;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
676 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
677 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
678 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
679
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
680 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
681 * Check for a "normal" directory or file name in some options. Disallow a
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
682 * path separator (slash and/or backslash), wildcards and characters that are
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
683 * often illegal in a file name. Be more permissive if "secure" is off.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
684 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
685 static int
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
686 check_illegal_path_names(int opt_idx, char_u **varp)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
687 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
688 return (((get_option_flags(opt_idx) & P_NFNAME)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
689 && vim_strpbrk(*varp, (char_u *)(secure
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
690 ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
691 || ((get_option_flags(opt_idx) & P_NDNAME)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
692 && vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL));
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
693 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
694
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
695 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
696 * An option that accepts a list of flags is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
697 * e.g. 'viewoptions', 'switchbuf', 'casemap', etc.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
698 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
699 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
700 did_set_opt_flags(char_u *val, char **values, unsigned *flagp, int list)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
701 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
702 if (opt_strings_flags(val, values, flagp, list) == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
703 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
704
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
705 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
706 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
707
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
708 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
709 * An option that accepts a list of string values is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
710 * e.g. 'nrformats', 'scrollopt', 'wildoptions', etc.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
711 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
712 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
713 did_set_opt_strings(char_u *val, char **values, int list)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
714 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
715 return did_set_opt_flags(val, values, NULL, list);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
716 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
717
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
718 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
719 * An option which is a list of flags is set. Valid values are in 'flags'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
720 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
721 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
722 did_set_option_listflag(char_u *val, char_u *flags, char *errbuf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
723 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
724 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
725
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
726 for (s = val; *s; ++s)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
727 if (vim_strchr(flags, *s) == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
728 return illegal_char(errbuf, *s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
729
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
730 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
731 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
732
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
733 /*
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
734 * Expand an option that accepts a list of string values.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
735 */
33404
9b35b4c6df4c patch 9.0.1960: Make CI checks more strict
Christian Brabandt <cb@256bit.org>
parents: 33399
diff changeset
736 static int
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
737 expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
738 optexpand_T *args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
739 char **values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
740 int numValues,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
741 int *numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
742 char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
743 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
744 char_u *p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
745 regmatch_T *regmatch = args->oe_regmatch;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
746 int include_orig_val = args->oe_include_orig_val;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
747 char_u *option_val = args->oe_opt_value;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
748
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
749 // Assume numValues is small since they are fixed enums, so just allocate
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
750 // upfront instead of needing two passes to calculate output size.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
751 *matches = ALLOC_MULT(char_u *, numValues + 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
752 if (*matches == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
753 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
754
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
755 int count = 0;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
756
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
757 if (include_orig_val && *option_val != NUL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
758 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
759 p = vim_strsave(option_val);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
760 if (p == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
761 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
762 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
763 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
764 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
765 (*matches)[count++] = p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
766 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
767
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
768 for (char **val = values; *val != NULL; val++)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
769 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
770 if (include_orig_val && *option_val != NUL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
771 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
772 if (STRCMP((char_u*)*val, option_val) == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
773 continue;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
774 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
775 if (vim_regexec(regmatch, (char_u*)(*val), (colnr_T)0))
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
776 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
777 p = vim_strsave((char_u*)*val);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
778 if (p == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
779 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
780 if (count == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
781 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
782 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
783 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
784 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
785 else
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
786 break;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
787 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
788 (*matches)[count++] = p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
789 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
790 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
791 if (count == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
792 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
793 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
794 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
795 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
796 *numMatches = count;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
797 return OK;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
798 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
799
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
800 static char_u *set_opt_callback_orig_option = NULL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
801 static char_u *((*set_opt_callback_func)(expand_T *, int));
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
802
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
803 /*
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
804 * Callback used by expand_set_opt_generic to also include the original value.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
805 */
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
806 static char_u *
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
807 expand_set_opt_callback(expand_T *xp, int idx)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
808 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
809 if (idx == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
810 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
811 if (set_opt_callback_orig_option != NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
812 return set_opt_callback_orig_option;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
813 else
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
814 return (char_u *)""; // empty strings are ignored
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
815 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
816 return set_opt_callback_func(xp, idx - 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
817 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
818
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
819 /*
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
820 * Expand an option with a callback that iterates through a list of possible names.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
821 */
33404
9b35b4c6df4c patch 9.0.1960: Make CI checks more strict
Christian Brabandt <cb@256bit.org>
parents: 33399
diff changeset
822 static int
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
823 expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
824 optexpand_T *args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
825 char_u *((*func)(expand_T *, int)),
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
826 int *numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
827 char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
828 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
829 int ret;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
830
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
831 set_opt_callback_orig_option = args->oe_include_orig_val ?
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
832 args->oe_opt_value : NULL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
833 set_opt_callback_func = func;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
834
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
835 ret = ExpandGeneric(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
836 (char_u*)"", // not using fuzzy as currently EXPAND_STRING_SETTING doesn't use it
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
837 args->oe_xp,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
838 args->oe_regmatch,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
839 matches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
840 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
841 expand_set_opt_callback,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
842 FALSE);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
843
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
844 set_opt_callback_orig_option = NULL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
845 set_opt_callback_func = NULL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
846 return ret;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
847 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
848
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
849
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
850 /*
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
851 * Expand an option which is a list of flags.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
852 */
33404
9b35b4c6df4c patch 9.0.1960: Make CI checks more strict
Christian Brabandt <cb@256bit.org>
parents: 33399
diff changeset
853 static int
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
854 expand_set_opt_listflag(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
855 optexpand_T *args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
856 char_u *flags,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
857 int *numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
858 char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
859 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
860 char_u *p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
861 char_u *option_val = args->oe_opt_value;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
862 char_u *cmdline_val = args->oe_set_arg;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
863 int append = args->oe_append;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
864 int include_orig_val = args->oe_include_orig_val && (*option_val != NUL);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
865
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
866 int num_flags = STRLEN(flags);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
867
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
868 // Assume we only have small number of flags, so just allocate max size.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
869 *matches = ALLOC_MULT(char_u *, num_flags + 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
870 if (*matches == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
871 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
872
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
873 int count = 0;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
874
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
875 if (include_orig_val)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
876 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
877 p = vim_strsave(option_val);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
878 if (p == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
879 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
880 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
881 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
882 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
883 (*matches)[count++] = p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
884 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
885
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
886 for (char_u *flag = flags; *flag != NUL; flag++)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
887 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
888 if (append && vim_strchr(option_val, *flag) != NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
889 continue;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
890
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
891 if (vim_strchr(cmdline_val, *flag) == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
892 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
893 if (include_orig_val
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
894 && option_val[1] == NUL
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
895 && *flag == option_val[0])
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
896 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
897 // This value is already used as the first choice as it's the
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
898 // existing flag. Just skip it to avoid duplicate.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
899 continue;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
900 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
901 p = vim_strnsave(flag, 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
902 if (p == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
903 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
904 if (count == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
905 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
906 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
907 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
908 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
909 else
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
910 break;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
911 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
912 (*matches)[count++] = p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
913 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
914 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
915
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
916 if (count == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
917 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
918 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
919 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
920 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
921 *numMatches = count;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
922 return OK;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
923 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
924
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
925 /*
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
926 * The 'ambiwidth' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
927 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
928 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
929 did_set_ambiwidth(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
930 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
931 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
932 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
933
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
934 return check_chars_options();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
935 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
936
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
937 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
938 expand_set_ambiwidth(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
939 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
940 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
941 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
942 p_ambw_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
943 sizeof(p_ambw_values) / sizeof(p_ambw_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
944 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
945 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
946 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
947
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
948 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
949 * The 'background' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
950 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
951 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
952 did_set_background(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
953 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
954 if (check_opt_strings(p_bg, p_bg_values, FALSE) == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
955 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
956
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
957 #ifdef FEAT_EVAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
958 int dark = (*p_bg == 'd');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
959 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
960
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
961 init_highlight(FALSE, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
962
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
963 #ifdef FEAT_EVAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
964 if (dark != (*p_bg == 'd')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
965 && get_var_value((char_u *)"g:colors_name") != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
966 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
967 // The color scheme must have set 'background' back to another
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
968 // value, that's not what we want here. Disable the color
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
969 // scheme and set the colors again.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
970 do_unlet((char_u *)"g:colors_name", TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
971 free_string_option(p_bg);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
972 p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
973 check_string_option(&p_bg);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
974 init_highlight(FALSE, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
975 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
976 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
977 #ifdef FEAT_TERMINAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
978 term_update_colors_all();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
979 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
980
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
981 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
982 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
983
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
984 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
985 expand_set_background(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
986 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
987 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
988 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
989 p_bg_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
990 sizeof(p_bg_values) / sizeof(p_bg_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
991 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
992 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
993 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
994
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
995 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
996 * The 'backspace' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
997 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
998 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
999 did_set_backspace(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1000 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1001 if (VIM_ISDIGIT(*p_bs))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1002 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1003 if (*p_bs > '3' || p_bs[1] != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1004 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1005 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1006 else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1007 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1008
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1009 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1010 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1011
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1012 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1013 expand_set_backspace(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1014 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1015 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1016 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1017 p_bs_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1018 sizeof(p_bs_values) / sizeof(p_bs_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1019 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1020 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1021 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1022
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1023 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1024 * The 'backupcopy' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1025 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1026 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1027 did_set_backupcopy(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1028 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1029 char_u *bkc = p_bkc;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1030 unsigned int *flags = &bkc_flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1031 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1032
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1033 if (args->os_flags & OPT_LOCAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1034 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1035 bkc = curbuf->b_p_bkc;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1036 flags = &curbuf->b_bkc_flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1037 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1038
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1039 if ((args->os_flags & OPT_LOCAL) && *bkc == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1040 // make the local value empty: use the global value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1041 *flags = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1042 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1043 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1044 if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1045 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1046 if ((((int)*flags & BKC_AUTO) != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1047 + (((int)*flags & BKC_YES) != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1048 + (((int)*flags & BKC_NO) != 0) != 1)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1049 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1050 // Must have exactly one of "auto", "yes" and "no".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1051 (void)opt_strings_flags(args->os_oldval.string, p_bkc_values,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1052 flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1053 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1054 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1055 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1056
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1057 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1058 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1059
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1060 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1061 expand_set_backupcopy(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1062 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1063 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1064 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1065 p_bkc_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1066 sizeof(p_bkc_values) / sizeof(p_bkc_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1067 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1068 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1069 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1070
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1071 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1072 * The 'backupext' or the 'patchmode' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1073 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1074 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1075 did_set_backupext_or_patchmode(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1076 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1077 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1078 *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1079 return e_backupext_and_patchmode_are_equal;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1080
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1081 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1082 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1083
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1084 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1085 * The 'belloff' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1086 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1087 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1088 did_set_belloff(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1089 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1090 return did_set_opt_flags(p_bo, p_bo_values, &bo_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1091 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1092
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1093 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1094 expand_set_belloff(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1095 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1096 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1097 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1098 p_bo_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1099 sizeof(p_bo_values) / sizeof(p_bo_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1100 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1101 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1102 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1103
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1104 #if defined(FEAT_LINEBREAK) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1105 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1106 * The 'breakindentopt' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1107 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1108 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1109 did_set_breakindentopt(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1110 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1111 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1112
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1113 if (briopt_check(curwin) == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1114 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1115 // list setting requires a redraw
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1116 if (curwin->w_briopt_list)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1117 redraw_all_later(UPD_NOT_VALID);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1118
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1119 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1120 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1121
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1122 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1123 expand_set_breakindentopt(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1124 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1125 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1126 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1127 p_briopt_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1128 sizeof(p_briopt_values) / sizeof(p_briopt_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1129 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1130 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1131 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1132 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1133
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1134 #if defined(FEAT_BROWSE) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1135 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1136 * The 'browsedir' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1137 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1138 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1139 did_set_browsedir(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1140 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1141 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1142 && !mch_isdir(p_bsdir))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1143 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1144
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1145 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1146 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1147
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1148 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1149 expand_set_browsedir(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1150 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1151 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1152 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1153 p_bsdir_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1154 sizeof(p_bsdir_values) / sizeof(p_bsdir_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1155 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1156 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1157 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1158 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1159
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1160 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1161 * The 'bufhidden' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1162 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1163 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1164 did_set_bufhidden(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1165 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1166 return did_set_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1167 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1168
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1169 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1170 expand_set_bufhidden(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1171 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1172 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1173 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1174 p_bufhidden_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1175 sizeof(p_bufhidden_values) / sizeof(p_bufhidden_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1176 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1177 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1178 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1179
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1180 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1181 * The 'buftype' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1182 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1183 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1184 did_set_buftype(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1185 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1186 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1187 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1188
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1189 if (curwin->w_status_height)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1190 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1191 curwin->w_redr_status = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1192 redraw_later(UPD_VALID);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1193 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1194 curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1195 redraw_titles();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1196
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1197 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1198 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1199
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1200 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1201 expand_set_buftype(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1202 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1203 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1204 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1205 p_buftype_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1206 sizeof(p_buftype_values) / sizeof(p_buftype_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1207 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1208 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1209 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1210
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1211 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1212 * The 'casemap' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1213 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1214 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1215 did_set_casemap(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1216 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1217 return did_set_opt_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1218 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1219
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1220 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1221 expand_set_casemap(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1222 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1223 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1224 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1225 p_cmp_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1226 sizeof(p_cmp_values) / sizeof(p_cmp_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1227 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1228 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1229 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1230
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1231 #if defined(FEAT_CLIPBOARD) || defined(PROTO)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1232 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1233 expand_set_clipboard(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1234 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1235 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1236 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1237 p_cb_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1238 sizeof(p_cb_values) / sizeof(p_cb_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1239 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1240 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1241 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1242 #endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1243
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1244 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1245 * The global 'listchars' or 'fillchars' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1246 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1247 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1248 did_set_global_listfillchars(char_u *val, int opt_lcs, int opt_flags)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1249 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1250 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1251 char_u **local_ptr = opt_lcs ? &curwin->w_p_lcs : &curwin->w_p_fcs;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1252
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1253 // only apply the global value to "curwin" when it does not have a
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1254 // local value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1255 if (opt_lcs)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1256 errmsg = set_listchars_option(curwin, val,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1257 **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1258 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1259 errmsg = set_fillchars_option(curwin, val,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1260 **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1261 if (errmsg != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1262 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1263
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1264 tabpage_T *tp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1265 win_T *wp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1266
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1267 // If the current window is set to use the global
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1268 // 'listchars'/'fillchars' value, clear the window-local value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1269 if (!(opt_flags & OPT_GLOBAL))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1270 clear_string_option(local_ptr);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1271 FOR_ALL_TAB_WINDOWS(tp, wp)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1272 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1273 // If the current window has a local value need to apply it
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1274 // again, it was changed when setting the global value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1275 // If no error was returned above, we don't expect an error
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1276 // here, so ignore the return value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1277 if (opt_lcs)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1278 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1279 if (*wp->w_p_lcs == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1280 (void)set_listchars_option(wp, wp->w_p_lcs, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1281 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1282 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1283 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1284 if (*wp->w_p_fcs == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1285 (void)set_fillchars_option(wp, wp->w_p_fcs, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1286 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1287 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1288
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1289 redraw_all_later(UPD_NOT_VALID);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1290
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1291 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1292 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1293
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1294 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1295 * The 'fillchars' option or the 'listchars' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1296 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1297 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1298 did_set_chars_option(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1299 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1300 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1301 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1302
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1303 if ( varp == &p_lcs // global 'listchars'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1304 || varp == &p_fcs) // global 'fillchars'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1305 errmsg = did_set_global_listfillchars(*varp, varp == &p_lcs,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1306 args->os_flags);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1307 else if (varp == &curwin->w_p_lcs) // local 'listchars'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1308 errmsg = set_listchars_option(curwin, *varp, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1309 else if (varp == &curwin->w_p_fcs) // local 'fillchars'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1310 errmsg = set_fillchars_option(curwin, *varp, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1311
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1312 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1313 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1314
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1315 /*
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1316 * Expand 'fillchars' or 'listchars' option value.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1317 */
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1318 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1319 expand_set_chars_option(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1320 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1321 char_u **varp = (char_u **)args->oe_varp;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1322 int is_lcs = (varp == &p_lcs || varp == &curwin->w_p_lcs);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1323 return expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1324 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1325 is_lcs ? get_listchars_name : get_fillchars_name,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1326 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1327 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1328 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1329
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1330 /*
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1331 * The 'cinoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1332 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1333 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1334 did_set_cinoptions(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1335 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1336 // TODO: recognize errors
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1337 parse_cino(curbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1338
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1339 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1340 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1341
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1342 #if defined(FEAT_SYN_HL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1343 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1344 * The 'colorcolumn' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1345 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1346 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1347 did_set_colorcolumn(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1348 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1349 return check_colorcolumn(curwin);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1350 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1351 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1352
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1353 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1354 * The 'comments' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1355 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1356 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1357 did_set_comments(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1358 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1359 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1360 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1361 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1362
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1363 for (s = *varp; *s; )
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1364 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1365 while (*s && *s != ':')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1366 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1367 if (vim_strchr((char_u *)COM_ALL, *s) == NULL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1368 && !VIM_ISDIGIT(*s) && *s != '-')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1369 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1370 errmsg = illegal_char(args->os_errbuf, *s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1371 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1372 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1373 ++s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1374 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1375 if (*s++ == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1376 errmsg = e_missing_colon;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1377 else if (*s == ',' || *s == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1378 errmsg = e_zero_length_string;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1379 if (errmsg != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1380 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1381 while (*s && *s != ',')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1382 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1383 if (*s == '\\' && s[1] != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1384 ++s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1385 ++s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1386 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1387 s = skip_to_option_part(s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1388 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1389
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1390 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1391 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1392
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1393 #if defined(FEAT_FOLDING) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1394 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1395 * The 'commentstring' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1396 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1397 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1398 did_set_commentstring(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1399 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1400 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1401
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1402 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1403 return e_commentstring_must_be_empty_or_contain_str;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1404
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1405 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1406 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1407 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1408
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1409 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1410 * The 'complete' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1411 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1412 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1413 did_set_complete(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1414 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1415 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1416 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1417
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1418 // check if it is a valid value for 'complete' -- Acevedo
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1419 for (s = *varp; *s;)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1420 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1421 while (*s == ',' || *s == ' ')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1422 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1423 if (!*s)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1424 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1425 if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1426 return illegal_char(args->os_errbuf, *s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1427 if (*++s != NUL && *s != ',' && *s != ' ')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1428 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1429 if (s[-1] == 'k' || s[-1] == 's')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1430 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1431 // skip optional filename after 'k' and 's'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1432 while (*s && *s != ',' && *s != ' ')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1433 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1434 if (*s == '\\' && s[1] != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1435 ++s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1436 ++s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1437 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1438 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1439 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1440 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1441 if (args->os_errbuf != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1442 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1443 sprintf((char *)args->os_errbuf,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1444 _(e_illegal_character_after_chr), *--s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1445 return args->os_errbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1446 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1447 return "";
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1448 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1449 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1450 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1451
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1452 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1453 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1454
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1455 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1456 expand_set_complete(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1457 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1458 static char *(p_cpt_values[]) = {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1459 ".", "w", "b", "u", "k", "kspell", "s", "i", "d", "]", "t", "U",
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1460 NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1461 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1462 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1463 p_cpt_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1464 sizeof(p_cpt_values) / sizeof(p_cpt_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1465 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1466 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1467 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1468
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1469 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1470 * The 'completeopt' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1471 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1472 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1473 did_set_completeopt(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1474 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1475 if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1476 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1477
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1478 completeopt_was_set();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1479 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1480 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1481
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1482 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1483 expand_set_completeopt(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1484 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1485 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1486 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1487 p_cot_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1488 sizeof(p_cot_values) / sizeof(p_cot_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1489 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1490 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1491 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1492
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1493 #if (defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1494 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1495 * The 'completepopup' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1496 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1497 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1498 did_set_completepopup(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1499 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1500 if (parse_completepopup(NULL) == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1501 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1502
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1503 popup_close_info();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1504 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1505 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1506 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1507
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1508 #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1509 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1510 * The 'completeslash' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1511 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1512 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1513 did_set_completeslash(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1514 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1515 if (check_opt_strings(p_csl, p_csl_values, FALSE) != OK
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1516 || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1517 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1518
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1519 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1520 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1521
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1522 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1523 expand_set_completeslash(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1524 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1525 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1526 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1527 p_csl_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1528 sizeof(p_csl_values) / sizeof(p_csl_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1529 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1530 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1531 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1532 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1533
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1534 #if defined(FEAT_CONCEAL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1535 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1536 * The 'concealcursor' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1537 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1538 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1539 did_set_concealcursor(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1540 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1541 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1542
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1543 return did_set_option_listflag(*varp, (char_u *)COCU_ALL, args->os_errbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1544 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1545
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1546 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1547 expand_set_concealcursor(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1548 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1549 return expand_set_opt_listflag(args, (char_u*)COCU_ALL, numMatches, matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1550 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1551 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1552
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1553 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1554 * The 'cpoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1555 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1556 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1557 did_set_cpoptions(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1558 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1559 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1560
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1561 return did_set_option_listflag(*varp, (char_u *)CPO_ALL, args->os_errbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1562 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1563
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1564 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1565 expand_set_cpoptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1566 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1567 return expand_set_opt_listflag(args, (char_u*)CPO_ALL, numMatches, matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1568 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1569
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1570 #if defined(FEAT_CRYPT) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1571 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1572 * The 'cryptkey' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1573 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1574 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1575 did_set_cryptkey(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1576 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1577 // Make sure the ":set" command doesn't show the new value in the
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1578 // history.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1579 remove_key_from_history();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1580
33420
aa7cd2253130 patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents: 33404
diff changeset
1581 if (args->os_op != OP_NONE)
aa7cd2253130 patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents: 33404
diff changeset
1582 // Don't allow set+=/-=/^= as they can allow for substring guessing
aa7cd2253130 patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents: 33404
diff changeset
1583 return e_invalid_argument;
aa7cd2253130 patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents: 33404
diff changeset
1584
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1585 if (STRCMP(curbuf->b_p_key, args->os_oldval.string) != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1586 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1587 // Need to update the swapfile.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1588 ml_set_crypt_key(curbuf, args->os_oldval.string,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1589 *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1590 changed_internal();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1591 }
32677
4091ae33b9ec patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1592 # ifdef FEAT_SODIUM
4091ae33b9ec patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1593 if (crypt_method_is_sodium(crypt_get_method_nr(curbuf)))
4091ae33b9ec patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1594 crypt_sodium_lock_key(args->os_newval.string);
4091ae33b9ec patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt
Bram Moolenaar <Bram@vim.org>
parents: 32670
diff changeset
1595 # endif
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1596
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1597 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1598 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1599
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1600 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1601 * The 'cryptmethod' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1602 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1603 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1604 did_set_cryptmethod(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1605 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1606 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1607 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1608
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1609 if (args->os_flags & OPT_LOCAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1610 p = curbuf->b_p_cm;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1611 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1612 p = p_cm;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1613 if (check_opt_strings(p, p_cm_values, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1614 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1615 else if (crypt_self_test() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1616 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1617
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1618 // When setting the global value to empty, make it "zip".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1619 if (*p_cm == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1620 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1621 free_string_option(p_cm);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1622 p_cm = vim_strsave((char_u *)"zip");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1623 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1624 // When using ":set cm=name" the local value is going to be empty.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1625 // Do that here, otherwise the crypt functions will still use the
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1626 // local value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1627 if ((args->os_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1628 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1629 free_string_option(curbuf->b_p_cm);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1630 curbuf->b_p_cm = empty_option;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1631 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1632
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1633 // Need to update the swapfile when the effective method changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1634 // Set "s" to the effective old value, "p" to the effective new
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1635 // method and compare.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1636 if ((args->os_flags & OPT_LOCAL) && *args->os_oldval.string == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1637 s = p_cm; // was previously using the global value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1638 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1639 s = args->os_oldval.string;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1640 if (*curbuf->b_p_cm == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1641 p = p_cm; // is now using the global value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1642 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1643 p = curbuf->b_p_cm;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1644 if (STRCMP(s, p) != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1645 ml_set_crypt_key(curbuf, curbuf->b_p_key, s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1646
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1647 // If the global value changes need to update the swapfile for all
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1648 // buffers using that value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1649 if ((args->os_flags & OPT_GLOBAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1650 && STRCMP(p_cm, args->os_oldval.string) != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1651 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1652 buf_T *buf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1653
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1654 FOR_ALL_BUFFERS(buf)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1655 if (buf != curbuf && *buf->b_p_cm == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1656 ml_set_crypt_key(buf, buf->b_p_key, args->os_oldval.string);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1657 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1658 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1659 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1660
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1661 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1662 expand_set_cryptmethod(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1663 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1664 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1665 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1666 p_cm_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1667 sizeof(p_cm_values) / sizeof(p_cm_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1668 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1669 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1670 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1671 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1672
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1673 #if (defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1674 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1675 * The 'cscopequickfix' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1676 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1677 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1678 did_set_cscopequickfix(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1679 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1680 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1681
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1682 if (p_csqf == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1683 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1684
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1685 p = p_csqf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1686 while (*p != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1687 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1688 if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1689 || p[1] == NUL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1690 || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1691 || (p[2] != NUL && p[2] != ','))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1692 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1693 else if (p[2] == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1694 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1695 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1696 p += 3;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1697 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1698
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1699 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1700 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1701 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1702
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1703 #if defined(FEAT_SYN_HL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1704 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1705 * The 'cursorlineopt' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1706 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1707 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1708 did_set_cursorlineopt(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1709 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1710 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1711
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1712 // This could be changed to use opt_strings_flags() instead.
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1713 if (**varp == NUL || fill_culopt_flags(*varp, curwin) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1714 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1715
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1716 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1717 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1718
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1719 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1720 expand_set_cursorlineopt(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1721 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1722 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1723 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1724 p_culopt_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1725 sizeof(p_culopt_values) / sizeof(p_culopt_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1726 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1727 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1728 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1729 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1730
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1731 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1732 * The 'debug' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1733 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1734 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1735 did_set_debug(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1736 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1737 return did_set_opt_strings(p_debug, p_debug_values, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1738 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1739
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1740 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1741 expand_set_debug(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1742 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1743 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1744 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1745 p_debug_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1746 sizeof(p_debug_values) / sizeof(p_debug_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1747 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1748 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1749 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1750
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1751 #if defined(FEAT_DIFF) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1752 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1753 * The 'diffopt' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1754 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1755 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1756 did_set_diffopt(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1757 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1758 if (diffopt_changed() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1759 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1760
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1761 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1762 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1763
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1764 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1765 expand_set_diffopt(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1766 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1767 expand_T *xp = args->oe_xp;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1768
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1769 if (xp->xp_pattern > args->oe_set_arg && *(xp->xp_pattern-1) == ':')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1770 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1771 // Within "algorithm:", we have a subgroup of possible options.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1772 int algo_len = STRLEN("algorithm:");
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1773 if (xp->xp_pattern - args->oe_set_arg >= algo_len &&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1774 STRNCMP(xp->xp_pattern - algo_len, "algorithm:", algo_len) == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1775 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1776 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1777 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1778 p_dip_algorithm_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1779 sizeof(p_dip_algorithm_values) / sizeof(p_dip_algorithm_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1780 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1781 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1782 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1783 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1784 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1785
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1786 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1787 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1788 p_dip_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1789 sizeof(p_dip_values) / sizeof(p_dip_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1790 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1791 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1792 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1793 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1794
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1795 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1796 * The 'display' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1797 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1798 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1799 did_set_display(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1800 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1801 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1802 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1803
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1804 (void)init_chartab();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1805 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1806 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1807
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1808 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1809 expand_set_display(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1810 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1811 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1812 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1813 p_dy_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1814 sizeof(p_dy_values) / sizeof(p_dy_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1815 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1816 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1817 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1818
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1819 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1820 * The 'eadirection' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1821 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1822 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1823 did_set_eadirection(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1824 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1825 return did_set_opt_strings(p_ead, p_ead_values, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1826 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1827
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1828 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1829 expand_set_eadirection(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1830 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1831 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1832 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1833 p_ead_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1834 sizeof(p_ead_values) / sizeof(p_ead_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1835 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1836 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1837 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1838
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1839 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1840 * One of the 'encoding', 'fileencoding', 'termencoding' or 'makeencoding'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1841 * options is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1842 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1843 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1844 did_set_encoding(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1845 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1846 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1847 char_u **gvarp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1848 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1849 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1850
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1851 // Get the global option to compare with, otherwise we would have to check
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1852 // two values for all local options.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1853 gvarp = (char_u **)get_option_varp_scope(args->os_idx, OPT_GLOBAL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1854
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1855 if (gvarp == &p_fenc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1856 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1857 if (!curbuf->b_p_ma && args->os_flags != OPT_GLOBAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1858 errmsg = e_cannot_make_changes_modifiable_is_off;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1859 else if (vim_strchr(*varp, ',') != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1860 // No comma allowed in 'fileencoding'; catches confusing it
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1861 // with 'fileencodings'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1862 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1863 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1864 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1865 // May show a "+" in the title now.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1866 redraw_titles();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1867 // Add 'fileencoding' to the swap file.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1868 ml_setflags(curbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1869 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1870 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1871 if (errmsg == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1872 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1873 // canonize the value, so that STRCMP() can be used on it
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1874 p = enc_canonize(*varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1875 if (p != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1876 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1877 vim_free(*varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1878 *varp = p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1879 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1880 if (varp == &p_enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1881 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1882 errmsg = mb_init();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1883 redraw_titles();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1884 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1885 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1886
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1887 #if defined(FEAT_GUI_GTK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1888 if (errmsg == NULL && varp == &p_tenc && gui.in_use)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1889 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1890 // GTK uses only a single encoding, and that is UTF-8.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1891 if (STRCMP(p_tenc, "utf-8") != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1892 errmsg = e_cannot_be_changed_in_gtk_GUI;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1893 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1894 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1895
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1896 if (errmsg == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1897 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1898 #ifdef FEAT_KEYMAP
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1899 // When 'keymap' is used and 'encoding' changes, reload the keymap
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1900 // (with another encoding).
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1901 if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1902 (void)keymap_init();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1903 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1904
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1905 // When 'termencoding' is not empty and 'encoding' changes or when
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1906 // 'termencoding' changes, need to setup for keyboard input and
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1907 // display output conversion.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1908 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1909 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1910 if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1911 || convert_setup(&output_conv, p_enc, p_tenc) == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1912 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1913 semsg(_(e_cannot_convert_between_str_and_str),
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1914 p_tenc, p_enc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1915 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1916 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1917 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1918
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1919 #if defined(MSWIN)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1920 // $HOME, $VIM and $VIMRUNTIME may have characters in active code page.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1921 if (varp == &p_enc)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1922 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1923 init_homedir();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1924 init_vimdir();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1925 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1926 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1927 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1928
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1929 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1930 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1931
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1932 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1933 expand_set_encoding(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1934 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1935 return expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1936 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1937 get_encoding_name,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1938 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1939 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1940 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1941
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1942 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1943 * The 'eventignore' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1944 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1945 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1946 did_set_eventignore(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1947 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1948 if (check_ei() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1949 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1950 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1951 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1952
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1953 static char_u *
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1954 get_eventignore_name(expand_T *xp, int idx)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1955 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1956 // 'eventignore' allows special keyword "all" in addition to
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1957 // all event names.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1958 if (idx == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1959 return (char_u *)"all";
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1960 return get_event_name_no_group(xp, idx - 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1961 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1962
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1963 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1964 expand_set_eventignore(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1965 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1966 return expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1967 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1968 get_eventignore_name,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1969 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1970 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1971 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
1972
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1973 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1974 * The 'fileformat' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1975 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1976 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1977 did_set_fileformat(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1978 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1979 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1980
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1981 if (!curbuf->b_p_ma && !(args->os_flags & OPT_GLOBAL))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1982 return e_cannot_make_changes_modifiable_is_off;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1983 else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1984 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1985
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1986 // may also change 'textmode'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1987 if (get_fileformat(curbuf) == EOL_DOS)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1988 curbuf->b_p_tx = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1989 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1990 curbuf->b_p_tx = FALSE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1991 redraw_titles();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1992 // update flag in swap file
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1993 ml_setflags(curbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1994 // Redraw needed when switching to/from "mac": a CR in the text
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1995 // will be displayed differently.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1996 if (get_fileformat(curbuf) == EOL_MAC || *args->os_oldval.string == 'm')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1997 redraw_curbuf_later(UPD_NOT_VALID);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1998
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
1999 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2000 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2001
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2002 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2003 expand_set_fileformat(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2004 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2005 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2006 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2007 p_ff_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2008 sizeof(p_ff_values) / sizeof(p_ff_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2009 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2010 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2011 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2012
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2013 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2014 * The 'fileformats' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2015 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2016 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2017 did_set_fileformats(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2018 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2019 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2020 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2021
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2022 // also change 'textauto'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2023 if (*p_ffs == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2024 p_ta = FALSE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2025 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2026 p_ta = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2027
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2028 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2029 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2030
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2031 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2032 * The 'filetype' or the 'syntax' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2033 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2034 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2035 did_set_filetype_or_syntax(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2036 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2037 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2038
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2039 if (!valid_filetype(*varp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2040 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2041
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2042 args->os_value_changed = STRCMP(args->os_oldval.string, *varp) != 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2043
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2044 // Since we check the value, there is no need to set P_INSECURE,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2045 // even when the value comes from a modeline.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2046 args->os_value_checked = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2047
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2048 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2049 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2050
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2051 #if defined(FEAT_FOLDING) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2052 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2053 * The 'foldclose' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2054 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2055 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2056 did_set_foldclose(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2057 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2058 return did_set_opt_strings(p_fcl, p_fcl_values, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2059 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2060
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2061 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2062 expand_set_foldclose(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2063 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2064 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2065 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2066 p_fcl_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2067 sizeof(p_fcl_values) / sizeof(p_fcl_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2068 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2069 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2070 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2071 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2072
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2073 #if (defined(FEAT_EVAL) && defined(FEAT_FOLDING)) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2074 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2075 * The 'foldexpr' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2076 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2077 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2078 did_set_foldexpr(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2079 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2080 (void)did_set_optexpr(args);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2081 if (foldmethodIsExpr(curwin))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2082 foldUpdateAll(curwin);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2083 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2084 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2085 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2086
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2087 #if defined(FEAT_FOLDING) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2088 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2089 * The 'foldignore' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2090 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2091 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2092 did_set_foldignore(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2093 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2094 if (foldmethodIsIndent(curwin))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2095 foldUpdateAll(curwin);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2096 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2097 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2098
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2099 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2100 * The 'foldmarker' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2101 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2102 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2103 did_set_foldmarker(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2104 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2105 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2106 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2107
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2108 p = vim_strchr(*varp, ',');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2109 if (p == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2110 return e_comma_required;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2111 else if (p == *varp || p[1] == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2112 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2113 else if (foldmethodIsMarker(curwin))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2114 foldUpdateAll(curwin);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2115
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2116 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2117 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2118
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2119 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2120 * The 'foldmethod' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2121 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2122 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2123 did_set_foldmethod(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2124 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2125 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2126
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2127 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2128 || *curwin->w_p_fdm == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2129 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2130
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2131 foldUpdateAll(curwin);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2132 if (foldmethodIsDiff(curwin))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2133 newFoldLevel();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2134 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2135 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2136
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2137 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2138 expand_set_foldmethod(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2139 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2140 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2141 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2142 p_fdm_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2143 sizeof(p_fdm_values) / sizeof(p_fdm_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2144 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2145 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2146 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2147
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2148 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2149 * The 'foldopen' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2150 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2151 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2152 did_set_foldopen(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2153 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2154 return did_set_opt_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2155 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2156
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2157 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2158 expand_set_foldopen(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2159 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2160 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2161 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2162 p_fdo_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2163 sizeof(p_fdo_values) / sizeof(p_fdo_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2164 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2165 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2166 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2167 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2168
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2169 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2170 * The 'formatoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2171 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2172 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2173 did_set_formatoptions(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2174 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2175 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2176
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2177 return did_set_option_listflag(*varp, (char_u *)FO_ALL, args->os_errbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2178 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2179
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2180 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2181 expand_set_formatoptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2182 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2183 return expand_set_opt_listflag(args, (char_u*)FO_ALL, numMatches, matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2184 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2185
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2186 #if defined(CURSOR_SHAPE) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2187 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2188 * The 'guicursor' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2189 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2190 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2191 did_set_guicursor(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2192 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2193 return parse_shape_opt(SHAPE_CURSOR);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2194 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2195 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2196
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2197 #if defined(FEAT_GUI) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2198 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2199 * The 'guifont' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2200 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2201 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2202 did_set_guifont(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2203 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2204 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2205 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2206
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2207 if (gui.in_use)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2208 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2209 p = p_guifont;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2210 # if defined(FEAT_GUI_GTK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2211 // Put up a font dialog and let the user select a new value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2212 // If this is cancelled go back to the old value but don't
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2213 // give an error message.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2214 if (STRCMP(p, "*") == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2215 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2216 p = gui_mch_font_dialog(args->os_oldval.string);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2217 free_string_option(p_guifont);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2218 p_guifont = (p != NULL) ? p : vim_strsave(args->os_oldval.string);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2219 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2220 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2221 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2222 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2223 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2224 if (STRCMP(p_guifont, "*") == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2225 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2226 // Dialog was cancelled: Keep the old value without giving
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2227 // an error message.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2228 free_string_option(p_guifont);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2229 p_guifont = vim_strsave(args->os_oldval.string);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2230 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2231 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2232 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2233 errmsg = e_invalid_fonts;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2234 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2235 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2236
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2237 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2238 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2239
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2240 # if defined(FEAT_XFONTSET) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2241 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2242 * The 'guifontset' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2243 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2244 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2245 did_set_guifontset(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2246 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2247 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2248
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2249 if (STRCMP(p_guifontset, "*") == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2250 errmsg = e_cant_select_fontset;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2251 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2252 errmsg = e_invalid_fontset;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2253
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2254 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2255 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2256 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2257
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2258 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2259 * The 'guifontwide' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2260 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2261 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2262 did_set_guifontwide(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2263 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2264 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2265
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2266 if (STRCMP(p_guifontwide, "*") == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2267 errmsg = e_cant_select_wide_font;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2268 else if (gui_get_wide_font() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2269 errmsg = e_invalid_wide_font;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2270
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2271 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2272 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2273 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2274
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2275 #if defined(FEAT_GUI_GTK) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2276 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2277 * The 'guiligatures' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2278 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2279 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2280 did_set_guiligatures(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2281 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2282 gui_set_ligatures();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2283 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2284 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2285 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2286
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2287 #if defined(FEAT_GUI) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2288 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2289 * The 'guioptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2290 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2291 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2292 did_set_guioptions(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2293 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2294 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2295 char *errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2296
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2297 errmsg = did_set_option_listflag(*varp, (char_u *)GO_ALL, args->os_errbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2298 if (errmsg != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2299 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2300
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2301 gui_init_which_components(args->os_oldval.string);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2302 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2303 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2304
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2305 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2306 expand_set_guioptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2307 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2308 return expand_set_opt_listflag(args, (char_u*)GO_ALL, numMatches, matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2309 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2310 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2311
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2312 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2313 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2314 * The 'guitablabel' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2315 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2316 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2317 did_set_guitablabel(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2318 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2319 redraw_tabline = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2320 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2321 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2322 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2323
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2324 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2325 * The 'helpfile' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2326 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2327 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2328 did_set_helpfile(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2329 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2330 // May compute new values for $VIM and $VIMRUNTIME
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2331 if (didset_vim)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2332 vim_unsetenv_ext((char_u *)"VIM");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2333 if (didset_vimruntime)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2334 vim_unsetenv_ext((char_u *)"VIMRUNTIME");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2335 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2336 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2337
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2338 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2339 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2340 * The 'helplang' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2341 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2342 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2343 did_set_helplang(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2344 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2345 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2346
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2347 // Check for "", "ab", "ab,cd", etc.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2348 for (char_u *s = p_hlg; *s != NUL; s += 3)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2349 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2350 if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2351 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2352 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2353 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2354 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2355 if (s[2] == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2356 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2357 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2358
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2359 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2360 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2361 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2362
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2363 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2364 * The 'highlight' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2365 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2366 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2367 did_set_highlight(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2368 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2369 if (highlight_changed() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2370 return e_invalid_argument; // invalid flags
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2371
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2372 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2373 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2374
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2375 /*
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2376 * Expand 'highlight' option.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2377 */
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2378 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2379 expand_set_highlight(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2380 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2381 char_u *p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2382 expand_T *xp = args->oe_xp;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2383 static char_u hl_flags[HLF_COUNT] = HL_FLAGS;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2384 int i;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2385 int count = 0;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2386
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2387 if (xp->xp_pattern > args->oe_set_arg && *(xp->xp_pattern-1) == ':')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2388 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2389 // Right after a ':', meaning we just return all highlight names.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2390 return expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2391 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2392 get_highlight_name,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2393 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2394 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2395 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2396
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2397 if (*xp->xp_pattern == NUL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2398 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2399 // At beginning of a comma-separated list. Return the specific list of
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2400 // supported occasions.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2401 *matches = ALLOC_MULT(char_u *, HLF_COUNT + 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2402 if (*matches == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2403 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2404
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2405 // We still want to return the full option if it's requested.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2406 if (args->oe_include_orig_val)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2407 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2408 p = vim_strsave(args->oe_opt_value);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2409 if (p == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2410 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2411 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2412 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2413 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2414 (*matches)[count++] = p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2415 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2416
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2417 for (i = 0; i < HLF_COUNT; i++)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2418 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2419 p = vim_strnsave(&hl_flags[i], 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2420 if (p == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2421 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2422 if (count == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2423 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2424 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2425 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2426 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2427 else
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2428 break;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2429 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2430 (*matches)[count++] = p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2431 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2432
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2433 if (count == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2434 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2435 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2436 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2437 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2438 *numMatches = count;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2439 return OK;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2440 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2441
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2442 // We are after the initial character (which indicates the occasion). We
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2443 // already made sure we are not matching after a ':' above, so now we want
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2444 // to match against display mode modifiers.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2445 // Since the xp_pattern starts from the beginning, we need to include it in
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2446 // the returned match.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2447
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2448 // Note: Keep this in sync with highlight_changed()
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2449 static char p_hl_mode_values[] =
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2450 {':', 'b', 'i', '-', 'n', 'r', 's', 'u', 'c', '2', 'd', '=', 't'};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2451 int num_hl_modes = sizeof(p_hl_mode_values) / sizeof(p_hl_mode_values[0]);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2452
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2453 *matches = ALLOC_MULT(char_u *, num_hl_modes);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2454 if (*matches == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2455 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2456
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2457 int pattern_len = STRLEN(xp->xp_pattern);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2458
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2459 for (i = 0; i < num_hl_modes; i++)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2460 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2461 // Don't allow duplicates as these are unique flags
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2462 if (vim_strchr(xp->xp_pattern + 1, p_hl_mode_values[i]) != NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2463 continue;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2464
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2465 // ':' only works by itself, not with other flags.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2466 if (pattern_len > 1 && p_hl_mode_values[i] == ':')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2467 continue;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2468
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2469 p = vim_strnsave(xp->xp_pattern, pattern_len + 1);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2470 if (p == NULL)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2471 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2472 if (i == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2473 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2474 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2475 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2476 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2477 else
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2478 break;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2479 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2480 p[pattern_len] = p_hl_mode_values[i];
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2481 p[pattern_len + 1] = NUL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2482 (*matches)[count++] = p;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2483 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2484 if (count == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2485 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2486 VIM_CLEAR(*matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2487 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2488 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2489 *numMatches = count;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2490
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2491 return OK;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2492 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2493
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2494 /*
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2495 * The 'titlestring' or the 'iconstring' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2496 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2497 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2498 parse_titleiconstring(optset_T *args UNUSED, int flagval UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2499 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2500 #ifdef FEAT_STL_OPT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2501 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2502
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2503 // NULL => statusline syntax
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2504 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2505 stl_syntax |= flagval;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2506 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2507 stl_syntax &= ~flagval;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2508 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2509 did_set_title();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2510
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2511 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2512 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2513
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2514 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2515 * The 'iconstring' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2516 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2517 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2518 did_set_iconstring(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2519 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2520 int flagval = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2521
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2522 #ifdef FEAT_STL_OPT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2523 flagval = STL_IN_ICON;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2524 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2525
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2526 return parse_titleiconstring(args, flagval);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2527 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2528
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2529 #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2530 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2531 * The 'imactivatekey' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2532 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2533 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2534 did_set_imactivatekey(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2535 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2536 if (!im_xim_isvalid_imactivate())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2537 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2538 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2539 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2540 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2541
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2542 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2543 * The 'isident' or the 'iskeyword' or the 'isprint' or the 'isfname' option is
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2544 * changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2545 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2546 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2547 did_set_isopt(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2548 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2549 // 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2550 // If the new option is invalid, use old value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2551 // 'lisp' option: refill g_chartab[] for '-' char.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2552 if (init_chartab() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2553 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2554 args->os_restore_chartab = TRUE;// need to restore the chartab.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2555 return e_invalid_argument; // error in value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2556 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2557
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2558 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2559 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2560
33311
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2561 /*
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2562 * The 'jumpoptions' option is changed.
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2563 */
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2564 char *
33318
41e2414d2886 patch 9.0.1924: LSP server message still wrongly handled (after 9.0.1922)
Christian Brabandt <cb@256bit.org>
parents: 33311
diff changeset
2565 did_set_jumpoptions(optset_T *args UNUSED)
33311
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2566 {
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2567 if (opt_strings_flags(p_jop, p_jop_values, &jop_flags, TRUE) != OK)
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2568 return e_invalid_argument;
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2569
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2570 return NULL;
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2571 }
1f3bcb7f3bd0 patch 9.0.1921: not possible to use the jumplist like a stack
Christian Brabandt <cb@256bit.org>
parents: 32736
diff changeset
2572
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2573 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2574 expand_set_jumpoptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2575 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2576 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2577 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2578 p_jop_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2579 sizeof(p_jop_values) / sizeof(p_jop_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2580 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2581 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2582 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2583
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2584 #if defined(FEAT_KEYMAP) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2585 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2586 * The 'keymap' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2587 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2588 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2589 did_set_keymap(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2590 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2591 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2592 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2593
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2594 if (!valid_filetype(*varp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2595 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2596 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2597 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2598 int secure_save = secure;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2599
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2600 // Reset the secure flag, since the value of 'keymap' has
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2601 // been checked to be safe.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2602 secure = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2603
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2604 // load or unload key mapping tables
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2605 errmsg = keymap_init();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2606
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2607 secure = secure_save;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2608
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2609 // Since we check the value, there is no need to set P_INSECURE,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2610 // even when the value comes from a modeline.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2611 args->os_value_checked = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2612 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2613
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2614 if (errmsg == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2615 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2616 if (*curbuf->b_p_keymap != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2617 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2618 // Installed a new keymap, switch on using it.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2619 curbuf->b_p_iminsert = B_IMODE_LMAP;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2620 if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2621 curbuf->b_p_imsearch = B_IMODE_LMAP;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2622 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2623 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2624 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2625 // Cleared the keymap, may reset 'iminsert' and 'imsearch'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2626 if (curbuf->b_p_iminsert == B_IMODE_LMAP)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2627 curbuf->b_p_iminsert = B_IMODE_NONE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2628 if (curbuf->b_p_imsearch == B_IMODE_LMAP)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2629 curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2630 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2631 if ((args->os_flags & OPT_LOCAL) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2632 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2633 set_iminsert_global();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2634 set_imsearch_global();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2635 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2636 status_redraw_curbuf();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2637 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2638
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2639 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2640 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2641 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2642
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2643 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2644 * The 'keymodel' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2645 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2646 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2647 did_set_keymodel(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2648 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2649 if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2650 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2651
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2652 km_stopsel = (vim_strchr(p_km, 'o') != NULL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2653 km_startsel = (vim_strchr(p_km, 'a') != NULL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2654 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2655 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2656
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2657 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2658 expand_set_keymodel(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2659 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2660 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2661 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2662 p_km_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2663 sizeof(p_km_values) / sizeof(p_km_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2664 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2665 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2666 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2667
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2668 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2669 * The 'keyprotocol' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2670 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2671 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2672 did_set_keyprotocol(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2673 {
33397
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33318
diff changeset
2674 char_u *term = T_NAME;
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33318
diff changeset
2675 keyprot_T kpc = match_keyprotocol(term);
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33318
diff changeset
2676 if (kpc == KEYPROTOCOL_FAIL)
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2677 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2678
33397
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33318
diff changeset
2679 apply_keyprotocol(term, kpc);
23a824d80de3 patch 9.0.1957: termcap options should change when setting keyprotocol
Christian Brabandt <cb@256bit.org>
parents: 33318
diff changeset
2680
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2681 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2682 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2683
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2684 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2685 expand_set_keyprotocol(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2686 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2687 expand_T *xp = args->oe_xp;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2688 if (xp->xp_pattern > args->oe_set_arg && *(xp->xp_pattern-1) == ':')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2689 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2690 // 'keyprotocol' only has well-defined terms for completion for the
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2691 // protocol part after the colon.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2692 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2693 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2694 p_kpc_protocol_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2695 sizeof(p_kpc_protocol_values) / sizeof(p_kpc_protocol_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2696 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2697 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2698 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2699 // Use expand_set_opt_string instead of returning FAIL so that we can
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2700 // include the original value if args->oe_include_orig_val is set.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2701 static char *(empty[]) = {NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2702 return expand_set_opt_string(args, empty, 0, numMatches, matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2703 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2704
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2705 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2706 * The 'lispoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2707 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2708 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2709 did_set_lispoptions(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2710 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2711 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2712
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2713 if (**varp != NUL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2714 && STRCMP(*varp, "expr:0") != 0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2715 && STRCMP(*varp, "expr:1") != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2716 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2717
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2718 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2719 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2720
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2721 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2722 expand_set_lispoptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2723 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2724 static char *(p_lop_values[]) = {"expr:0", "expr:1", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2725 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2726 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2727 p_lop_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2728 sizeof(p_lop_values) / sizeof(p_lop_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2729 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2730 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2731 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2732
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2733 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2734 * The 'matchpairs' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2735 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2736 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2737 did_set_matchpairs(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2738 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2739 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2740 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2741
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2742 if (has_mbyte)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2743 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2744 for (p = *varp; *p != NUL; ++p)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2745 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2746 int x2 = -1;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2747 int x3 = -1;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2748
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2749 p += mb_ptr2len(p);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2750 if (*p != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2751 x2 = *p++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2752 if (*p != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2753 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2754 x3 = mb_ptr2char(p);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2755 p += mb_ptr2len(p);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2756 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2757 if (x2 != ':' || x3 == -1 || (*p != NUL && *p != ','))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2758 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2759 if (*p == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2760 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2761 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2762 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2763 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2764 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2765 // Check for "x:y,x:y"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2766 for (p = *varp; *p != NUL; p += 4)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2767 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2768 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2769 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2770 if (p[3] == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2771 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2772 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2773 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2774
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2775 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2776 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2777
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2778 #if defined(FEAT_SPELL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2779 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2780 * The 'mkspellmem' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2781 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2782 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2783 did_set_mkspellmem(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2784 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2785 if (spell_check_msm() != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2786 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2787
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2788 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2789 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2790 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2791
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2792 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2793 * The 'mouse' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2794 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2795 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2796 did_set_mouse(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2797 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2798 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2799
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2800 return did_set_option_listflag(*varp, (char_u *)MOUSE_ALL,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2801 args->os_errbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2802 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2803
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2804 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2805 expand_set_mouse(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2806 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2807 return expand_set_opt_listflag(args, (char_u*)MOUSE_ALL, numMatches, matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2808 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2809
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2810 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2811 * The 'mousemodel' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2812 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2813 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2814 did_set_mousemodel(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2815 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2816 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2817 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2818 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2819 else if (*p_mousem != *oldval)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2820 // Changed from "extend" to "popup" or "popup_setpos" or vv: need
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2821 // to create or delete the popup menus.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2822 gui_motif_update_mousemodel(root_menu);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2823 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2824
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2825 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2826 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2827
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2828 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2829 expand_set_mousemodel(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2830 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2831 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2832 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2833 p_mousem_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2834 sizeof(p_mousem_values) / sizeof(p_mousem_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2835 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2836 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2837 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2838
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2839 #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2840 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2841 did_set_mouseshape(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2842 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2843 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2844
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2845 errmsg = parse_shape_opt(SHAPE_MOUSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2846 update_mouseshape(-1);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2847
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2848 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2849 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2850 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2851
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2852 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2853 * The 'nrformats' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2854 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2855 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2856 did_set_nrformats(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2857 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2858 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2859
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2860 return did_set_opt_strings(*varp, p_nf_values, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2861 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2862
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2863 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2864 expand_set_nrformats(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2865 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2866 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2867 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2868 p_nf_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2869 sizeof(p_nf_values) / sizeof(p_nf_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2870 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2871 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2872 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2873
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2874 #if defined(FEAT_EVAL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2875 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2876 * One of the '*expr' options is changed: 'balloonexpr', 'diffexpr',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2877 * 'foldexpr', 'foldtext', 'formatexpr', 'includeexpr', 'indentexpr',
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2878 * 'patchexpr', 'printexpr' and 'charconvert'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2879 *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2880 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2881 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2882 did_set_optexpr(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2883 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2884 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2885
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2886 // If the option value starts with <SID> or s:, then replace that with
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2887 // the script identifier.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2888 char_u *name = get_scriptlocal_funcname(*varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2889 if (name != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2890 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2891 free_string_option(*varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2892 *varp = name;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2893 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2894
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2895 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2896 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2897 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2898
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2899 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2900 * The 'pastetoggle' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2901 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2902 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2903 did_set_pastetoggle(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2904 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2905 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2906
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2907 // translate key codes like in a mapping
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2908 if (*p_pt)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2909 {
32736
161ae1985d81 patch 9.0.1687: mapset() not properly handling script ID
Christian Brabandt <cb@256bit.org>
parents: 32677
diff changeset
2910 (void)replace_termcodes(p_pt, &p, 0,
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2911 REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2912 if (p != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2913 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2914 free_string_option(p_pt);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2915 p_pt = p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2916 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2917 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2918
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2919 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2920 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2921
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2922 #if defined(FEAT_PROP_POPUP) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2923 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2924 * The 'previewpopup' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2925 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2926 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2927 did_set_previewpopup(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2928 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2929 if (parse_previewpopup(NULL) == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2930 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2931
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2932 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2933 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2934
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2935 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2936 expand_set_popupoption(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2937 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2938 expand_T *xp = args->oe_xp;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2939
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2940 if (xp->xp_pattern > args->oe_set_arg && *(xp->xp_pattern-1) == ':')
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2941 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2942 // Within "highlight:"/"border:"/"align:", we have a subgroup of possible options.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2943 int border_len = STRLEN("border:");
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2944 if (xp->xp_pattern - args->oe_set_arg >= border_len &&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2945 STRNCMP(xp->xp_pattern - border_len, "border:", border_len) == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2946 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2947 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2948 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2949 p_popup_option_border_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2950 sizeof(p_popup_option_border_values) / sizeof(p_popup_option_border_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2951 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2952 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2953 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2954 int align_len = STRLEN("align:");
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2955 if (xp->xp_pattern - args->oe_set_arg >= align_len &&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2956 STRNCMP(xp->xp_pattern - align_len, "align:", align_len) == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2957 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2958 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2959 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2960 p_popup_option_align_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2961 sizeof(p_popup_option_align_values) / sizeof(p_popup_option_align_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2962 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2963 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2964 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2965 int highlight_len = STRLEN("highlight:");
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2966 if (xp->xp_pattern - args->oe_set_arg >= highlight_len &&
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2967 STRNCMP(xp->xp_pattern - highlight_len, "highlight:", highlight_len) == 0)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2968 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2969 // Return the list of all highlight names
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2970 return expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2971 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2972 get_highlight_name,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2973 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2974 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2975 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2976 return FAIL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2977 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2978
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2979 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2980 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2981 p_popup_option_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2982 sizeof(p_popup_option_values) / sizeof(p_popup_option_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2983 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2984 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
2985 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2986 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2987
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2988 #if defined(FEAT_POSTSCRIPT) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2989 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2990 * The 'printencoding' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2991 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2992 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2993 did_set_printencoding(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2994 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2995 char_u *s, *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2996
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2997 // Canonize 'printencoding' if VIM standard one
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2998 p = enc_canonize(p_penc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
2999 if (p != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3000 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3001 vim_free(p_penc);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3002 p_penc = p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3003 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3004 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3005 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3006 // Ensure lower case and '-' for '_'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3007 for (s = p_penc; *s != NUL; s++)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3008 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3009 if (*s == '_')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3010 *s = '-';
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3011 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3012 *s = TOLOWER_ASC(*s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3013 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3014 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3015
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3016 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3017 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3018 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3019
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3020 #if defined(FEAT_PRINTER) || defined(PROTO)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3021
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3022 static char_u *
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3023 get_printoptions_names(expand_T *xp UNUSED, int idx)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3024 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3025 if (idx >= (int)(sizeof(printer_opts) / sizeof(printer_opts[0])))
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3026 return NULL;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3027 return (char_u*)printer_opts[idx].name;
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3028 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3029
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3030 /*
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3031 * Expand 'printoptions' option
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3032 */
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3033 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3034 expand_set_printoptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3035 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3036 return expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3037 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3038 get_printoptions_names,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3039 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3040 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3041 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3042 #endif
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3043
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3044 #if defined(FEAT_STL_OPT) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3045 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3046 * The 'statusline' or the 'tabline' or the 'rulerformat' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3047 * "rulerformat" is TRUE if the 'rulerformat' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3048 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3049 static char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3050 parse_statustabline_rulerformat(optset_T *args, int rulerformat)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3051 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3052 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3053 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3054 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3055 int wid;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3056
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3057 if (rulerformat) // reset ru_wid first
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3058 ru_wid = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3059 s = *varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3060 if (rulerformat && *s == '%')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3061 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3062 // set ru_wid if 'ruf' starts with "%99("
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3063 if (*++s == '-') // ignore a '-'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3064 s++;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3065 wid = getdigits(&s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3066 if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3067 ru_wid = wid;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3068 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3069 errmsg = check_stl_option(p_ruf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3070 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3071 // check 'statusline' or 'tabline' only if it doesn't start with "%!"
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3072 else if (rulerformat || s[0] != '%' || s[1] != '!')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3073 errmsg = check_stl_option(s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3074 if (rulerformat && errmsg == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3075 comp_col();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3076
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3077 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3078 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3079 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3080
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3081 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3082 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3083 * The 'renderoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3084 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3085 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3086 did_set_renderoptions(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3087 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3088 if (!gui_mch_set_rendering_options(p_rop))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3089 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3090
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3091 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3092 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3093 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3094
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3095 #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3096 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3097 * The 'rightleftcmd' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3098 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3099 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3100 did_set_rightleftcmd(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3101 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3102 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3103
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3104 // Currently only "search" is a supported value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3105 if (**varp != NUL && STRCMP(*varp, "search") != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3106 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3107
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3108 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3109 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3110
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3111 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3112 expand_set_rightleftcmd(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3113 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3114 static char *(p_rlc_values[]) = {"search", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3115 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3116 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3117 p_rlc_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3118 sizeof(p_rlc_values) / sizeof(p_rlc_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3119 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3120 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3121 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3122 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3123
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3124 #if defined(FEAT_STL_OPT) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3125 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3126 * The 'rulerformat' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3127 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3128 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3129 did_set_rulerformat(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3130 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3131 return parse_statustabline_rulerformat(args, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3132 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3133 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3134
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3135 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3136 * The 'scrollopt' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3137 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3138 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3139 did_set_scrollopt(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3140 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3141 return did_set_opt_strings(p_sbo, p_scbopt_values, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3142 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3143
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3144 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3145 expand_set_scrollopt(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3146 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3147 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3148 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3149 p_scbopt_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3150 sizeof(p_scbopt_values) / sizeof(p_scbopt_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3151 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3152 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3153 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3154
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3155 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3156 * The 'selection' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3157 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3158 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3159 did_set_selection(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3160 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3161 if (*p_sel == NUL || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3162 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3163
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3164 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3165 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3166
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3167 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3168 expand_set_selection(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3169 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3170 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3171 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3172 p_sel_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3173 sizeof(p_sel_values) / sizeof(p_sel_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3174 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3175 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3176 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3177
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3178 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3179 * The 'selectmode' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3180 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3181 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3182 did_set_selectmode(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3183 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3184 return did_set_opt_strings(p_slm, p_slm_values, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3185 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3186
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3187 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3188 expand_set_selectmode(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3189 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3190 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3191 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3192 p_slm_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3193 sizeof(p_slm_values) / sizeof(p_slm_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3194 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3195 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3196 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3197
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3198 #if defined(FEAT_SESSION) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3199 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3200 * The 'sessionoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3201 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3202 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3203 did_set_sessionoptions(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3204 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3205 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3206 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3207 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3208 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3209 // Don't allow both "sesdir" and "curdir".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3210 (void)opt_strings_flags(args->os_oldval.string, p_ssop_values,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3211 &ssop_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3212 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3213 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3214
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3215 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3216 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3217
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3218 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3219 expand_set_sessionoptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3220 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3221 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3222 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3223 p_ssop_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3224 sizeof(p_ssop_values) / sizeof(p_ssop_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3225 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3226 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3227 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3228 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3229
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3230 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3231 * The 'shortmess' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3232 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3233 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3234 did_set_shortmess(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3235 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3236 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3237
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3238 return did_set_option_listflag(*varp, (char_u *)SHM_ALL, args->os_errbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3239 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3240
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3241 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3242 expand_set_shortmess(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3243 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3244 return expand_set_opt_listflag(args, (char_u*)SHM_ALL, numMatches, matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3245 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3246
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3247 #if defined(FEAT_LINEBREAK) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3248 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3249 * The 'showbreak' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3250 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3251 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3252 did_set_showbreak(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3253 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3254 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3255 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3256
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3257 for (s = *varp; *s; )
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3258 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3259 if (ptr2cells(s) != 1)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3260 return e_showbreak_contains_unprintable_or_wide_character;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3261 MB_PTR_ADV(s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3262 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3263
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3264 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3265 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3266 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3267
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3268 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3269 * The 'showcmdloc' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3270 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3271 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3272 did_set_showcmdloc(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3273 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3274 return did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3275 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3276
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3277 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3278 expand_set_showcmdloc(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3279 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3280 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3281 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3282 p_sloc_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3283 sizeof(p_sloc_values) / sizeof(p_sloc_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3284 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3285 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3286 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3287
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3288 #if defined(FEAT_SIGNS) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3289 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3290 * The 'signcolumn' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3291 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3292 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3293 did_set_signcolumn(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3294 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3295 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3296
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3297 if (check_opt_strings(*varp, p_scl_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3298 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3299 // When changing the 'signcolumn' to or from 'number', recompute the
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3300 // width of the number column if 'number' or 'relativenumber' is set.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3301 if (((*args->os_oldval.string == 'n' && args->os_oldval.string[1] == 'u')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3302 || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u'))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3303 && (curwin->w_p_nu || curwin->w_p_rnu))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3304 curwin->w_nrwidth_line_count = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3305
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3306 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3307 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3308
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3309 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3310 expand_set_signcolumn(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3311 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3312 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3313 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3314 p_scl_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3315 sizeof(p_scl_values) / sizeof(p_scl_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3316 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3317 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3318 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3319 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3320
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3321 #if defined(FEAT_SPELL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3322 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3323 * The 'spellcapcheck' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3324 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3325 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3326 did_set_spellcapcheck(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3327 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3328 // compile the regexp program.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3329 return compile_cap_prog(curwin->w_s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3330 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3331
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3332 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3333 * The 'spellfile' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3334 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3335 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3336 did_set_spellfile(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3337 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3338 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3339
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3340 if (!valid_spellfile(*varp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3341 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3342
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3343 // If there is a window for this buffer in which 'spell' is set load the
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3344 // wordlists.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3345 return did_set_spell_option(TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3346 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3347
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3348 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3349 * The 'spell' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3350 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3351 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3352 did_set_spelllang(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3353 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3354 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3355
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3356 if (!valid_spelllang(*varp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3357 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3358
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3359 // If there is a window for this buffer in which 'spell' is set load the
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3360 // wordlists.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3361 return did_set_spell_option(FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3362 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3363
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3364 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3365 * The 'spelloptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3366 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3367 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3368 did_set_spelloptions(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3369 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3370 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3371
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3372 if (**varp != NUL && STRCMP(*varp, "camel") != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3373 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3374
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3375 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3376 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3377
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3378 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3379 expand_set_spelloptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3380 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3381 static char *(p_spo_values[]) = {"camel", NULL};
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3382 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3383 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3384 p_spo_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3385 sizeof(p_spo_values) / sizeof(p_spo_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3386 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3387 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3388 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3389
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3390 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3391 * The 'spellsuggest' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3392 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3393 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3394 did_set_spellsuggest(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3395 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3396 if (spell_check_sps() != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3397 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3398
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3399 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3400 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3401
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3402 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3403 expand_set_spellsuggest(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3404 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3405 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3406 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3407 p_sps_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3408 sizeof(p_sps_values) / sizeof(p_sps_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3409 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3410 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3411 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3412 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3413
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3414 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3415 * The 'splitkeep' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3416 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3417 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3418 did_set_splitkeep(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3419 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3420 return did_set_opt_strings(p_spk, p_spk_values, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3421 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3422
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3423 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3424 expand_set_splitkeep(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3425 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3426 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3427 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3428 p_spk_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3429 sizeof(p_spk_values) / sizeof(p_spk_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3430 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3431 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3432 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3433
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3434 #if defined(FEAT_STL_OPT) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3435 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3436 * The 'statusline' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3437 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3438 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3439 did_set_statusline(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3440 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3441 return parse_statustabline_rulerformat(args, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3442 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3443 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3444
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3445 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3446 * The 'swapsync' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3447 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3448 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3449 did_set_swapsync(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3450 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3451 return did_set_opt_strings(p_sws, p_sws_values, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3452 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3453
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3454 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3455 expand_set_swapsync(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3456 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3457 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3458 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3459 p_sws_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3460 sizeof(p_sws_values) / sizeof(p_sws_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3461 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3462 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3463 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3464
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3465 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3466 * The 'switchbuf' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3467 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3468 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3469 did_set_switchbuf(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3470 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3471 return did_set_opt_flags(p_swb, p_swb_values, &swb_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3472 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3473
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3474 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3475 expand_set_switchbuf(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3476 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3477 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3478 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3479 p_swb_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3480 sizeof(p_swb_values) / sizeof(p_swb_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3481 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3482 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3483 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3484
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3485 #if defined(FEAT_STL_OPT) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3486 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3487 * The 'tabline' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3488 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3489 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3490 did_set_tabline(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3491 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3492 return parse_statustabline_rulerformat(args, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3493 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3494 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3495
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3496 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3497 * The 'tagcase' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3498 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3499 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3500 did_set_tagcase(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3501 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3502 unsigned int *flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3503 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3504
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3505 if (args->os_flags & OPT_LOCAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3506 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3507 p = curbuf->b_p_tc;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3508 flags = &curbuf->b_tc_flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3509 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3510 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3511 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3512 p = p_tc;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3513 flags = &tc_flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3514 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3515
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3516 if ((args->os_flags & OPT_LOCAL) && *p == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3517 // make the local value empty: use the global value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3518 *flags = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3519 else if (*p == NUL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3520 || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3521 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3522
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3523 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3524 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3525
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3526 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3527 expand_set_tagcase(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3528 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3529 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3530 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3531 p_tc_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3532 sizeof(p_tc_values) / sizeof(p_tc_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3533 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3534 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3535 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3536
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3537 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3538 * The 'term' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3539 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3540 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3541 did_set_term(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3542 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3543 if (T_NAME[0] == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3544 return e_cannot_set_term_to_empty_string;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3545 #ifdef FEAT_GUI
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3546 if (gui.in_use)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3547 return e_cannot_change_term_in_GUI;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3548 if (term_is_gui(T_NAME))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3549 return e_use_gui_to_start_GUI;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3550 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3551 if (set_termname(T_NAME) == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3552 return e_not_found_in_termcap;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3553
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3554 // Screen colors may have changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3555 redraw_later_clear();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3556
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3557 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3558 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3559
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3560 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3561 * Some terminal option (t_xxx) is changed
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3562 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3563 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3564 did_set_term_option(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3565 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3566 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3567
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3568 if (!full_screen)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3569 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3570
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3571 // ":set t_Co=0" and ":set t_Co=1" do ":set t_Co="
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3572 if (varp == &T_CCO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3573 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3574 int colors = atoi((char *)T_CCO);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3575
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3576 // Only reinitialize colors if t_Co value has really changed to
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3577 // avoid expensive reload of colorscheme if t_Co is set to the
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3578 // same value multiple times.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3579 if (colors != t_colors)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3580 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3581 t_colors = colors;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3582 if (t_colors <= 1)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3583 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3584 vim_free(T_CCO);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3585 T_CCO = empty_option;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3586 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3587 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3588 if (is_term_win32())
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3589 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3590 swap_tcap();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3591 args->os_did_swaptcap = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3592 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3593 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3594 // We now have a different color setup, initialize it again.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3595 init_highlight(TRUE, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3596 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3597 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3598 ttest(FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3599 if (varp == &T_ME)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3600 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3601 out_str(T_ME);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3602 redraw_later(UPD_CLEAR);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3603 #if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3604 // Since t_me has been set, this probably means that the user
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3605 // wants to use this as default colors. Need to reset default
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3606 // background/foreground colors.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3607 # ifdef VIMDLL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3608 if (!gui.in_use && !gui.starting)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3609 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3610 mch_set_normal_colors();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3611 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3612 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3613 if (varp == &T_BE && termcap_active)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3614 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3615 MAY_WANT_TO_LOG_THIS;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3616
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3617 if (*T_BE == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3618 // When clearing t_BE we assume the user no longer wants
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3619 // bracketed paste, thus disable it by writing t_BD.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3620 out_str(T_BD);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3621 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3622 out_str(T_BE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3623 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3624
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3625 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3626 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3627
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3628 #if defined(FEAT_TERMINAL) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3629 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3630 * The 'termwinkey' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3631 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3632 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3633 did_set_termwinkey(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3634 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3635 if (*curwin->w_p_twk != NUL && string_to_key(curwin->w_p_twk, TRUE) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3636 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3637
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3638 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3639 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3640
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3641 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3642 * The 'termwinsize' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3643 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3644 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3645 did_set_termwinsize(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3646 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3647 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3648
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3649 if (*curwin->w_p_tws == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3650 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3651
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3652 p = skipdigits(curwin->w_p_tws);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3653 if (p == curwin->w_p_tws
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3654 || (*p != 'x' && *p != '*')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3655 || *skipdigits(p + 1) != NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3656 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3657
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3658 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3659 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3660
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3661 # if defined(MSWIN) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3662 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3663 * The 'termwintype' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3664 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3665 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3666 did_set_termwintype(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3667 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3668 return did_set_opt_strings(p_twt, p_twt_values, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3669 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3670
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3671 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3672 expand_set_termwintype(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3673 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3674 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3675 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3676 p_twt_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3677 sizeof(p_twt_values) / sizeof(p_twt_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3678 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3679 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3680 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3681 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3682 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3683
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3684 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3685 * The 'titlestring' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3686 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3687 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3688 did_set_titlestring(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3689 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3690 int flagval = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3691
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3692 #ifdef FEAT_STL_OPT
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3693 flagval = STL_IN_TITLE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3694 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3695 return parse_titleiconstring(args, flagval);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3696 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3697
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3698 #if (defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3699 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3700 * The 'toolbar' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3701 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3702 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3703 did_set_toolbar(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3704 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3705 if (opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3706 TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3707 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3708
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3709 out_flush();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3710 gui_mch_show_toolbar((toolbar_flags &
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3711 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3712 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3713 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3714
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3715 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3716 expand_set_toolbar(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3717 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3718 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3719 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3720 p_toolbar_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3721 sizeof(p_toolbar_values) / sizeof(p_toolbar_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3722 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3723 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3724 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3725 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3726
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3727 #if (defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3728 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3729 * The 'toolbariconsize' option is changed. GTK+ 2 only.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3730 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3731 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3732 did_set_toolbariconsize(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3733 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3734 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3735 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3736
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3737 out_flush();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3738 gui_mch_show_toolbar((toolbar_flags &
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3739 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3740 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3741 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3742
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3743 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3744 expand_set_toolbariconsize(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3745 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3746 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3747 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3748 p_tbis_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3749 sizeof(p_tbis_values) / sizeof(p_tbis_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3750 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3751 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3752 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3753 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3754
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3755 #if defined(UNIX) || defined(VMS) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3756 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3757 * The 'ttymouse' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3758 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3759 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3760 did_set_ttymouse(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3761 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3762 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3763
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3764 // Switch the mouse off before changing the escape sequences used for
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3765 // that.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3766 mch_setmouse(FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3767 if (opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3768 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3769 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3770 check_mouse_termcode();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3771 if (termcap_active)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3772 setmouse(); // may switch it on again
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3773
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3774 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3775 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3776
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3777 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3778 expand_set_ttymouse(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3779 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3780 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3781 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3782 p_ttym_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3783 sizeof(p_ttym_values) / sizeof(p_ttym_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3784 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3785 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3786 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3787 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3788
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3789 #if defined(FEAT_VARTABS) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3790 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3791 * The 'varsofttabstop' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3792 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3793 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3794 did_set_varsofttabstop(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3795 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3796 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3797 char_u *cp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3798
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3799 if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*varp)[1])))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3800 VIM_CLEAR(curbuf->b_p_vsts_array);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3801 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3802 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3803 for (cp = *varp; *cp; ++cp)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3804 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3805 if (vim_isdigit(*cp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3806 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3807 if (*cp == ',' && cp > *varp && *(cp-1) != ',')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3808 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3809 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3810 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3811
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3812 int *oldarray = curbuf->b_p_vsts_array;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3813 if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)) == OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3814 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3815 if (oldarray)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3816 vim_free(oldarray);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3817 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3818 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3819 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3820 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3821
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3822 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3823 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3824
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3825 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3826 * The 'vartabstop' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3827 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3828 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3829 did_set_vartabstop(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3830 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3831 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3832 char_u *cp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3833
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3834 if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*varp)[1])))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3835 VIM_CLEAR(curbuf->b_p_vts_array);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3836 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3837 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3838 for (cp = *varp; *cp; ++cp)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3839 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3840 if (vim_isdigit(*cp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3841 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3842 if (*cp == ',' && cp > *varp && *(cp-1) != ',')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3843 continue;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3844 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3845 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3846
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3847 int *oldarray = curbuf->b_p_vts_array;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3848
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3849 if (tabstop_set(*varp, &(curbuf->b_p_vts_array)) == OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3850 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3851 vim_free(oldarray);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3852 # ifdef FEAT_FOLDING
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3853 if (foldmethodIsIndent(curwin))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3854 foldUpdateAll(curwin);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3855 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3856 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3857 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3858 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3859 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3860
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3861 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3862 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3863 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3864
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3865 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3866 * The 'verbosefile' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3867 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3868 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3869 did_set_verbosefile(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3870 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3871 verbose_stop();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3872 if (*p_vfile != NUL && verbose_open() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3873 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3874
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3875 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3876 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3877
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3878 #if defined(FEAT_SESSION) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3879 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3880 * The 'viewoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3881 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3882 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3883 did_set_viewoptions(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3884 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3885 return did_set_opt_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3886 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3887 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3888
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3889 #if defined(FEAT_VIMINFO) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3890 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3891 * The 'viminfo' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3892 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3893 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3894 did_set_viminfo(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3895 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3896 char_u *s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3897 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3898
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3899 for (s = p_viminfo; *s;)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3900 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3901 // Check it's a valid character
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3902 if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3903 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3904 errmsg = illegal_char(args->os_errbuf, *s);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3905 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3906 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3907 if (*s == 'n') // name is always last one
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3908 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3909 else if (*s == 'r') // skip until next ','
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3910 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3911 while (*++s && *s != ',')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3912 ;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3913 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3914 else if (*s == '%')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3915 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3916 // optional number
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3917 while (vim_isdigit(*++s))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3918 ;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3919 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3920 else if (*s == '!' || *s == 'h' || *s == 'c')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3921 ++s; // no extra chars
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3922 else // must have a number
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3923 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3924 while (vim_isdigit(*++s))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3925 ;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3926
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3927 if (!VIM_ISDIGIT(*(s - 1)))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3928 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3929 if (args->os_errbuf != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3930 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3931 sprintf(args->os_errbuf,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3932 _(e_missing_number_after_angle_str_angle),
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3933 transchar_byte(*(s - 1)));
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3934 errmsg = args->os_errbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3935 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3936 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3937 errmsg = "";
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3938 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3939 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3940 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3941 if (*s == ',')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3942 ++s;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3943 else if (*s)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3944 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3945 if (args->os_errbuf != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3946 errmsg = e_missing_comma;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3947 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3948 errmsg = "";
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3949 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3950 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3951 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3952 if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3953 errmsg = e_must_specify_a_value;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3954
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3955 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3956 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3957 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3958
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3959 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3960 * The 'virtualedit' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3961 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3962 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3963 did_set_virtualedit(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3964 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3965 char_u *ve = p_ve;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3966 unsigned int *flags = &ve_flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3967
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3968 if (args->os_flags & OPT_LOCAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3969 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3970 ve = curwin->w_p_ve;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3971 flags = &curwin->w_ve_flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3972 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3973
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3974 if ((args->os_flags & OPT_LOCAL) && *ve == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3975 // make the local value empty: use the global value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3976 *flags = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3977 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3978 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3979 if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3980 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3981 else if (STRCMP(ve, args->os_oldval.string) != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3982 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3983 // Recompute cursor position in case the new 've' setting
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3984 // changes something.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3985 validate_virtcol();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3986 coladvance(curwin->w_virtcol);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3987 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3988 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3989
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3990 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3991 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
3992
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3993 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3994 expand_set_virtualedit(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3995 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3996 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3997 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3998 p_ve_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
3999 sizeof(p_ve_values) / sizeof(p_ve_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4000 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4001 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4002 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4003
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4004 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4005 * The 'whichwrap' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4006 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4007 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4008 did_set_whichwrap(optset_T *args)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4009 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4010 char_u **varp = (char_u **)args->os_varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4011
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4012 // Add ',' to the list flags because 'whichwrap' is a flag
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4013 // list that is comma-separated.
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4014 return did_set_option_listflag(*varp, (char_u *)(WW_ALL ","), args->os_errbuf);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4015 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4016
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4017 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4018 expand_set_whichwrap(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4019 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4020 return expand_set_opt_listflag(args, (char_u*)WW_ALL, numMatches, matches);
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4021 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4022
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4023 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4024 * The 'wildmode' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4025 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4026 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4027 did_set_wildmode(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4028 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4029 if (check_opt_wim() == FAIL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4030 return e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4031 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4032 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4033
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4034 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4035 expand_set_wildmode(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4036 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4037 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4038 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4039 p_wim_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4040 sizeof(p_wim_values) / sizeof(p_wim_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4041 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4042 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4043 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4044
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4045 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4046 * The 'wildoptions' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4047 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4048 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4049 did_set_wildoptions(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4050 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4051 return did_set_opt_strings(p_wop, p_wop_values, TRUE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4052 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4053
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4054 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4055 expand_set_wildoptions(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4056 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4057 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4058 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4059 p_wop_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4060 sizeof(p_wop_values) / sizeof(p_wop_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4061 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4062 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4063 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4064
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4065 #if defined(FEAT_WAK) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4066 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4067 * The 'winaltkeys' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4068 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4069 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4070 did_set_winaltkeys(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4071 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4072 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4073
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4074 if (*p_wak == NUL || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4075 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4076 # ifdef FEAT_MENU
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4077 # if defined(FEAT_GUI_MOTIF)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4078 else if (gui.in_use)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4079 gui_motif_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4080 # elif defined(FEAT_GUI_GTK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4081 else if (gui.in_use)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4082 gui_gtk_set_mnemonics(p_wak[0] == 'y' || p_wak[0] == 'm');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4083 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4084 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4085 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4086 }
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4087
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4088 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4089 expand_set_winaltkeys(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4090 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4091 return expand_set_opt_string(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4092 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4093 p_wak_values,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4094 sizeof(p_wak_values) / sizeof(p_wak_values[0]) - 1,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4095 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4096 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4097 }
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4098 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4099
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4100 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4101 * The 'wincolor' option is changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4102 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4103 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4104 did_set_wincolor(optset_T *args UNUSED)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4105 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4106 #ifdef FEAT_TERMINAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4107 term_update_wincolor(curwin);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4108 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4109 return NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4110 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4111
33399
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4112 int
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4113 expand_set_wincolor(optexpand_T *args, int *numMatches, char_u ***matches)
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4114 {
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4115 return expand_set_opt_generic(
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4116 args,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4117 get_highlight_name,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4118 numMatches,
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4119 matches);
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4120 }
95db67c7b754 patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents: 33397
diff changeset
4121
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4122 #ifdef FEAT_SYN_HL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4123 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4124 * When the 'syntax' option is set, load the syntax of that name.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4125 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4126 static void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4127 do_syntax_autocmd(int value_changed)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4128 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4129 static int syn_recursive = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4130
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4131 ++syn_recursive;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4132 // Only pass TRUE for "force" when the value changed or not used
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4133 // recursively, to avoid endless recurrence.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4134 apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4135 value_changed || syn_recursive == 1, curbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4136 curbuf->b_flags |= BF_SYN_SET;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4137 --syn_recursive;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4138 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4139 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4140
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4141 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4142 * When the 'filetype' option is set, trigger the FileType autocommand.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4143 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4144 static void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4145 do_filetype_autocmd(char_u **varp, int opt_flags, int value_changed)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4146 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4147 // Skip this when called from a modeline and the filetype was already set
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4148 // to this value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4149 if ((opt_flags & OPT_MODELINE) && !value_changed)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4150 return;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4151
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4152 static int ft_recursive = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4153 int secure_save = secure;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4154
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4155 // Reset the secure flag, since the value of 'filetype' has
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4156 // been checked to be safe.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4157 secure = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4158
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4159 ++ft_recursive;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4160 did_filetype = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4161 // Only pass TRUE for "force" when the value changed or not
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4162 // used recursively, to avoid endless recurrence.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4163 apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4164 value_changed || ft_recursive == 1, curbuf);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4165 --ft_recursive;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4166 // Just in case the old "curbuf" is now invalid.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4167 if (varp != &(curbuf->b_p_ft))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4168 varp = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4169
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4170 secure = secure_save;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4171 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4172
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4173 #ifdef FEAT_SPELL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4174 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4175 * When the 'spelllang' option is set, source the spell/LANG.vim file in
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4176 * 'runtimepath'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4177 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4178 static void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4179 do_spelllang_source(void)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4180 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4181 char_u fname[200];
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4182 char_u *p;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4183 char_u *q = curwin->w_s->b_p_spl;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4184
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4185 // Skip the first name if it is "cjk".
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4186 if (STRNCMP(q, "cjk,", 4) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4187 q += 4;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4188
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4189 // They could set 'spellcapcheck' depending on the language. Use the first
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4190 // name in 'spelllang' up to '_region' or '.encoding'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4191 for (p = q; *p != NUL; ++p)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4192 if (!ASCII_ISALNUM(*p) && *p != '-')
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4193 break;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4194 if (p > q)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4195 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4196 vim_snprintf((char *)fname, 200, "spell/%.*s.vim",
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4197 (int)(p - q), q);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4198 source_runtime(fname, DIP_ALL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4199 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4200 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4201 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4202
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4203 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4204 * Handle string options that need some action to perform when changed.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4205 * The new value must be allocated.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4206 * Returns NULL for success, or an untranslated error message for an error.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4207 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4208 char *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4209 did_set_string_option(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4210 int opt_idx, // index in options[] table
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4211 char_u **varp, // pointer to the option variable
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4212 char_u *oldval, // previous value of the option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4213 char_u *value, // new value of the option
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4214 char *errbuf, // buffer for errors, or NULL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4215 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL
33420
aa7cd2253130 patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents: 33404
diff changeset
4216 set_op_T op, // OP_ADDING/OP_PREPENDING/OP_REMOVING
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4217 int *value_checked) // value was checked to be safe, no
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4218 // need to set P_INSECURE
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4219 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4220 char *errmsg = NULL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4221 long_u free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4222 opt_did_set_cb_T did_set_cb = get_option_did_set_cb(opt_idx);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4223 optset_T args;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4224
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4225 // 'ttytype' is an alias for 'term'. Both 'term' and 'ttytype' point to
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4226 // T_NAME. If 'term' or 'ttytype' is modified, then use the index for the
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4227 // 'term' option. Only set the P_ALLOCED flag on 'term'.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4228 if (varp == &T_NAME)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4229 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4230 opt_idx = findoption((char_u *)"term");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4231 if (opt_idx >= 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4232 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4233 free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4234 did_set_cb = get_option_did_set_cb(opt_idx);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4235 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4236 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4237
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4238 CLEAR_FIELD(args);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4239
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4240 // Disallow changing some options from secure mode
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4241 if ((secure
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4242 #ifdef HAVE_SANDBOX
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4243 || sandbox != 0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4244 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4245 ) && (get_option_flags(opt_idx) & P_SECURE))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4246 errmsg = e_not_allowed_here;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4247 // Check for a "normal" directory or file name in some options.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4248 else if (check_illegal_path_names(opt_idx, varp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4249 errmsg = e_invalid_argument;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4250 else if (did_set_cb != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4251 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4252 args.os_varp = (char_u *)varp;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4253 args.os_idx = opt_idx;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4254 args.os_flags = opt_flags;
33420
aa7cd2253130 patch 9.0.1968: cmdline completion should consider key option
Christian Brabandt <cb@256bit.org>
parents: 33404
diff changeset
4255 args.os_op = op;
32670
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4256 args.os_oldval.string = oldval;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4257 args.os_newval.string = value;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4258 args.os_errbuf = errbuf;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4259 // Invoke the option specific callback function to validate and apply
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4260 // the new option value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4261 errmsg = did_set_cb(&args);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4262
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4263 // The 'keymap', 'filetype' and 'syntax' option callback functions
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4264 // may change the os_value_checked field.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4265 *value_checked = args.os_value_checked;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4266 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4267
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4268 // If an error is detected, restore the previous value.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4269 if (errmsg != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4270 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4271 free_string_option(*varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4272 *varp = oldval;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4273 // When resetting some values, need to act on it.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4274 if (args.os_restore_chartab)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4275 (void)init_chartab();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4276 if (varp == &p_hl)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4277 (void)highlight_changed();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4278 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4279 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4280 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4281 #ifdef FEAT_EVAL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4282 // Remember where the option was set.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4283 set_option_sctx_idx(opt_idx, opt_flags, current_sctx);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4284 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4285 // Free string options that are in allocated memory.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4286 // Use "free_oldval", because recursiveness may change the flags under
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4287 // our fingers (esp. init_highlight()).
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4288 if (free_oldval)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4289 free_string_option(oldval);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4290 set_option_flag(opt_idx, P_ALLOCED);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4291
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4292 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4293 && is_global_local_option(opt_idx))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4294 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4295 // global option with local value set to use global value; free
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4296 // the local value and make it empty
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4297 char_u *p = get_option_varp_scope(opt_idx, OPT_LOCAL);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4298 free_string_option(*(char_u **)p);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4299 *(char_u **)p = empty_option;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4300 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4301
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4302 // May set global value for local option.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4303 else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4304 set_string_option_global(opt_idx, varp);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4305
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4306 // Trigger the autocommand only after setting the flags.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4307 #ifdef FEAT_SYN_HL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4308 if (varp == &(curbuf->b_p_syn))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4309 do_syntax_autocmd(args.os_value_changed);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4310 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4311 else if (varp == &(curbuf->b_p_ft))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4312 do_filetype_autocmd(varp, opt_flags, args.os_value_changed);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4313 #ifdef FEAT_SPELL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4314 if (varp == &(curwin->w_s->b_p_spl))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4315 do_spelllang_source();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4316 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4317 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4318
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4319 if (varp == &p_mouse)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4320 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4321 if (*p_mouse == NUL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4322 mch_setmouse(FALSE); // switch mouse off
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4323 else
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4324 setmouse(); // in case 'mouse' changed
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4325 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4326
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4327 #if defined(FEAT_LUA) || defined(PROTO)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4328 if (varp == &p_rtp)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4329 update_package_paths_in_lua();
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4330 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4331
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4332 #if defined(FEAT_LINEBREAK)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4333 // Changing Formatlistpattern when briopt includes the list setting:
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4334 // redraw
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4335 if ((varp == &p_flp || varp == &(curbuf->b_p_flp))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4336 && curwin->w_briopt_list)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4337 redraw_all_later(UPD_NOT_VALID);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4338 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4339
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4340 if (curwin->w_curswant != MAXCOL
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4341 && (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4342 curwin->w_set_curswant = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4343
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4344 if ((opt_flags & OPT_NO_REDRAW) == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4345 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4346 #ifdef FEAT_GUI
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4347 // set when changing an option that only requires a redraw in the GUI
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4348 int redraw_gui_only = FALSE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4349
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4350 if (varp == &p_go // 'guioptions'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4351 || varp == &p_guifont // 'guifont'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4352 # ifdef FEAT_GUI_TABLINE
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4353 || varp == &p_gtl // 'guitablabel'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4354 || varp == &p_gtt // 'guitabtooltip'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4355 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4356 # ifdef FEAT_XFONTSET
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4357 || varp == &p_guifontset // 'guifontset'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4358 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4359 || varp == &p_guifontwide // 'guifontwide'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4360 # ifdef FEAT_GUI_GTK
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4361 || varp == &p_guiligatures // 'guiligatures'
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4362 # endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4363 )
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4364 redraw_gui_only = TRUE;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4365
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4366 // check redraw when it's not a GUI option or the GUI is active.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4367 if (!redraw_gui_only || gui.in_use)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4368 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4369 check_redraw(get_option_flags(opt_idx));
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4370 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4371
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4372 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4373 if (args.os_did_swaptcap)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4374 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4375 set_termname((char_u *)"win32");
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4376 init_highlight(TRUE, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4377 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4378 #endif
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4379
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4380 return errmsg;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4381 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4382
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4383 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4384 * Check an option that can be a range of string values.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4385 *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4386 * Return OK for correct value, FAIL otherwise.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4387 * Empty is always OK.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4388 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4389 static int
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4390 check_opt_strings(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4391 char_u *val,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4392 char **values,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4393 int list) // when TRUE: accept a list of values
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4394 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4395 return opt_strings_flags(val, values, NULL, list);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4396 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4397
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4398 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4399 * Handle an option that can be a range of string values.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4400 * Set a flag in "*flagp" for each string present.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4401 *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4402 * Return OK for correct value, FAIL otherwise.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4403 * Empty is always OK.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4404 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4405 static int
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4406 opt_strings_flags(
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4407 char_u *val, // new value
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4408 char **values, // array of valid string values
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4409 unsigned *flagp,
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4410 int list) // when TRUE: accept a list of values
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4411 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4412 int i;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4413 int len;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4414 unsigned new_flags = 0;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4415
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4416 while (*val)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4417 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4418 for (i = 0; ; ++i)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4419 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4420 if (values[i] == NULL) // val not found in values[]
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4421 return FAIL;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4422
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4423 len = (int)STRLEN(values[i]);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4424 if (STRNCMP(values[i], val, len) == 0
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4425 && ((list && val[len] == ',') || val[len] == NUL))
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4426 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4427 val += len + (val[len] == ',');
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4428 new_flags |= (1 << i);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4429 break; // check next item in val list
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4430 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4431 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4432 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4433 if (flagp != NULL)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4434 *flagp = new_flags;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4435
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4436 return OK;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4437 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4438
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4439 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4440 * return OK if "p" is a valid fileformat name, FAIL otherwise.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4441 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4442 int
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4443 check_ff_value(char_u *p)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4444 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4445 return check_opt_strings(p, p_ff_values, FALSE);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4446 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4447
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4448 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4449 * Save the actual shortmess Flags and clear them temporarily to avoid that
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4450 * file messages overwrites any output from the following commands.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4451 *
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4452 * Caller must make sure to first call save_clear_shm_value() and then
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4453 * restore_shm_value() exactly the same number of times.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4454 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4455 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4456 save_clear_shm_value(void)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4457 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4458 if (STRLEN(p_shm) >= SHM_LEN)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4459 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4460 iemsg(e_internal_error_shortmess_too_long);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4461 return;
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4462 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4463
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4464 if (++set_shm_recursive == 1)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4465 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4466 STRCPY(shm_buf, p_shm);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4467 set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4468 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4469 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4470
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4471 /*
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4472 * Restore the shortmess Flags set from the save_clear_shm_value() function.
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4473 */
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4474 void
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4475 restore_shm_value(void)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4476 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4477 if (--set_shm_recursive == 0)
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4478 {
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4479 set_option_value_give_err((char_u *)"shm", 0L, shm_buf, 0);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4480 vim_memset(shm_buf, 0, SHM_LEN);
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4481 }
695b50472e85 Fix line endings issue
Christian Brabandt <cb@256bit.org>
parents: 32669
diff changeset
4482 }