annotate src/option.c @ 18119:40a1b1bc457e

Added tag v8.1.2054 for changeset 9b7c7754ba9d1d30ffe1c56991f98d445541c24b
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 Sep 2019 21:45:03 +0200
parents df5778d73320
children c81370b3ede4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 9959
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 * Code to handle user-settable options. This is all pretty much table-
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * driven. Checklist for adding a new option:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 * - Put it in the options array below (copy an existing entry).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 * - For a global option: Add a variable for it in option.h.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 * - For a buffer or window local option:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 * - Add a PV_XX entry to the enum below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 * - Add a variable to the window or buffer struct in structs.h.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 * - For a window option, add some code to copy_winopt().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 * - For a buffer option, add some code to buf_copy_options().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 * - For a buffer string option, add code to check_buf_options().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 * - If it's a numeric option, add any necessary bounds checks to do_set().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 * - If it's a list of flags, add some code in do_set(), search for WW_ALL.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 * - When adding an option with expansion (P_EXPAND), but with a different
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 * default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP.
10264
c036c0f636d5 commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents: 10205
diff changeset
25 * - Add documentation! One line in doc/quickref.txt, full description in
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 * options.txt, and any other related places.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 * - Add an entry in runtime/optwin.vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 * When making changes:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 * - Adjust the help for the option in doc/option.txt.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 * - When an entry has the P_VIM flag, or is lacking the P_VI_DEF flag, add a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 * comment at the help for the 'compatible' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #define IN_OPTION_C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 #include "vim.h"
18054
88b5c2b4e3d2 patch 8.1.2022: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18047
diff changeset
36 #include "optiondefs.h"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
38 static void set_options_default(int opt_flags);
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
39 static void set_string_default_esc(char *name, char_u *val, int escape);
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
40 static char_u *term_bg_default(void);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
41 static char_u *option_expand(int opt_idx, char_u *val);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
42 static void didset_options(void);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
43 static void didset_options2(void);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
44 #if defined(FEAT_EVAL) || defined(PROTO)
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
45 static long_u *insecure_flag(int opt_idx, int opt_flags);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
46 #else
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
47 # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
48 #endif
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
49 static char *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags);
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
50 static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, size_t errbuflen, int opt_flags);
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
51 static int find_key_option(char_u *arg_arg, int has_lt);
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
52 static void showoptions(int all, int opt_flags);
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
53 static int optval_default(struct vimoption *, char_u *varp, int compatible);
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
54 static void showoneopt(struct vimoption *, int opt_flags);
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
55 static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, long_u flags);
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
56 static int put_setnum(FILE *fd, char *cmd, char *name, long *valuep);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
57 static int put_setbool(FILE *fd, char *cmd, char *name, int value);
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
58 static int istermoption(struct vimoption *p);
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
59 static char_u *get_varp_scope(struct vimoption *p, int opt_flags);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
60 static char_u *get_varp(struct vimoption *);
17789
0f7ae8010787 patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents: 17781
diff changeset
61 static void check_win_options(win_T *win);
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
62 static void option_value2string(struct vimoption *, int opt_flags);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
63 static void check_winopt(winopt_T *wop);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
64 static int wc_use_keyname(char_u *varp, long *wcp);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
65 static void paste_option_changed(void);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 7697
diff changeset
66 static void compatible_set(void);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 * Initialize the options, first part.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 * Called only once from main(), just after creating the first buffer.
13361
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
72 * If "clean_arg" is TRUE Vim was started with --clean.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 void
13361
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
75 set_init_1(int clean_arg)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 int opt_idx;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 828
diff changeset
79 long_u n;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 #ifdef FEAT_LANGMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 langmap_init();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 /* Be Vi compatible by default */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 p_cp = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
88 /* Use POSIX compatibility when $VIM_POSIX is set. */
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
89 if (mch_getenv((char_u *)"VIM_POSIX") != NULL)
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
90 {
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
91 set_string_default("cpo", (char_u *)CPO_ALL);
16533
5e25171e0e75 patch 8.1.1270: cannot see current match position
Bram Moolenaar <Bram@vim.org>
parents: 16451
diff changeset
92 set_string_default("shm", (char_u *)SHM_POSIX);
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
93 }
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
94
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 * Find default value for 'shell' option.
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 148
diff changeset
97 * Don't use it if it is empty.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 */
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 148
diff changeset
99 if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
8212
05b88224cea1 commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce
Christian Brabandt <cb@256bit.org>
parents: 8182
diff changeset
100 #if defined(MSWIN)
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 148
diff changeset
101 || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
8080
b6cb94ad97a4 commit https://github.com/vim/vim/commit/6aa2cd4be287f35f95f35c2cec6d5a24f53c4d3c
Christian Brabandt <cb@256bit.org>
parents: 7829
diff changeset
102 || ((p = (char_u *)default_shell()) != NULL && *p != NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 #endif
161
6df0106fc595 updated for version 7.0049
vimboss
parents: 148
diff changeset
104 )
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
105 set_string_default_esc("sh", p, TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 #ifdef FEAT_WILDIGN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 * Set the default for 'backupskip' to include environment variables for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 * temp files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 static char *(names[4]) = {"", "TMPDIR", "TEMP", "TMP"};
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 static char *(names[3]) = {"TMPDIR", "TEMP", "TMP"};
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 # endif
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
118 int len;
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
119 garray_T ga;
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
120 int mustfree;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 ga_init2(&ga, 1, 100);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 {
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
125 mustfree = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 if (*names[n] == NUL)
13664
f64c5e636c9f patch 8.0.1704: 'backupskip' default doesn't work for Mac
Christian Brabandt <cb@256bit.org>
parents: 13632
diff changeset
128 # ifdef MACOS_X
f64c5e636c9f patch 8.0.1704: 'backupskip' default doesn't work for Mac
Christian Brabandt <cb@256bit.org>
parents: 13632
diff changeset
129 p = (char_u *)"/private/tmp";
f64c5e636c9f patch 8.0.1704: 'backupskip' default doesn't work for Mac
Christian Brabandt <cb@256bit.org>
parents: 13632
diff changeset
130 # else
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 p = (char_u *)"/tmp";
13664
f64c5e636c9f patch 8.0.1704: 'backupskip' default doesn't work for Mac
Christian Brabandt <cb@256bit.org>
parents: 13632
diff changeset
132 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 # endif
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
135 p = vim_getenv((char_u *)names[n], &mustfree);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 if (p != NULL && *p != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 /* First time count the NUL, otherwise count the ','. */
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 828
diff changeset
139 len = (int)STRLEN(p) + 3;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 if (ga_grow(&ga, len) == OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 if (ga.ga_len > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 STRCAT(ga.ga_data, ",");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 STRCAT(ga.ga_data, p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 add_pathsep(ga.ga_data);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 STRCAT(ga.ga_data, "*");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 ga.ga_len += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 }
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
150 if (mustfree)
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
151 vim_free(p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 if (ga.ga_data != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 set_string_default("bsk", ga.ga_data);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 vim_free(ga.ga_data);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 * 'maxmemtot' and 'maxmem' may have to be adjusted for available memory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 opt_idx = findoption((char_u *)"maxmemtot");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
165 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
166 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
168 if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
169 #endif
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
170 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 #ifdef HAVE_AVAIL_MEM
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
172 /* Use amount of memory available at this moment. */
3634
286ba0251c0a updated for version 7.3.577
Bram Moolenaar <bram@vim.org>
parents: 3443
diff changeset
173 n = (mch_avail_mem(FALSE) >> 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 # ifdef HAVE_TOTAL_MEM
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
176 /* Use amount of memory available to Vim. */
1110
b77f790d53f6 updated for version 7.0-236
vimboss
parents: 1080
diff changeset
177 n = (mch_total_mem(FALSE) >> 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 # else
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
179 n = (0x7fffffff >> 11);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
183 opt_idx = findoption((char_u *)"maxmem");
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
184 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
185 {
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
186 #if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
7328
6679f41bddea commit https://github.com/vim/vim/commit/35be4534c029148a89ccc41e8e465d793e7ed7c2
Christian Brabandt <cb@256bit.org>
parents: 7266
diff changeset
187 if ((long)(long_i)options[opt_idx].def_val[VI_DEFAULT] > (long)n
6679f41bddea commit https://github.com/vim/vim/commit/35be4534c029148a89ccc41e8e465d793e7ed7c2
Christian Brabandt <cb@256bit.org>
parents: 7266
diff changeset
188 || (long)(long_i)options[opt_idx].def_val[VI_DEFAULT] == 0L)
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
189 #endif
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
190 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
191 }
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
192 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 #ifdef FEAT_SEARCHPATH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 char_u *cdpath;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 int j;
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
201 int mustfree = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 /* Initialize the 'cdpath' option's default value. */
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
204 cdpath = vim_getenv((char_u *)"CDPATH", &mustfree);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 if (cdpath != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 {
16764
ef00b6bc186b patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents: 16730
diff changeset
207 buf = alloc((STRLEN(cdpath) << 1) + 2);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 if (buf != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 buf[0] = ','; /* start with ",", current dir first */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 j = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 for (i = 0; cdpath[i] != NUL; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 if (vim_ispathlistsep(cdpath[i]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 buf[j++] = ',';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 if (cdpath[i] == ' ' || cdpath[i] == ',')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 buf[j++] = '\\';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 buf[j++] = cdpath[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 buf[j] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 opt_idx = findoption((char_u *)"cdpath");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
225 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
226 {
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
227 options[opt_idx].def_val[VI_DEFAULT] = buf;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
228 options[opt_idx].flags |= P_DEF_ALLOCED;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
229 }
2445
04dae202d316 Fixes for coverity warnings.
Bram Moolenaar <bram@vim.org>
parents: 2394
diff changeset
230 else
04dae202d316 Fixes for coverity warnings.
Bram Moolenaar <bram@vim.org>
parents: 2394
diff changeset
231 vim_free(buf); /* cannot happen */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 }
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
233 if (mustfree)
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
234 vim_free(cdpath);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
239 #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 /* Set print encoding on platforms that don't default to latin1 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 set_string_default("penc",
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
242 # if defined(MSWIN)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 (char_u *)"cp1252"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 # ifdef VMS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 (char_u *)"dec-mcs"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 # ifdef EBCDIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 (char_u *)"ebcdic-uk"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 # ifdef MAC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 (char_u *)"mac-roman"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 # else /* HPUX */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 (char_u *)"hp-roman8"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 #ifdef FEAT_POSTSCRIPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 /* 'printexpr' must be allocated to be able to evaluate it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 set_string_default("pexpr",
8212
05b88224cea1 commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce
Christian Brabandt <cb@256bit.org>
parents: 8182
diff changeset
265 # if defined(MSWIN)
8
7edf9b6e4c36 Various changes
vimboss
parents: 7
diff changeset
266 (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 # ifdef VMS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 (char_u *)"system('print/delete' . (&printdevice == '' ? '' : ' /queue=' . &printdevice) . ' ' . v:fname_in)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 (char_u *)"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 * Set all the options (except the terminal options) to their default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 * value. Also set the global value for local options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 set_options_default(0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283
13361
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
284 #ifdef CLEAN_RUNTIMEPATH
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
285 if (clean_arg)
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
286 {
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
287 opt_idx = findoption((char_u *)"runtimepath");
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
288 if (opt_idx >= 0)
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
289 {
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
290 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH;
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
291 p_rtp = (char_u *)CLEAN_RUNTIMEPATH;
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
292 }
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
293 opt_idx = findoption((char_u *)"packpath");
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
294 if (opt_idx >= 0)
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
295 {
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
296 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH;
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
297 p_pp = (char_u *)CLEAN_RUNTIMEPATH;
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
298 }
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
299 }
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
300 #endif
65c29bd4548b patch 8.0.1554: custom plugins loaded with --clean
Christian Brabandt <cb@256bit.org>
parents: 13314
diff changeset
301
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 if (found_reverse_arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 curbuf->b_p_initialized = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 curbuf->b_p_ar = -1; /* no local 'autoread' value */
5446
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
309 curbuf->b_p_ul = NO_LOCAL_UNDOLEVEL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 check_buf_options(curbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 check_win_options(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 check_options();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 /* Must be before option_expand(), because that one needs vim_isIDc() */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 didset_options();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
317 #ifdef FEAT_SPELL
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
318 /* Use the current chartab for the generic chartab. This is not in
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
319 * didset_options() because it only depends on 'encoding'. */
227
ef254e0f2365 updated for version 7.0063
vimboss
parents: 221
diff changeset
320 init_spell_chartab();
ef254e0f2365 updated for version 7.0063
vimboss
parents: 221
diff changeset
321 #endif
ef254e0f2365 updated for version 7.0063
vimboss
parents: 221
diff changeset
322
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 * Expand environment variables and things like "~" for the defaults.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 * If option_expand() returns non-NULL the variable is expanded. This can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 * only happen for non-indirect options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 * Also set the default to the expanded value, so ":set" does not list
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 * them.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 * Don't set the P_ALLOCED flag, because we don't want to free the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 * default.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
332 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 if ((options[opt_idx].flags & P_GETTEXT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 && options[opt_idx].var != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 p = (char_u *)_(*(char **)options[opt_idx].var);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 p = option_expand(opt_idx, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 if (p != NULL && (p = vim_strsave(p)) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 *(char_u **)options[opt_idx].var = p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 /* VIMEXP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 * Defaults for all expanded options are currently the same for Vi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 * and Vim. When this changes, add some code here! Also need to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 * split P_DEF_ALLOCED in two.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 if (options[opt_idx].flags & P_DEF_ALLOCED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 options[opt_idx].def_val[VI_DEFAULT] = p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 options[opt_idx].flags |= P_DEF_ALLOCED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 save_file_ff(curbuf); /* Buffer is unchanged */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 #if defined(FEAT_ARABIC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 /* Detect use of mlterm.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 * Mlterm is a terminal emulator akin to xterm that has some special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 * abilities (bidi namely).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 * NOTE: mlterm's author is being asked to 'set' a variable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 * instead of an environment variable due to inheritance.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 if (mch_getenv((char_u *)"MLTERM") != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 set_option_value((char_u *)"tbidi", 1L, NULL, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
367 didset_options2();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
369 # if defined(MSWIN) && defined(FEAT_GETTEXT)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 * If $LANG isn't set, try to get a good value for it. This makes the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 * right language be used automatically. Don't do this for English.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 if (mch_getenv((char_u *)"LANG") == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 char buf[20];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 * only the first two. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 n = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 (LPTSTR)buf, 20);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 if (n >= 2 && STRNICMP(buf, "en", 2) != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 /* There are a few exceptions (probably more) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 if (STRNICMP(buf, "cht", 3) == 0 || STRNICMP(buf, "zht", 3) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 STRCPY(buf, "zh_TW");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 else if (STRNICMP(buf, "chs", 3) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 || STRNICMP(buf, "zhc", 3) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 STRCPY(buf, "zh_CN");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 else if (STRNICMP(buf, "jp", 2) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 STRCPY(buf, "ja");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 buf[2] = NUL; /* truncate to two-letter code */
8080
b6cb94ad97a4 commit https://github.com/vim/vim/commit/6aa2cd4be287f35f95f35c2cec6d5a24f53c4d3c
Christian Brabandt <cb@256bit.org>
parents: 7829
diff changeset
395 vim_setenv((char_u *)"LANG", (char_u *)buf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 }
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
398 # else
767
6c8a16911e94 updated for version 7.0225
vimboss
parents: 744
diff changeset
399 # ifdef MACOS_CONVERT
1622
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
400 /* Moved to os_mac_conv.c to avoid dependency problems. */
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
401 mac_lang_init();
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
402 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 /* enc_locale() will try to find the encoding of the current locale. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 p = enc_locale();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 if (p != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 char_u *save_enc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 /* Try setting 'encoding' and check if the value is valid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 * If not, go back to the default "latin1". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 save_enc = p_enc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 p_enc = p;
1080
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
415 if (STRCMP(p_enc, "gb18030") == 0)
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
416 {
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
417 /* We don't support "gb18030", but "cp936" is a good substitute
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
418 * for practical purposes, thus use that. It's not an alias to
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
419 * still support conversion between gb18030 and utf-8. */
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
420 p_enc = vim_strsave((char_u *)"cp936");
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
421 vim_free(p);
313ec58cdc49 updated for version 7.0-206
vimboss
parents: 1017
diff changeset
422 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 if (mb_init() == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 opt_idx = findoption((char_u *)"encoding");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
426 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
427 {
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
428 options[opt_idx].def_val[VI_DEFAULT] = p_enc;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
429 options[opt_idx].flags |= P_DEF_ALLOCED;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
430 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431
12716
351cf7c67bbe patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents: 12636
diff changeset
432 #if defined(MSWIN) || defined(MACOS_X) || defined(VMS)
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
433 if (STRCMP(p_enc, "latin1") == 0 || enc_utf8)
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 23
diff changeset
434 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
435 /* Adjust the default for 'isprint' and 'iskeyword' to match
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
436 * latin1. Also set the defaults for when 'nocompatible' is
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
437 * set. */
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 23
diff changeset
438 set_string_option_direct((char_u *)"isp", -1,
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 717
diff changeset
439 ISP_LATIN1, OPT_FREE, SID_NONE);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
440 set_string_option_direct((char_u *)"isk", -1,
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
441 ISK_LATIN1, OPT_FREE, SID_NONE);
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
442 opt_idx = findoption((char_u *)"isp");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
443 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
444 options[opt_idx].def_val[VIM_DEFAULT] = ISP_LATIN1;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
445 opt_idx = findoption((char_u *)"isk");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
446 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
447 options[opt_idx].def_val[VIM_DEFAULT] = ISK_LATIN1;
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 23
diff changeset
448 (void)init_chartab();
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 23
diff changeset
449 }
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 23
diff changeset
450 #endif
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 23
diff changeset
451
16451
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
452 #if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 /* Win32 console: When GetACP() returns a different value from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 * GetConsoleCP() set 'termencoding'. */
16451
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
455 if (
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
456 # ifdef VIMDLL
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
457 (!gui.in_use && !gui.starting) &&
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
458 # endif
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
459 GetACP() != GetConsoleCP())
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 char buf[50];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462
15725
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15713
diff changeset
463 /* Win32 console: In ConPTY, GetConsoleCP() returns zero.
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15713
diff changeset
464 * Use an alternative value. */
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15713
diff changeset
465 if (GetConsoleCP() == 0)
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15713
diff changeset
466 sprintf(buf, "cp%ld", (long)GetACP());
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15713
diff changeset
467 else
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15713
diff changeset
468 sprintf(buf, "cp%ld", (long)GetConsoleCP());
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 p_tenc = vim_strsave((char_u *)buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 if (p_tenc != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 opt_idx = findoption((char_u *)"termencoding");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
473 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
474 {
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
475 options[opt_idx].def_val[VI_DEFAULT] = p_tenc;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
476 options[opt_idx].flags |= P_DEF_ALLOCED;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
477 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 convert_setup(&input_conv, p_tenc, p_enc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 convert_setup(&output_conv, p_enc, p_tenc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 p_tenc = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 }
15597
536dd2bc5ac9 patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15555
diff changeset
484 #endif
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
485 #if defined(MSWIN)
170
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
486 /* $HOME may have characters in active code page. */
8c60f65311fa updated for version 7.0052
vimboss
parents: 168
diff changeset
487 init_homedir();
15597
536dd2bc5ac9 patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15555
diff changeset
488 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 vim_free(p_enc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 p_enc = save_enc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 #ifdef FEAT_MULTI_LANG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 /* Set the default for 'helplang'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 set_helplang_default(get_mess_lang());
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 * Set an option to its default value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 * This does not take care of side effects!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
508 set_option_default(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
509 int opt_idx,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
510 int opt_flags, /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
511 int compatible) /* use Vi default value */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 char_u *varp; /* pointer to variable for current option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 int dvi; /* index in def_val[] */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 long_u flags;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
516 long_u *flagsp;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 flags = options[opt_idx].flags;
320
bb9041b0ad81 updated for version 7.0083
vimboss
parents: 314
diff changeset
521 if (varp != NULL) /* skip hidden option, nothing to do for it */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 if (flags & P_STRING)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 {
13845
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
526 /* Use set_string_option_direct() for local options to handle
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
527 * freeing and allocating the value. */
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
528 if (options[opt_idx].indir != PV_NONE)
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
529 set_string_option_direct(NULL, opt_idx,
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
530 options[opt_idx].def_val[dvi], opt_flags, 0);
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
531 else
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
532 {
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
533 if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED))
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
534 free_string_option(*(char_u **)(varp));
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
535 *(char_u **)varp = options[opt_idx].def_val[dvi];
f22db93bd887 patch 8.0.1794: duplicate term options after renaming
Christian Brabandt <cb@256bit.org>
parents: 13823
diff changeset
536 options[opt_idx].flags &= ~P_ALLOCED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539 else if (flags & P_NUM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 {
1017
0d31f8a78ab3 updated for version 7.0-143
vimboss
parents: 1004
diff changeset
541 if (options[opt_idx].indir == PV_SCROLL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 win_comp_scroll(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 {
15713
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
545 long def_val = (long)(long_i)options[opt_idx].def_val[dvi];
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
546
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
547 if ((long *)varp == &curwin->w_p_so
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
548 || (long *)varp == &curwin->w_p_siso)
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
549 // 'scrolloff' and 'sidescrolloff' local values have a
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
550 // different default value than the global default.
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
551 *(long *)varp = -1;
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
552 else
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
553 *(long *)varp = def_val;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 /* May also set global value for local option. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 if (both)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
15713
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
557 def_val;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 else /* P_BOOL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 {
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
562 /* the cast to long is required for Manx C, long_i is needed for
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
563 * MSVC */
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
564 *(int *)varp = (int)(long)(long_i)options[opt_idx].def_val[dvi];
1111
53fd0a213cff updated for version 7.0-237
vimboss
parents: 1110
diff changeset
565 #ifdef UNIX
53fd0a213cff updated for version 7.0-237
vimboss
parents: 1110
diff changeset
566 /* 'modeline' defaults to off for root */
53fd0a213cff updated for version 7.0-237
vimboss
parents: 1110
diff changeset
567 if (options[opt_idx].indir == PV_ML && getuid() == ROOT_UID)
53fd0a213cff updated for version 7.0-237
vimboss
parents: 1110
diff changeset
568 *(int *)varp = FALSE;
53fd0a213cff updated for version 7.0-237
vimboss
parents: 1110
diff changeset
569 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 /* May also set global value for local option. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 if (both)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 *(int *)varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 }
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
575
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
576 /* The default value is not insecure. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
577 flagsp = insecure_flag(opt_idx, opt_flags);
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
578 *flagsp = *flagsp & ~P_INSECURE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 #ifdef FEAT_EVAL
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
582 set_option_sctx_idx(opt_idx, opt_flags, current_sctx);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 * Set all options (except terminal options) to their default value.
7034
e668b160ac68 commit https://github.com/vim/vim/commit/b341dda575899458f7075614dcedf0a80ee9d080
Christian Brabandt <cb@256bit.org>
parents: 7007
diff changeset
588 * When "opt_flags" is non-zero skip 'encoding'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
591 set_options_default(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
592 int opt_flags) /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 win_T *wp;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
596 tabpage_T *tp;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
598 for (i = 0; !istermoption_idx(i); i++)
7034
e668b160ac68 commit https://github.com/vim/vim/commit/b341dda575899458f7075614dcedf0a80ee9d080
Christian Brabandt <cb@256bit.org>
parents: 7007
diff changeset
599 if (!(options[i].flags & P_NODEFAULT)
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
600 && (opt_flags == 0
15597
536dd2bc5ac9 patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15555
diff changeset
601 || (options[i].var != (char_u *)&p_enc
7058
64dc5b11ad33 commit https://github.com/vim/vim/commit/5ea87a04964b0ccd017380b8247d04d2a69f6062
Christian Brabandt <cb@256bit.org>
parents: 7052
diff changeset
602 # if defined(FEAT_CRYPT)
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
603 && options[i].var != (char_u *)&p_cm
7052
9ec3329823f9 commit https://github.com/vim/vim/commit/8060687905bdadc46abb68ee6d40e5660e352297
Christian Brabandt <cb@256bit.org>
parents: 7040
diff changeset
604 && options[i].var != (char_u *)&p_key
7058
64dc5b11ad33 commit https://github.com/vim/vim/commit/5ea87a04964b0ccd017380b8247d04d2a69f6062
Christian Brabandt <cb@256bit.org>
parents: 7052
diff changeset
605 # endif
15597
536dd2bc5ac9 patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15555
diff changeset
606 )))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 set_option_default(i, opt_flags, p_cp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 /* The 'scroll' option must be computed for all windows. */
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
610 FOR_ALL_TAB_WINDOWS(tp, wp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 win_comp_scroll(wp);
6205
db3b8fe8330e updated for version 7.4.438
Bram Moolenaar <bram@vim.org>
parents: 6162
diff changeset
612 #ifdef FEAT_CINDENT
db3b8fe8330e updated for version 7.4.438
Bram Moolenaar <bram@vim.org>
parents: 6162
diff changeset
613 parse_cino(curbuf);
db3b8fe8330e updated for version 7.4.438
Bram Moolenaar <bram@vim.org>
parents: 6162
diff changeset
614 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 * Set the Vi-default value of a string option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 * Used for 'sh', 'backupskip' and 'term'.
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
620 * When "escape" is TRUE escape spaces with a backslash.
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
621 */
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
622 static void
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
623 set_string_default_esc(char *name, char_u *val, int escape)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
628 if (escape && vim_strchr(val, ' ') != NULL)
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
629 p = vim_strsave_escaped(val, (char_u *)" ");
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
630 else
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
631 p = vim_strsave(val);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 if (p != NULL) /* we don't want a NULL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 opt_idx = findoption((char_u *)name);
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
635 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
636 {
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
637 if (options[opt_idx].flags & P_DEF_ALLOCED)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
638 vim_free(options[opt_idx].def_val[VI_DEFAULT]);
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
639 options[opt_idx].def_val[VI_DEFAULT] = p;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
640 options[opt_idx].flags |= P_DEF_ALLOCED;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
641 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
645 void
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
646 set_string_default(char *name, char_u *val)
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
647 {
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
648 set_string_default_esc(name, val, FALSE);
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
649 }
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 13154
diff changeset
650
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 * Set the Vi-default value of a number option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 * Used for 'lines' and 'columns'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
656 set_number_default(char *name, long val)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 {
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
658 int opt_idx;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
659
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
660 opt_idx = findoption((char_u *)name);
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
661 if (opt_idx >= 0)
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
662 options[opt_idx].def_val[VI_DEFAULT] = (char_u *)(long_i)val;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
665 /*
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
666 * Set all window-local and buffer-local options to the Vim default.
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
667 * local-global options will use the global value.
17845
b6acc24df7de patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17833
diff changeset
668 * When "do_buffer" is FALSE don't set buffer-local options.
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
669 */
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
670 void
17845
b6acc24df7de patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17833
diff changeset
671 set_local_options_default(win_T *wp, int do_buffer)
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
672 {
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
673 win_T *save_curwin = curwin;
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
674 int i;
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
675
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
676 curwin = wp;
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
677 curbuf = curwin->w_buffer;
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
678 block_autocmds();
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
679
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
680 for (i = 0; !istermoption_idx(i); i++)
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
681 {
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
682 struct vimoption *p = &(options[i]);
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
683 char_u *varp = get_varp_scope(p, OPT_LOCAL);
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
684
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
685 if (p->indir != PV_NONE
17845
b6acc24df7de patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17833
diff changeset
686 && (do_buffer || (p->indir & PV_BUF) == 0)
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
687 && !(options[i].flags & P_NODEFAULT)
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
688 && !optval_default(p, varp, FALSE))
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
689 set_option_default(i, OPT_LOCAL, FALSE);
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
690 }
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
691
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
692 unblock_autocmds();
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
693 curwin = save_curwin;
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
694 curbuf = curwin->w_buffer;
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
695 }
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
696
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
697 #if defined(EXITFREE) || defined(PROTO)
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
698 /*
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
699 * Free all options.
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
700 */
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
701 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
702 free_all_options(void)
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
703 {
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
704 int i;
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
705
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
706 for (i = 0; !istermoption_idx(i); i++)
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
707 {
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
708 if (options[i].indir == PV_NONE)
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
709 {
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
710 /* global option: free value and default value. */
10906
7fc1df5536c9 patch 8.0.0342: double free with EXITFREE and setting 'ttytype'
Christian Brabandt <cb@256bit.org>
parents: 10887
diff changeset
711 if ((options[i].flags & P_ALLOCED) && options[i].var != NULL)
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
712 free_string_option(*(char_u **)options[i].var);
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
713 if (options[i].flags & P_DEF_ALLOCED)
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
714 free_string_option(options[i].def_val[VI_DEFAULT]);
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
715 }
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
716 else if (options[i].var != VAR_WIN
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
717 && (options[i].flags & P_STRING))
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
718 /* buffer-local option: free global value */
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
719 free_string_option(*(char_u **)options[i].var);
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
720 }
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
721 }
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
722 #endif
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
723
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
724
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 * Initialize the options, part two: After getting Rows and Columns and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 * setting 'term'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
730 set_init_2(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 {
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
732 int idx;
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
733
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 /*
12718
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents: 12716
diff changeset
735 * 'scroll' defaults to half the window height. The stored default is zero,
f8f505ffc0a6 patch 8.0.1237: ":set scroll&" often gives an error
Christian Brabandt <cb@256bit.org>
parents: 12716
diff changeset
736 * which results in the actual value computed from the window height.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 */
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
738 idx = findoption((char_u *)"scroll");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
739 if (idx >= 0 && !(options[idx].flags & P_WAS_SET))
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
740 set_option_default(idx, OPT_LOCAL, p_cp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 comp_col();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
743 /*
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
744 * 'window' is only for backwards compatibility with Vi.
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
745 * Default is Rows - 1.
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
746 */
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 842
diff changeset
747 if (!option_was_set((char_u *)"window"))
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
748 p_window = Rows - 1;
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
749 set_number_default("window", Rows - 1);
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
750
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
751 /* For DOS console the default is always black. */
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
752 #if !((defined(MSWIN)) && !defined(FEAT_GUI))
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
753 /*
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
754 * If 'background' wasn't set by the user, try guessing the value,
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
755 * depending on the terminal name. Only need to check for terminals
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
756 * with a dark background, that can handle color.
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
757 */
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
758 idx = findoption((char_u *)"bg");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
759 if (idx >= 0 && !(options[idx].flags & P_WAS_SET)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
760 && *term_bg_default() == 'd')
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
761 {
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
762 set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE, 0);
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
763 /* don't mark it as set, when starting the GUI it may be
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
764 * changed again */
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
765 options[idx].flags &= ~P_WAS_SET;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 #endif
440
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
768
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
769 #ifdef CURSOR_SHAPE
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
770 parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
771 #endif
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
772 #ifdef FEAT_MOUSESHAPE
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
773 parse_shape_opt(SHAPE_MOUSE); /* set mouse shapes from 'mouseshape' */
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
774 #endif
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
775 #ifdef FEAT_PRINTER
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
776 (void)parse_printoptions(); /* parse 'printoptions' default value */
eb531146be0e updated for version 7.0114
vimboss
parents: 419
diff changeset
777 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 /*
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
781 * Return "dark" or "light" depending on the kind of terminal.
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
782 * This is just guessing! Recognized are:
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
783 * "linux" Linux console
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
784 * "screen.linux" Linux console with screen
12383
1890536614ea patch 8.0.1071: putty-color and cygwin-color are not recognized
Christian Brabandt <cb@256bit.org>
parents: 12317
diff changeset
785 * "cygwin.*" Cygwin shell
1890536614ea patch 8.0.1071: putty-color and cygwin-color are not recognized
Christian Brabandt <cb@256bit.org>
parents: 12317
diff changeset
786 * "putty.*" Putty program
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
787 * We also check the COLORFGBG environment variable, which is set by
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
788 * rxvt and derivatives. This variable contains either two or three
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
789 * values separated by semicolons; we want the last value in either
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
790 * case. If this value is 0-6 or 8, our background is dark.
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
791 */
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
792 static char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
793 term_bg_default(void)
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
794 {
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
795 #if defined(MSWIN)
12383
1890536614ea patch 8.0.1071: putty-color and cygwin-color are not recognized
Christian Brabandt <cb@256bit.org>
parents: 12317
diff changeset
796 /* DOS console is nearly always black */
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
797 return (char_u *)"dark";
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
798 #else
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 671
diff changeset
799 char_u *p;
e649c78407e6 updated for version 7.0202
vimboss
parents: 671
diff changeset
800
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
801 if (STRCMP(T_NAME, "linux") == 0
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
802 || STRCMP(T_NAME, "screen.linux") == 0
12383
1890536614ea patch 8.0.1071: putty-color and cygwin-color are not recognized
Christian Brabandt <cb@256bit.org>
parents: 12317
diff changeset
803 || STRNCMP(T_NAME, "cygwin", 6) == 0
1890536614ea patch 8.0.1071: putty-color and cygwin-color are not recognized
Christian Brabandt <cb@256bit.org>
parents: 12317
diff changeset
804 || STRNCMP(T_NAME, "putty", 5) == 0
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
805 || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
806 && (p = vim_strrchr(p, ';')) != NULL
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
807 && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
808 && p[2] == NUL))
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
809 return (char_u *)"dark";
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
810 return (char_u *)"light";
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
811 #endif
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
812 }
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
813
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
814 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 * Initialize the options, part three: After reading the .vimrc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
818 set_init_3(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 {
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
820 #if defined(UNIX) || defined(MSWIN)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 * Set 'shellpipe' and 'shellredir', depending on the 'shell' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 * This is done after other initializations, where 'shell' might have been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 * set, but only if they have not been set before.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 int idx_srr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 int do_srr;
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
829 # ifdef FEAT_QUICKFIX
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 int idx_sp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 int do_sp;
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
832 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 idx_srr = findoption((char_u *)"srr");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
835 if (idx_srr < 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
836 do_srr = FALSE;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
837 else
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
838 do_srr = !(options[idx_srr].flags & P_WAS_SET);
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
839 # ifdef FEAT_QUICKFIX
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 idx_sp = findoption((char_u *)"sp");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
841 if (idx_sp < 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
842 do_sp = FALSE;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
843 else
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
844 do_sp = !(options[idx_sp].flags & P_WAS_SET);
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
845 # endif
5867
a6b59ee633a3 updated for version 7.4.276
Bram Moolenaar <bram@vim.org>
parents: 5735
diff changeset
846 p = get_isolated_shell_name();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 if (p != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 * Default for p_sp is "| tee", for p_srr is ">".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 * For known shells it is changed here to include stderr.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 if ( fnamecmp(p, "csh") == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 || fnamecmp(p, "tcsh") == 0
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
855 # if defined(MSWIN) // also check with .exe extension
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856 || fnamecmp(p, "csh.exe") == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 || fnamecmp(p, "tcsh.exe") == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 {
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
861 # if defined(FEAT_QUICKFIX)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 if (do_sp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 {
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
864 # ifdef MSWIN
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 p_sp = (char_u *)">&";
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
866 # else
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 p_sp = (char_u *)"|& tee";
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
868 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 }
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
871 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 if (do_srr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 p_srr = (char_u *)">&";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 else
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
879 /* Always use bourne shell style redirection if we reach this */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 if ( fnamecmp(p, "sh") == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 || fnamecmp(p, "ksh") == 0
2774
e8f012b00187 updated for version 7.3.163
Bram Moolenaar <bram@vim.org>
parents: 2726
diff changeset
882 || fnamecmp(p, "mksh") == 0
e8f012b00187 updated for version 7.3.163
Bram Moolenaar <bram@vim.org>
parents: 2726
diff changeset
883 || fnamecmp(p, "pdksh") == 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 || fnamecmp(p, "zsh") == 0
836
5a7843c57316 updated for version 7.0e02
vimboss
parents: 835
diff changeset
885 || fnamecmp(p, "zsh-beta") == 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 || fnamecmp(p, "bash") == 0
5867
a6b59ee633a3 updated for version 7.4.276
Bram Moolenaar <bram@vim.org>
parents: 5735
diff changeset
887 || fnamecmp(p, "fish") == 0
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
888 # ifdef MSWIN
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 || fnamecmp(p, "cmd") == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 || fnamecmp(p, "sh.exe") == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 || fnamecmp(p, "ksh.exe") == 0
2774
e8f012b00187 updated for version 7.3.163
Bram Moolenaar <bram@vim.org>
parents: 2726
diff changeset
892 || fnamecmp(p, "mksh.exe") == 0
e8f012b00187 updated for version 7.3.163
Bram Moolenaar <bram@vim.org>
parents: 2726
diff changeset
893 || fnamecmp(p, "pdksh.exe") == 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 || fnamecmp(p, "zsh.exe") == 0
836
5a7843c57316 updated for version 7.0e02
vimboss
parents: 835
diff changeset
895 || fnamecmp(p, "zsh-beta.exe") == 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 || fnamecmp(p, "bash.exe") == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 || fnamecmp(p, "cmd.exe") == 0
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
898 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 )
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
900 {
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
901 # if defined(FEAT_QUICKFIX)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 if (do_sp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 {
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
904 # ifdef MSWIN
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 p_sp = (char_u *)">%s 2>&1";
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
906 # else
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 p_sp = (char_u *)"2>&1| tee";
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
908 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 options[idx_sp].def_val[VI_DEFAULT] = p_sp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 }
7408
1886f2863437 commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents: 7334
diff changeset
911 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 if (do_srr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 p_srr = (char_u *)">%s 2>&1";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 options[idx_srr].def_val[VI_DEFAULT] = p_srr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 vim_free(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921
15868
7fad90423bd2 patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15858
diff changeset
922 #if defined(MSWIN)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 /*
3352
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
924 * Set 'shellcmdflag', 'shellxquote', and 'shellquote' depending on the
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
925 * 'shell' option.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 * This is done after other initializations, where 'shell' might have been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 * set, but only if they have not been set before. Default for p_shcf is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 * "/c", for p_shq is "". For "sh" like shells it is changed here to
8212
05b88224cea1 commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce
Christian Brabandt <cb@256bit.org>
parents: 8182
diff changeset
929 * "-c" and "\"". And for Win32 we need to set p_sxq instead.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 */
10
4e2284e71352 updated for version 7.0002
vimboss
parents: 8
diff changeset
931 if (strstr((char *)gettail(p_sh), "sh") != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 int idx3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 idx3 = findoption((char_u *)"shcf");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
936 if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 p_shcf = (char_u *)"-c";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 options[idx3].def_val[VI_DEFAULT] = p_shcf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 /* Somehow Win32 requires the quotes around the redirection too */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 idx3 = findoption((char_u *)"sxq");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
944 if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 p_sxq = (char_u *)"\"";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 options[idx3].def_val[VI_DEFAULT] = p_sxq;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 }
3352
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
950 else if (strstr((char *)gettail(p_sh), "cmd.exe") != NULL)
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
951 {
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
952 int idx3;
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
953
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
954 /*
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
955 * cmd.exe on Windows will strip the first and last double quote given
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
956 * on the command line, e.g. most of the time things like:
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
957 * cmd /c "my path/to/echo" "my args to echo"
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
958 * become:
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
959 * my path/to/echo" "my args to echo
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
960 * when executed.
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
961 *
3357
397e7e49bb0b updated for version 7.3.445
Bram Moolenaar <bram@vim.org>
parents: 3352
diff changeset
962 * To avoid this, set shellxquote to surround the command in
397e7e49bb0b updated for version 7.3.445
Bram Moolenaar <bram@vim.org>
parents: 3352
diff changeset
963 * parenthesis. This appears to make most commands work, without
397e7e49bb0b updated for version 7.3.445
Bram Moolenaar <bram@vim.org>
parents: 3352
diff changeset
964 * breaking commands that worked previously, such as
397e7e49bb0b updated for version 7.3.445
Bram Moolenaar <bram@vim.org>
parents: 3352
diff changeset
965 * '"path with spaces/cmd" "a&b"'.
3352
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
966 */
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
967 idx3 = findoption((char_u *)"sxq");
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
968 if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET))
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
969 {
3357
397e7e49bb0b updated for version 7.3.445
Bram Moolenaar <bram@vim.org>
parents: 3352
diff changeset
970 p_sxq = (char_u *)"(";
3352
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
971 options[idx3].def_val[VI_DEFAULT] = p_sxq;
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
972 }
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
973
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
974 idx3 = findoption((char_u *)"shcf");
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
975 if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET))
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
976 {
3357
397e7e49bb0b updated for version 7.3.445
Bram Moolenaar <bram@vim.org>
parents: 3352
diff changeset
977 p_shcf = (char_u *)"/c";
3352
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
978 options[idx3].def_val[VI_DEFAULT] = p_shcf;
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
979 }
de050fcc24cf updated for version 7.3.443
Bram Moolenaar <bram@vim.org>
parents: 3308
diff changeset
980 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982
11121
778c10516955 patch 8.0.0448: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11107
diff changeset
983 if (BUFEMPTY())
8659
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
984 {
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
985 int idx_ffs = findoption((char_u *)"ffs");
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
986
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
987 /* Apply the first entry of 'fileformats' to the initial buffer. */
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
988 if (idx_ffs >= 0 && (options[idx_ffs].flags & P_WAS_SET))
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
989 set_fileformat(default_fileformat(), OPT_LOCAL);
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
990 }
72e2f387466f commit https://github.com/vim/vim/commit/364fa5c7ec2a99a791c8f8b66fe70b0bf1dd9a41
Christian Brabandt <cb@256bit.org>
parents: 8643
diff changeset
991
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 set_title_defaults();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 * When 'helplang' is still at its default value, set it to "lang".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 * Only the first two characters of "lang" are used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
1003 set_helplang_default(char_u *lang)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 if (lang == NULL || STRLEN(lang) < 2) /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 idx = findoption((char_u *)"hlg");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
1010 if (idx >= 0 && !(options[idx].flags & P_WAS_SET))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 if (options[idx].flags & P_ALLOCED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 free_string_option(p_hlg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 p_hlg = vim_strsave(lang);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 if (p_hlg == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016 p_hlg = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 else
18
293621502c4d updated for version 7.0010
vimboss
parents: 17
diff changeset
1018 {
14997
0058cdd5b752 patch 8.1.0510: filter test fails when $LANG is C.UTF-8
Bram Moolenaar <Bram@vim.org>
parents: 14968
diff changeset
1019 // zh_CN becomes "cn", zh_TW becomes "tw"
18
293621502c4d updated for version 7.0010
vimboss
parents: 17
diff changeset
1020 if (STRNICMP(p_hlg, "zh_", 3) == 0 && STRLEN(p_hlg) >= 5)
293621502c4d updated for version 7.0010
vimboss
parents: 17
diff changeset
1021 {
293621502c4d updated for version 7.0010
vimboss
parents: 17
diff changeset
1022 p_hlg[0] = TOLOWER_ASC(p_hlg[3]);
293621502c4d updated for version 7.0010
vimboss
parents: 17
diff changeset
1023 p_hlg[1] = TOLOWER_ASC(p_hlg[4]);
293621502c4d updated for version 7.0010
vimboss
parents: 17
diff changeset
1024 }
14997
0058cdd5b752 patch 8.1.0510: filter test fails when $LANG is C.UTF-8
Bram Moolenaar <Bram@vim.org>
parents: 14968
diff changeset
1025 // any C like setting, such as C.UTF-8, becomes "en"
0058cdd5b752 patch 8.1.0510: filter test fails when $LANG is C.UTF-8
Bram Moolenaar <Bram@vim.org>
parents: 14968
diff changeset
1026 else if (STRLEN(p_hlg) >= 1 && *p_hlg == 'C')
0058cdd5b752 patch 8.1.0510: filter test fails when $LANG is C.UTF-8
Bram Moolenaar <Bram@vim.org>
parents: 14968
diff changeset
1027 {
0058cdd5b752 patch 8.1.0510: filter test fails when $LANG is C.UTF-8
Bram Moolenaar <Bram@vim.org>
parents: 14968
diff changeset
1028 p_hlg[0] = 'e';
0058cdd5b752 patch 8.1.0510: filter test fails when $LANG is C.UTF-8
Bram Moolenaar <Bram@vim.org>
parents: 14968
diff changeset
1029 p_hlg[1] = 'n';
0058cdd5b752 patch 8.1.0510: filter test fails when $LANG is C.UTF-8
Bram Moolenaar <Bram@vim.org>
parents: 14968
diff changeset
1030 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 p_hlg[2] = NUL;
18
293621502c4d updated for version 7.0010
vimboss
parents: 17
diff changeset
1032 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 options[idx].flags |= P_ALLOCED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 static char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
1040 gui_bg_default(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 if (gui_get_lightness(gui.back_pixel) < 127)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 return (char_u *)"dark";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 return (char_u *)"light";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 * Option initializations that can only be done after opening the GUI window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
1051 init_gui_options(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 /* Set the 'background' option according to the lightness of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 * background color, unless the user has set it already. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 highlight_changed();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 * 'title' and 'icon' only default to true if they have not been set or reset
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 * in .vimrc and we can read the old value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 * When 'title' and 'icon' have been reset in .vimrc, we won't even check if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 * they can be reset. This reduces startup time when using X on a remote
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 * machine.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
1072 set_title_defaults(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 int idx1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 long val;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 * If GUI is (going to be) used, we can always set the window title and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 * icon name. Saves a bit of time, because the X11 display server does
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 * not need to be contacted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 idx1 = findoption((char_u *)"title");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
1083 if (idx1 >= 0 && !(options[idx1].flags & P_WAS_SET))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 if (gui.starting || gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 val = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 val = mch_can_restore_title();
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
1091 options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 p_title = val;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 idx1 = findoption((char_u *)"icon");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
1095 if (idx1 >= 0 && !(options[idx1].flags & P_WAS_SET))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 if (gui.starting || gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 val = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 val = mch_can_restore_icon();
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
1103 options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 p_icon = val;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 * Parse 'arg' for option settings.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 * 'arg' may be IObuff, but only when no errors can be present and option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 * does not need to be expanded with option_expand().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 * "opt_flags":
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 * 0 for ":set"
717
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1116 * OPT_GLOBAL for ":setglobal"
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1117 * OPT_LOCAL for ":setlocal" and a modeline
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 * OPT_MODELINE for a modeline
717
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1119 * OPT_WINONLY to only set window-local options
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1120 * OPT_NOWIN to skip setting window-local options
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 * returns FAIL if an error is detected, OK otherwise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
1125 do_set(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
1126 char_u *arg, /* option string (may be written to!) */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
1127 int opt_flags)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 int opt_idx;
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1130 char *errmsg;
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1131 char errbuf[80];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 char_u *startarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 int nextchar; /* next non-white char after option name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 int afterchar; /* character just after option name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 int i;
9389
32e34e574716 commit https://github.com/vim/vim/commit/22fcfad29276bd5f317faf516637dcd491b96a12
Christian Brabandt <cb@256bit.org>
parents: 9359
diff changeset
1138 varnumber_T value;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 int key;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 long_u flags; /* flags for current option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 char_u *varp = NULL; /* pointer to variable for current option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 int did_show = FALSE; /* already showed one value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 int adding; /* "opt+=arg" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 int prepending; /* "opt^=arg" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 int removing; /* "opt-=arg" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 int cp_val = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 char_u key_name[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 if (*arg == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 showoptions(0, opt_flags);
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
1152 did_show = TRUE;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
1153 goto theend;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 while (*arg != NUL) /* loop to process all options */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 errmsg = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 startarg = arg; /* remember for error message */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160
36
125e80798a85 updated for version 7.0021
vimboss
parents: 29
diff changeset
1161 if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
125e80798a85 updated for version 7.0021
vimboss
parents: 29
diff changeset
1162 && !(opt_flags & OPT_MODELINE))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 * ":set all" show all options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 * ":set all&" set all options to their default value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 arg += 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 if (*arg == '&')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 ++arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 /* Only for :set command set global value of local options. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 set_options_default(OPT_FREE | opt_flags);
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
1174 didset_options();
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
1175 didset_options2();
7034
e668b160ac68 commit https://github.com/vim/vim/commit/b341dda575899458f7075614dcedf0a80ee9d080
Christian Brabandt <cb@256bit.org>
parents: 7007
diff changeset
1176 redraw_all_later(CLEAR);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 else
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
1179 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 showoptions(1, opt_flags);
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
1181 did_show = TRUE;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
1182 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 29
diff changeset
1184 else if (STRNCMP(arg, "termcap", 7) == 0 && !(opt_flags & OPT_MODELINE))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 showoptions(2, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 show_termcodes();
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
1188 did_show = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 arg += 7;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 prefix = 1;
1911
afbe4a4c884c updated for version 7.2-208
vimboss
parents: 1904
diff changeset
1194 if (STRNCMP(arg, "no", 2) == 0 && STRNCMP(arg, "novice", 6) != 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 prefix = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 arg += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 else if (STRNCMP(arg, "inv", 3) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 prefix = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 arg += 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 /* find end of name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 key = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 if (*arg == '<')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 opt_idx = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 /* look out for <t_>;> */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 len = 5;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 len = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 while (arg[len] != NUL && arg[len] != '>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 if (arg[len] != '>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 arg[len] = NUL; /* put NUL after name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 if (arg[1] == 't' && arg[2] == '_') /* could be term code */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 opt_idx = findoption(arg + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 arg[len++] = '>'; /* restore '>' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 if (opt_idx == -1)
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
1229 key = find_key_option(arg + 1, TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233 len = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 * The two characters after "t_" may not be alphanumeric.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 len = 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 while (ASCII_ISALNUM(arg[len]) || arg[len] == '_')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 nextchar = arg[len];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 arg[len] = NUL; /* put NUL after name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 opt_idx = findoption(arg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 arg[len] = nextchar; /* restore nextchar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 if (opt_idx == -1)
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
1247 key = find_key_option(arg, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 /* remember character after option name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 afterchar = arg[len];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 /* skip white space, allow ":set ai ?" */
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
1254 while (VIM_ISWHITE(arg[len]))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 adding = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 prepending = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 removing = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 if (arg[len] != NUL && arg[len + 1] == '=')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 if (arg[len] == '+')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 adding = TRUE; /* "+=" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 else if (arg[len] == '^')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 prepending = TRUE; /* "^=" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 else if (arg[len] == '-')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 removing = TRUE; /* "-=" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 nextchar = arg[len];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 if (opt_idx == -1 && key == 0) /* found a mismatch: skip */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1282 errmsg = N_("E518: Unknown option");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 if (opt_idx >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 if (options[opt_idx].var == NULL) /* hidden option: skip */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290 /* Only give an error message when requesting the value of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 * a hidden option, ignore setting it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 && (!(options[opt_idx].flags & P_BOOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 || nextchar == '?'))
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1295 errmsg = N_("E519: Option not supported");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299 flags = options[opt_idx].flags;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 flags = P_STRING;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 if (key < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 key_name[0] = KEY2TERMCAP0(key);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 key_name[1] = KEY2TERMCAP1(key);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 key_name[0] = KS_KEY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313 key_name[1] = (key & 0xff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
1317 /* Skip all options that are not window-local (used when showing
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
1318 * an already loaded buffer in a window). */
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
1319 if ((opt_flags & OPT_WINONLY)
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
1320 && (opt_idx < 0 || options[opt_idx].var != VAR_WIN))
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
1321 goto skip;
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
1322
717
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1323 /* Skip all options that are window-local (used for :vimgrep). */
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1324 if ((opt_flags & OPT_NOWIN) && opt_idx >= 0
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1325 && options[opt_idx].var == VAR_WIN)
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1326 goto skip;
2fa8cb05b861 updated for version 7.0218
vimboss
parents: 714
diff changeset
1327
1807
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1328 /* Disallow changing some options from modelines. */
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1329 if (opt_flags & OPT_MODELINE)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 {
2317
2b2cd34569eb Disallow setting 'enc' in a modeline. (Patrick Texier)
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
1331 if (flags & (P_SECURE | P_NO_ML))
1807
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1332 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1333 errmsg = _("E520: Not allowed in a modeline");
1807
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1334 goto skip;
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1335 }
16728
e55c26aaf484 patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents: 16706
diff changeset
1336 if ((flags & P_MLE) && !p_mle)
e55c26aaf484 patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents: 16706
diff changeset
1337 {
e55c26aaf484 patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents: 16706
diff changeset
1338 errmsg = _("E992: Not allowed in a modeline when 'modelineexpr' is off");
e55c26aaf484 patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents: 16706
diff changeset
1339 goto skip;
e55c26aaf484 patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents: 16706
diff changeset
1340 }
1810
5d84650b569c updated for version 7.2-108
vimboss
parents: 1807
diff changeset
1341 #ifdef FEAT_DIFF
1807
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1342 /* In diff mode some options are overruled. This avoids that
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1343 * 'foldmethod' becomes "marker" instead of "diff" and that
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1344 * "wrap" gets set. */
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1345 if (curwin->w_p_diff
2445
04dae202d316 Fixes for coverity warnings.
Bram Moolenaar <bram@vim.org>
parents: 2394
diff changeset
1346 && opt_idx >= 0 /* shut up coverity warning */
11073
d2178a6cc9f3 patch 8.0.0425: build errors when building without folding
Christian Brabandt <cb@256bit.org>
parents: 11063
diff changeset
1347 && (
d2178a6cc9f3 patch 8.0.0425: build errors when building without folding
Christian Brabandt <cb@256bit.org>
parents: 11063
diff changeset
1348 #ifdef FEAT_FOLDING
d2178a6cc9f3 patch 8.0.0425: build errors when building without folding
Christian Brabandt <cb@256bit.org>
parents: 11063
diff changeset
1349 options[opt_idx].indir == PV_FDM ||
d2178a6cc9f3 patch 8.0.0425: build errors when building without folding
Christian Brabandt <cb@256bit.org>
parents: 11063
diff changeset
1350 #endif
d2178a6cc9f3 patch 8.0.0425: build errors when building without folding
Christian Brabandt <cb@256bit.org>
parents: 11063
diff changeset
1351 options[opt_idx].indir == PV_WRAP))
1807
a66c40578675 updated for version 7.2-105
vimboss
parents: 1805
diff changeset
1352 goto skip;
1810
5d84650b569c updated for version 7.2-108
vimboss
parents: 1807
diff changeset
1353 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356 #ifdef HAVE_SANDBOX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 /* Disallow changing some options in the sandbox */
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
1358 if (sandbox != 0 && (flags & P_SECURE))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1360 errmsg = _(e_sandbox);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 arg += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 cp_val = p_cp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 if (arg[3] == 'm') /* "opt&vim": set to Vim default */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 cp_val = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 arg += 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 else /* "opt&vi": set to Vi default */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 cp_val = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 arg += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382 if (vim_strchr((char_u *)"?!&<", nextchar) != NULL
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
1383 && arg[1] != NUL && !VIM_ISWHITE(arg[1]))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385 errmsg = e_trailing;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 /*
8212
05b88224cea1 commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce
Christian Brabandt <cb@256bit.org>
parents: 8182
diff changeset
1391 * allow '=' and ':' for hystorical reasons (MSDOS command.com
05b88224cea1 commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce
Christian Brabandt <cb@256bit.org>
parents: 8182
diff changeset
1392 * allows only one '=' character per "set" command line. grrr. (jw)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 if (nextchar == '?'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 || (prefix == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 && vim_strchr((char_u *)"=:&<", nextchar) == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 && !(flags & P_BOOL)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 * print value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 if (did_show)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403 msg_putchar('\n'); /* cursor below last one */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 gotocmdline(TRUE); /* cursor at status line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 did_show = TRUE; /* remember that we did a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 if (opt_idx >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 showoneopt(&options[opt_idx], opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 #ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 if (p_verbose > 0)
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1414 {
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1415 /* Mention where the option was last set. */
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1416 if (varp == options[opt_idx].var)
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
1417 last_set_msg(options[opt_idx].script_ctx);
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1418 else if ((int)options[opt_idx].indir & PV_WIN)
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
1419 last_set_msg(curwin->w_p_script_ctx[
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1420 (int)options[opt_idx].indir & PV_MASK]);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1421 else if ((int)options[opt_idx].indir & PV_BUF)
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
1422 last_set_msg(curbuf->b_p_script_ctx[
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1423 (int)options[opt_idx].indir & PV_MASK]);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
1424 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 p = find_termcode(key_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 if (p == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1434 errmsg = N_("E846: Key code not set");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 (void)show_one_termcode(key_name, p, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 if (nextchar != '?'
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
1441 && nextchar != NUL && !VIM_ISWHITE(afterchar))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 errmsg = e_trailing;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 {
15058
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1446 int value_is_replaced = !prepending && !adding && !removing;
15066
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
1447 int value_checked = FALSE;
15058
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1448
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 if (flags & P_BOOL) /* boolean */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 if (nextchar == '=' || nextchar == ':')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 * ":set opt!": invert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 * ":set opt&": reset to default value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 * ":set opt<": reset to global value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 if (nextchar == '!')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463 value = *(int *)(varp) ^ 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 else if (nextchar == '&')
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
1465 value = (int)(long)(long_i)options[opt_idx].def_val[
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 ((flags & P_VI_DEF) || cp_val)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 ? VI_DEFAULT : VIM_DEFAULT];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 else if (nextchar == '<')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 /* For 'autoread' -1 means to use global value. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 if ((int *)varp == &curbuf->b_p_ar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 && opt_flags == OPT_LOCAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 value = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475 value = *(int *)get_varp_scope(&(options[opt_idx]),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 OPT_GLOBAL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 * ":set invopt": invert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 * ":set opt" or ":set noopt": set or reset
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483 */
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
1484 if (nextchar != NUL && !VIM_ISWHITE(afterchar))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 errmsg = e_trailing;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 if (prefix == 2) /* inv */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 value = *(int *)(varp) ^ 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 value = prefix;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 errmsg = set_bool_option(opt_idx, varp, (int)value,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 else /* numeric or string */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 if (vim_strchr((char_u *)"=:&<", nextchar) == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 || prefix != 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 if (flags & P_NUM) /* numeric */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 * Different ways to set a number option:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 * & set to default value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 * < set to global value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513 * <xx> accept special key codes for 'wildchar'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 * c accept any non-digit for 'wildchar'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 * [-]0-9 set number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 * other error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 ++arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 if (nextchar == '&')
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
1520 value = (long)(long_i)options[opt_idx].def_val[
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 ((flags & P_VI_DEF) || cp_val)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 ? VI_DEFAULT : VIM_DEFAULT];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 else if (nextchar == '<')
5446
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1524 {
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1525 /* For 'undolevels' NO_LOCAL_UNDOLEVEL means to
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1526 * use the global value. */
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1527 if ((long *)varp == &curbuf->b_p_ul
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1528 && opt_flags == OPT_LOCAL)
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1529 value = NO_LOCAL_UNDOLEVEL;
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1530 else
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1531 value = *(long *)get_varp_scope(
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1532 &(options[opt_idx]), OPT_GLOBAL);
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
1533 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 else if (((long *)varp == &p_wc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 || (long *)varp == &p_wcm)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 && (*arg == '<'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 || *arg == '^'
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
1538 || (*arg != NUL
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
1539 && (!arg[1] || VIM_ISWHITE(arg[1]))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 && !VIM_ISDIGIT(*arg))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 {
11764
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
1542 value = string_to_key(arg, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543 if (value == 0 && (long *)varp != &p_wcm)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 else if (*arg == '-' || VIM_ISDIGIT(*arg))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 {
6551
4e31d9f7c896 updated for version 7.4.602
Bram Moolenaar <bram@vim.org>
parents: 6415
diff changeset
1551 /* Allow negative (for 'undolevels'), octal and
4e31d9f7c896 updated for version 7.4.602
Bram Moolenaar <bram@vim.org>
parents: 6415
diff changeset
1552 * hex numbers. */
7447
ad432f8f68fb commit https://github.com/vim/vim/commit/887c1fea4a114e7170091942d0446c8882701b5b
Christian Brabandt <cb@256bit.org>
parents: 7426
diff changeset
1553 vim_str2nr(arg, NULL, &i, STR2NR_ALL,
16706
77bcb5055fec patch 8.1.1355: obvious mistakes are accepted as valid expressions
Bram Moolenaar <Bram@vim.org>
parents: 16606
diff changeset
1554 &value, NULL, 0, TRUE);
17039
d726d8cce996 patch 8.1.1519: 'backupskip' may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
1555 if (i == 0 || (arg[i] != NUL
d726d8cce996 patch 8.1.1519: 'backupskip' may contain duplicates
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
1556 && !VIM_ISWHITE(arg[i])))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 {
16706
77bcb5055fec patch 8.1.1355: obvious mistakes are accepted as valid expressions
Bram Moolenaar <Bram@vim.org>
parents: 16606
diff changeset
1558 errmsg = N_("E521: Number required after =");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1564 errmsg = N_("E521: Number required after =");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 if (adding)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 value = *(long *)varp + value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 if (prepending)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 value = *(long *)varp * value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 if (removing)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 value = *(long *)varp - value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 errmsg = set_num_option(opt_idx, varp, value,
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 258
diff changeset
1575 errbuf, sizeof(errbuf), opt_flags);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 else if (opt_idx >= 0) /* string */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 {
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1579 char_u *save_arg = NULL;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1580 char_u *s = NULL;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1581 char_u *oldval = NULL; /* previous value if *varp */
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1582 char_u *newval;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1583 char_u *origval = NULL;
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1584 char_u *origval_l = NULL;
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1585 char_u *origval_g = NULL;
13380
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
1586 #if defined(FEAT_EVAL)
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1587 char_u *saved_origval = NULL;
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1588 char_u *saved_origval_l = NULL;
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1589 char_u *saved_origval_g = NULL;
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1590 char_u *saved_newval = NULL;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1591 #endif
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1592 unsigned newlen;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1593 int comma;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1594 int bs;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1595 int new_value_alloced; /* new string option
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 was allocated */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 /* When using ":set opt=val" for a global option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 * with a local value the local value will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 * reset, use the global value here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 688
diff changeset
1602 && ((int)options[opt_idx].indir & PV_BOTH))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 varp = options[opt_idx].var;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 /* The old value is kept until we are sure that the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 * new value is valid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 oldval = *(char_u **)varp;
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1608
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1609 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1610 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1611 origval_l = *(char_u **)get_varp_scope(
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1612 &(options[opt_idx]), OPT_LOCAL);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1613 origval_g = *(char_u **)get_varp_scope(
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1614 &(options[opt_idx]), OPT_GLOBAL);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1615
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1616 // A global-local string option might have an empty
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1617 // option as value to indicate that the global
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1618 // value should be used.
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1619 if (((int)options[opt_idx].indir & PV_BOTH)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1620 && origval_l == empty_option)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1621 origval_l = origval_g;
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1622 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1623
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1624 // When setting the local value of a global
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1625 // option, the old value may be the global value.
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1626 if (((int)options[opt_idx].indir & PV_BOTH)
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1627 && (opt_flags & OPT_LOCAL))
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1628 origval = *(char_u **)get_varp(
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1629 &options[opt_idx]);
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1630 else
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1631 origval = oldval;
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1632
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 if (nextchar == '&') /* set to default val */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635 newval = options[opt_idx].def_val[
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 ((flags & P_VI_DEF) || cp_val)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 ? VI_DEFAULT : VIM_DEFAULT];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 if ((char_u **)varp == &p_bg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 /* guess the value of 'background' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 newval = gui_bg_default();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 #endif
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
1646 newval = term_bg_default();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 /* expand environment variables and ~ (since the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 * default value was already expanded, only
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 * required when an environment variable was set
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 * later */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 if (newval == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 newval = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 s = option_expand(opt_idx, newval);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 if (s == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 s = newval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 newval = vim_strsave(s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 new_value_alloced = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 else if (nextchar == '<') /* set to global val */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 newval = vim_strsave(*(char_u **)get_varp_scope(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 &(options[opt_idx]), OPT_GLOBAL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 new_value_alloced = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 ++arg; /* jump to after the '=' or ':' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 * Set 'keywordprg' to ":help" if an empty
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 * value was passed to :set by the user.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 * Misuse errbuf[] for the resulting string.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 if (varp == (char_u *)&p_kp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 && (*arg == NUL || *arg == ' '))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 STRCPY(errbuf, ":help");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 save_arg = arg;
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1684 arg = (char_u *)errbuf;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 /*
3168
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1687 * Convert 'backspace' number to string, for
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1688 * adding, prepending and removing string.
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1689 */
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1690 else if (varp == (char_u *)&p_bs
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1691 && VIM_ISDIGIT(**(char_u **)varp))
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1692 {
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1693 i = getdigits((char_u **)varp);
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1694 switch (i)
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1695 {
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1696 case 0:
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1697 *(char_u **)varp = empty_option;
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1698 break;
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1699 case 1:
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1700 *(char_u **)varp = vim_strsave(
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1701 (char_u *)"indent,eol");
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1702 break;
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1703 case 2:
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1704 *(char_u **)varp = vim_strsave(
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1705 (char_u *)"indent,eol,start");
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1706 break;
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1707 }
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1708 vim_free(oldval);
12190
497b78526358 patch 8.0.0975: using freed memory when setting 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 12188
diff changeset
1709 if (origval == oldval)
497b78526358 patch 8.0.0975: using freed memory when setting 'backspace'
Christian Brabandt <cb@256bit.org>
parents: 12188
diff changeset
1710 origval = *(char_u **)varp;
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1711 if (origval_l == oldval)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1712 origval_l = *(char_u **)varp;
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1713 if (origval_g == oldval)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1714 origval_g = *(char_u **)varp;
3168
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1715 oldval = *(char_u **)varp;
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1716 }
6672b1645306 updated for version 7.3.354
Bram Moolenaar <bram@vim.org>
parents: 3129
diff changeset
1717 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 * Convert 'whichwrap' number to string, for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719 * backwards compatibility with Vim 3.0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720 * Misuse errbuf[] for the resulting string.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722 else if (varp == (char_u *)&p_ww
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723 && VIM_ISDIGIT(*arg))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 *errbuf = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 i = getdigits(&arg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 if (i & 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 STRCAT(errbuf, "b,");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 if (i & 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 STRCAT(errbuf, "s,");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731 if (i & 4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 STRCAT(errbuf, "h,l,");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 if (i & 8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 STRCAT(errbuf, "<,>,");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 if (i & 16)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 STRCAT(errbuf, "[,],");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 if (*errbuf != NUL) /* remove trailing , */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 errbuf[STRLEN(errbuf) - 1] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 save_arg = arg;
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
1740 arg = (char_u *)errbuf;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 * Remove '>' before 'dir' and 'bdir', for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 * backwards compatibility with version 3.0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 else if ( *arg == '>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 && (varp == (char_u *)&p_dir
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 || varp == (char_u *)&p_bdir))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 ++arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 * Copy the new string into allocated memory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 * Can't use set_string_option_direct(), because
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 * we need to remove the backslashes.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758 /* get a bit too much */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 newlen = (unsigned)STRLEN(arg) + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 if (adding || prepending || removing)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 newlen += (unsigned)STRLEN(origval) + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 newval = alloc(newlen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 if (newval == NULL) /* out of mem, don't change */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 s = newval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 * Copy the string, skip over escaped chars.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 * For MS-DOS and WIN32 backslashes before normal
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 * file name characters are not removed, and keep
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 * backslash at start, for "\\machine\path", but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 * do remove it for "\\\\machine\\path".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 * The reverse is found in ExpandOldSetting().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 */
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
1775 while (*arg && !VIM_ISWHITE(*arg))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 if (*arg == '\\' && arg[1] != NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 #ifdef BACKSLASH_IN_FILENAME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 && !((flags & P_EXPAND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 && vim_isfilec(arg[1])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 && (arg[1] != '\\'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782 || (s == newval
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783 && arg[2] != '\\')))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 ++arg; /* remove backslash */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 if (has_mbyte
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 448
diff changeset
1788 && (i = (*mb_ptr2len)(arg)) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 /* copy multibyte char */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 mch_memmove(s, arg, (size_t)i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 arg += i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 s += i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 *s++ = *arg++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 *s = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 * Expand environment variables and ~.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 * Don't do it when adding without inserting a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 * comma.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 if (!(adding || prepending || removing)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806 || (flags & P_COMMA))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 s = option_expand(opt_idx, newval);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 if (s != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 vim_free(newval);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 newlen = (unsigned)STRLEN(s) + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 if (adding || prepending || removing)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 newlen += (unsigned)STRLEN(origval) + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 newval = alloc(newlen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 if (newval == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 STRCPY(newval, s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 /* locate newval[] in origval[] when removing it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 * and when adding to avoid duplicates */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 i = 0; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 if (removing || (flags & P_NODUP))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 i = (int)STRLEN(newval);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 bs = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 for (s = origval; *s; ++s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 if ((!(flags & P_COMMA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 || s == origval
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 || (s[-1] == ',' && !(bs & 1)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 && STRNCMP(s, newval, i) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 && (!(flags & P_COMMA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 || s[i] == ','
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 || s[i] == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 break;
2726
0d201adaf9c5 updated for version 7.3.141
Bram Moolenaar <bram@vim.org>
parents: 2685
diff changeset
1839 /* Count backslashes. Only a comma with an
7426
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1840 * even number of backslashes or a single
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1841 * backslash preceded by a comma before it
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1842 * is recognized as a separator */
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1843 if ((s > origval + 1
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1844 && s[-1] == '\\'
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1845 && s[-2] != ',')
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1846 || (s == origval + 1
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1847 && s[-1] == '\\'))
779a7c14c795 commit https://github.com/vim/vim/commit/8f79acdf7ede2693fbda53c3c9693f16db4f193b
Christian Brabandt <cb@256bit.org>
parents: 7410
diff changeset
1848
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 ++bs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1850 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 bs = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 /* do not add if already there */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855 if ((adding || prepending) && *s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 prepending = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 adding = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 STRCPY(newval, origval);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863 /* concatenate the two strings; add a ',' if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 * needed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 if (adding || prepending)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867 comma = ((flags & P_COMMA) && *origval != NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 && *newval != NUL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 if (adding)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871 i = (int)STRLEN(origval);
6841
0f1cc87630d8 patch 7.4.741
Bram Moolenaar <bram@vim.org>
parents: 6817
diff changeset
1872 /* strip a trailing comma, would get 2 */
7212
55c67e16e4fd commit https://github.com/vim/vim/commit/174674743d9a2d7361c9cd89836f8dd8651edeeb
Christian Brabandt <cb@256bit.org>
parents: 7204
diff changeset
1873 if (comma && i > 1
55c67e16e4fd commit https://github.com/vim/vim/commit/174674743d9a2d7361c9cd89836f8dd8651edeeb
Christian Brabandt <cb@256bit.org>
parents: 7204
diff changeset
1874 && (flags & P_ONECOMMA) == P_ONECOMMA
55c67e16e4fd commit https://github.com/vim/vim/commit/174674743d9a2d7361c9cd89836f8dd8651edeeb
Christian Brabandt <cb@256bit.org>
parents: 7204
diff changeset
1875 && origval[i - 1] == ','
55c67e16e4fd commit https://github.com/vim/vim/commit/174674743d9a2d7361c9cd89836f8dd8651edeeb
Christian Brabandt <cb@256bit.org>
parents: 7204
diff changeset
1876 && origval[i - 2] != '\\')
6841
0f1cc87630d8 patch 7.4.741
Bram Moolenaar <bram@vim.org>
parents: 6817
diff changeset
1877 i--;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 mch_memmove(newval + i + comma, newval,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879 STRLEN(newval) + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 mch_memmove(newval, origval, (size_t)i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1881 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 i = (int)STRLEN(newval);
1622
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
1885 STRMOVE(newval + i + comma, origval);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887 if (comma)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888 newval[i] = ',';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891 /* Remove newval[] from origval[]. (Note: "i" has
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 * been set above and is used here). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893 if (removing)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895 STRCPY(newval, origval);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896 if (*s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 /* may need to remove a comma */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 if (flags & P_COMMA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901 if (s == origval)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 /* include comma after string */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904 if (s[i] == ',')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 ++i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 /* include comma before string */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1910 --s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 ++i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913 }
1622
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
1914 STRMOVE(newval + (s - origval), s + i);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1915 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918 if (flags & P_FLAGLIST)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920 /* Remove flags that appear twice. */
10831
e926c5a7f9bf patch 8.0.0305: invalid memory access when option has duplicate flag
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
1921 for (s = newval; *s;)
9798
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1922 {
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1923 /* if options have P_FLAGLIST and
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1924 * P_ONECOMMA such as 'whichwrap' */
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1925 if (flags & P_ONECOMMA)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926 {
9798
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1927 if (*s != ',' && *(s + 1) == ','
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1928 && vim_strchr(s + 2, *s) != NULL)
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1929 {
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1930 /* Remove the duplicated value and
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1931 * the next comma. */
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1932 STRMOVE(s, s + 2);
10831
e926c5a7f9bf patch 8.0.0305: invalid memory access when option has duplicate flag
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
1933 continue;
9798
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1934 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935 }
9798
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1936 else
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1937 {
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1938 if ((!(flags & P_COMMA) || *s != ',')
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1939 && vim_strchr(s + 1, *s) != NULL)
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1940 {
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1941 STRMOVE(s, s + 1);
10831
e926c5a7f9bf patch 8.0.0305: invalid memory access when option has duplicate flag
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
1942 continue;
9798
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1943 }
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1944 }
10831
e926c5a7f9bf patch 8.0.0305: invalid memory access when option has duplicate flag
Christian Brabandt <cb@256bit.org>
parents: 10825
diff changeset
1945 ++s;
9798
e34e4547f3d1 commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37
Christian Brabandt <cb@256bit.org>
parents: 9649
diff changeset
1946 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1947 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1949 if (save_arg != NULL) /* number for 'whichwrap' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1950 arg = save_arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1951 new_value_alloced = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1952 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1953
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1954 /*
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1955 * Set the new value.
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
1956 */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957 *(char_u **)(varp) = newval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958
13380
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
1959 #if defined(FEAT_EVAL)
6939
ca0990adc2e3 patch 7.4.788
Bram Moolenaar <bram@vim.org>
parents: 6937
diff changeset
1960 if (!starting
ca0990adc2e3 patch 7.4.788
Bram Moolenaar <bram@vim.org>
parents: 6937
diff changeset
1961 # ifdef FEAT_CRYPT
ca0990adc2e3 patch 7.4.788
Bram Moolenaar <bram@vim.org>
parents: 6937
diff changeset
1962 && options[opt_idx].indir != PV_KEY
ca0990adc2e3 patch 7.4.788
Bram Moolenaar <bram@vim.org>
parents: 6937
diff changeset
1963 # endif
11587
439835c4b7aa patch 8.0.0676: crash when closing quickfix window in autocmd
Christian Brabandt <cb@256bit.org>
parents: 11533
diff changeset
1964 && origval != NULL && newval != NULL)
439835c4b7aa patch 8.0.0676: crash when closing quickfix window in autocmd
Christian Brabandt <cb@256bit.org>
parents: 11533
diff changeset
1965 {
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
1966 /* origval may be freed by
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
1967 * did_set_string_option(), make a copy. */
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
1968 saved_origval = vim_strsave(origval);
11587
439835c4b7aa patch 8.0.0676: crash when closing quickfix window in autocmd
Christian Brabandt <cb@256bit.org>
parents: 11533
diff changeset
1969 /* newval (and varp) may become invalid if the
439835c4b7aa patch 8.0.0676: crash when closing quickfix window in autocmd
Christian Brabandt <cb@256bit.org>
parents: 11533
diff changeset
1970 * buffer is closed by autocommands. */
439835c4b7aa patch 8.0.0676: crash when closing quickfix window in autocmd
Christian Brabandt <cb@256bit.org>
parents: 11533
diff changeset
1971 saved_newval = vim_strsave(newval);
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1972 if (origval_l != NULL)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1973 saved_origval_l = vim_strsave(origval_l);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1974 if (origval_g != NULL)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
1975 saved_origval_g = vim_strsave(origval_g);
11587
439835c4b7aa patch 8.0.0676: crash when closing quickfix window in autocmd
Christian Brabandt <cb@256bit.org>
parents: 11533
diff changeset
1976 }
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
1977 #endif
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
1978
15058
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1979 {
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1980 long_u *p = insecure_flag(opt_idx, opt_flags);
15207
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
1981 int secure_saved = secure;
15058
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1982
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1983 // When an option is set in the sandbox, from a
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1984 // modeline or in secure mode, then deal with side
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1985 // effects in secure mode. Also when the value was
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1986 // set with the P_INSECURE flag and is not
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1987 // completely replaced.
16082
2699db3e4d9d patch 8.1.1046: the "secure" variable is used inconsistently
Bram Moolenaar <Bram@vim.org>
parents: 16054
diff changeset
1988 if ((opt_flags & OPT_MODELINE)
15058
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
1989 #ifdef HAVE_SANDBOX
16082
2699db3e4d9d patch 8.1.1046: the "secure" variable is used inconsistently
Bram Moolenaar <Bram@vim.org>
parents: 16054
diff changeset
1990 || sandbox != 0
2699db3e4d9d patch 8.1.1046: the "secure" variable is used inconsistently
Bram Moolenaar <Bram@vim.org>
parents: 16054
diff changeset
1991 #endif
2699db3e4d9d patch 8.1.1046: the "secure" variable is used inconsistently
Bram Moolenaar <Bram@vim.org>
parents: 16054
diff changeset
1992 || (!value_is_replaced && (*p & P_INSECURE)))
2699db3e4d9d patch 8.1.1046: the "secure" variable is used inconsistently
Bram Moolenaar <Bram@vim.org>
parents: 16054
diff changeset
1993 secure = 1;
15207
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
1994
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
1995 // Handle side effects, and set the global value
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
1996 // for ":set" on local options. Note: when setting
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
1997 // 'syntax' or 'filetype' autocommands may be
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
1998 // triggered that can cause havoc.
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
1999 errmsg = did_set_string_option(
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
2000 opt_idx, (char_u **)varp,
15066
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2001 new_value_alloced, oldval, errbuf,
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2002 opt_flags, &value_checked);
15058
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
2003
15207
6ab9c18708c4 patch 8.1.0613: when executing an insecure function the secure flag is stuck
Bram Moolenaar <Bram@vim.org>
parents: 15192
diff changeset
2004 secure = secure_saved;
15058
5997b84a838a patch 8.1.0540: may evaluate insecure value when appending to option
Bram Moolenaar <Bram@vim.org>
parents: 15056
diff changeset
2005 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006
13380
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
2007 #if defined(FEAT_EVAL)
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
2008 if (errmsg == NULL)
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2009 trigger_optionsset_string(
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2010 opt_idx, opt_flags, saved_origval,
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2011 saved_origval_l, saved_origval_g,
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2012 saved_newval);
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
2013 vim_free(saved_origval);
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2014 vim_free(saved_origval_l);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2015 vim_free(saved_origval_g);
12188
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
2016 vim_free(saved_newval);
d2e367d9de1f patch 8.0.0974: resetting a string option does not trigger OptionSet
Christian Brabandt <cb@256bit.org>
parents: 12186
diff changeset
2017 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018 /* If error detected, print the error message. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019 if (errmsg != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 goto skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 else /* key code option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2025
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026 if (nextchar == '&')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2028 if (add_termcap_entry(key_name, TRUE) == FAIL)
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2029 errmsg = N_("E522: Not found in termcap");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2030 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2032 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033 ++arg; /* jump to after the '=' or ':' */
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
2034 for (p = arg; *p && !VIM_ISWHITE(*p); ++p)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2035 if (*p == '\\' && p[1] != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2037 nextchar = *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 *p = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2039 add_termcode(key_name, arg, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2040 *p = nextchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2041 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2042 if (full_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043 ttest(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2044 redraw_all_later(CLEAR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2045 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046 }
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2047
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2048 if (opt_idx >= 0)
15066
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2049 did_set_option(
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2050 opt_idx, opt_flags, value_is_replaced, value_checked);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2052
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 skip:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2054 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2055 * Advance to next argument.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2056 * - skip until a blank found, taking care of backslashes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 * - skip blanks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 * - skip one "=val" argument (for hidden options ":set gfn =xx")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2060 for (i = 0; i < 2 ; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061 {
11129
f4ea50924c6d patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11127
diff changeset
2062 while (*arg != NUL && !VIM_ISWHITE(*arg))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063 if (*arg++ == '\\' && *arg != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064 ++arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 arg = skipwhite(arg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 if (*arg != '=')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 if (errmsg != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2072 {
419
f713fc55bf7b updated for version 7.0109
vimboss
parents: 410
diff changeset
2073 vim_strncpy(IObuff, (char_u *)_(errmsg), IOSIZE - 1);
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 828
diff changeset
2074 i = (int)STRLEN(IObuff) + 2;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075 if (i + (arg - startarg) < IOSIZE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077 /* append the argument with the error */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078 STRCAT(IObuff, ": ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 mch_memmove(IObuff + i, startarg, (arg - startarg));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 IObuff[i + (arg - startarg)] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082 /* make sure all characters are printable */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083 trans_characters(IObuff, IOSIZE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2085 ++no_wait_return; // wait_return done later
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2086 emsg((char *)IObuff); // show error highlighted
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 --no_wait_return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2092 arg = skipwhite(arg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2093 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2095 theend:
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2096 if (silent_mode && did_show)
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2097 {
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2098 /* After displaying option values in silent mode. */
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2099 silent_mode = FALSE;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2100 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2101 msg_putchar('\n');
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2102 cursor_on(); /* msg_start() switches it off */
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2103 out_flush();
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2104 silent_mode = TRUE;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2105 info_message = FALSE; /* use mch_msg(), not mch_errmsg() */
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2106 }
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
2107
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2111 /*
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2112 * Call this when an option has been given a new value through a user command.
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2113 * Sets the P_WAS_SET flag and takes care of the P_INSECURE flag.
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2114 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2115 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2116 did_set_option(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2117 int opt_idx,
15066
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2118 int opt_flags, // possibly with OPT_MODELINE
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2119 int new_value, // value was replaced completely
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2120 int value_checked) // value was checked to be safe, no need to set the
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2121 // P_INSECURE flag.
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2122 {
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2123 long_u *p;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2124
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2125 options[opt_idx].flags |= P_WAS_SET;
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2126
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2127 /* When an option is set in the sandbox, from a modeline or in secure mode
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2128 * set the P_INSECURE flag. Otherwise, if a new value is stored reset the
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2129 * flag. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2130 p = insecure_flag(opt_idx, opt_flags);
15066
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2131 if (!value_checked && (secure
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2132 #ifdef HAVE_SANDBOX
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2133 || sandbox != 0
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2134 #endif
15066
40d9218b2b12 patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
2135 || (opt_flags & OPT_MODELINE)))
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2136 *p = *p | P_INSECURE;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2137 else if (new_value)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2138 *p = *p & ~P_INSECURE;
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2139 }
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2140
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142 * Convert a key name or string into a key value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143 * Used for 'wildchar' and 'cedit' options.
11764
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
2144 * When "multi_byte" is TRUE allow for multi-byte characters.
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
2145 */
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
2146 int
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
2147 string_to_key(char_u *arg, int multi_byte)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149 if (*arg == '<')
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
2150 return find_key_option(arg + 1, TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 if (*arg == '^')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152 return Ctrl_chr(arg[1]);
11764
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
2153 if (multi_byte)
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
2154 return PTR2CHAR(arg);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155 return *arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2158 #if defined(FEAT_CMDWIN) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 * Check value of 'cedit' and set cedit_key.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161 * Returns NULL if value is OK, error message otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2163 char *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2164 check_cedit(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168 if (*p_cedit == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169 cedit_key = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2170 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2171 {
11764
b82dad3fa176 patch 8.0.0764: 'termkey' does not work yet
Christian Brabandt <cb@256bit.org>
parents: 11757
diff changeset
2172 n = string_to_key(p_cedit, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2173 if (vim_isprintc(n))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2174 return e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2175 cedit_key = n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2176 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2177 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2178 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2179 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2183 * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184 * maketitle() to create and display it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185 * When switching the title or icon off, call mch_restore_title() to get
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 * the old value back.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2188 void
14087
1d25a3e8e03c patch 8.1.0061: window title is wrong after resetting and setting 'title'
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
2189 did_set_title(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191 if (starting != NO_SCREEN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193 && !gui.starting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 maketitle();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2201 * set_options_bin - called when 'bin' changes value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2203 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2204 set_options_bin(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2205 int oldval,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2206 int newval,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2207 int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210 * The option values that are changed when 'bin' changes are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 * copied when 'bin is set and restored when 'bin' is reset.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2213 if (newval)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 if (!oldval) /* switched on */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2216 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2217 if (!(opt_flags & OPT_GLOBAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219 curbuf->b_p_tw_nobin = curbuf->b_p_tw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 curbuf->b_p_wm_nobin = curbuf->b_p_wm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 curbuf->b_p_ml_nobin = curbuf->b_p_ml;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222 curbuf->b_p_et_nobin = curbuf->b_p_et;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224 if (!(opt_flags & OPT_LOCAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 p_tw_nobin = p_tw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 p_wm_nobin = p_wm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 p_ml_nobin = p_ml;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 p_et_nobin = p_et;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 if (!(opt_flags & OPT_GLOBAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2235 curbuf->b_p_tw = 0; /* no automatic line wrap */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236 curbuf->b_p_wm = 0; /* no automatic line wrap */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237 curbuf->b_p_ml = 0; /* no modelines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238 curbuf->b_p_et = 0; /* no expandtab */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 if (!(opt_flags & OPT_LOCAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 p_tw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243 p_wm = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 p_ml = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245 p_et = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 p_bin = TRUE; /* needed when called for the "-b" argument */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2248 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2249 else if (oldval) /* switched off */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 if (!(opt_flags & OPT_GLOBAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 curbuf->b_p_tw = curbuf->b_p_tw_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 curbuf->b_p_wm = curbuf->b_p_wm_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 curbuf->b_p_ml = curbuf->b_p_ml_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 curbuf->b_p_et = curbuf->b_p_et_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258 if (!(opt_flags & OPT_LOCAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260 p_tw = p_tw_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261 p_wm = p_wm_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262 p_ml = p_ml_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263 p_et = p_et_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2265 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2266 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2268 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2269 * Expand environment variables for some string options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2270 * These string options cannot be indirect!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2271 * If "val" is NULL expand the current value of the option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 * Return pointer to NameBuff, or NULL when not expanded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274 static char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2275 option_expand(int opt_idx, char_u *val)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2277 /* if option doesn't need expansion nothing to do */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 /* If val is longer than MAXPATHL no meaningful expansion can be done,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 * expand_env() would truncate the string. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 if (val != NULL && STRLEN(val) > MAXPATHL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 if (val == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 val = *(char_u **)options[opt_idx].var;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290 * Expanding this with NameBuff, expand_env() must not be passed IObuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 * Escape spaces when expanding 'tags', they are used to separate file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292 * names.
374
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
2293 * For 'spellsuggest' expand after "file:".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 expand_env_esc(val, NameBuff, MAXPATHL,
1408
db8309865794 updated for version 7.1-123
vimboss
parents: 1404
diff changeset
2296 (char_u **)options[opt_idx].var == &p_tags, FALSE,
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
2297 #ifdef FEAT_SPELL
374
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
2298 (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" :
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
2299 #endif
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
2300 NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 if (STRCMP(NameBuff, val) == 0) /* they are the same */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2304 return NameBuff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 * After setting various option values: recompute variables that depend on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309 * option values.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2310 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2311 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2312 didset_options(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2314 /* initialize the table for 'iskeyword' et.al. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 (void)init_chartab();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2317 didset_string_options();
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2318
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
2319 #ifdef FEAT_SPELL
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 480
diff changeset
2320 (void)spell_check_msm();
374
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
2321 (void)spell_check_sps();
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
2322 (void)compile_cap_prog(curwin->w_s);
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2323 (void)did_set_spell_option(TRUE);
344
7033303ea0c0 updated for version 7.0089
vimboss
parents: 323
diff changeset
2324 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2326 /* set cedit_key */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2327 (void)check_cedit();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2328 #endif
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
2329 #ifdef FEAT_LINEBREAK
6162
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
2330 briopt_check(curwin);
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
2331 #endif
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2332 #ifdef FEAT_LINEBREAK
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2333 /* initialize the table for 'breakat'. */
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2334 fill_breakat_flags();
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2335 #endif
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
2336 #ifdef FEAT_SYN_HL
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
2337 fill_culopt_flags(NULL, curwin);
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
2338 #endif
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2339 }
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2340
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2341 /*
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2342 * More side effects of setting options.
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2343 */
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2344 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2345 didset_options2(void)
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2346 {
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2347 /* Initialize the highlight_attr[] table. */
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2348 (void)highlight_changed();
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2349
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2350 /* Parse default for 'wildmode' */
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2351 check_opt_wim();
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2352
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2353 (void)set_chars_option(&p_lcs);
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2354 /* Parse default for 'fillchars'. */
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2355 (void)set_chars_option(&p_fcs);
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2356
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2357 #ifdef FEAT_CLIPBOARD
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2358 /* Parse default for 'clipboard' */
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2359 (void)check_clipboard_option();
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
2360 #endif
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
2361 #ifdef FEAT_VARTABS
15858
3a45b89639fb patch 8.1.0936: may leak memory when using 'vartabstop'
Bram Moolenaar <Bram@vim.org>
parents: 15850
diff changeset
2362 vim_free(curbuf->b_p_vsts_array);
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
2363 tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
15858
3a45b89639fb patch 8.1.0936: may leak memory when using 'vartabstop'
Bram Moolenaar <Bram@vim.org>
parents: 15850
diff changeset
2364 vim_free(curbuf->b_p_vts_array);
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
2365 tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
2366 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2367 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 * Check for string options that are NULL (normally only termcap options).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2372 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2373 check_options(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378 if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379 check_string_option((char_u **)get_varp(&(options[opt_idx])));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2381
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2382 /*
14867
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2383 * Return the option index found by a pointer into term_strings[].
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2384 * Return -1 if not found.
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2385 */
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2386 int
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2387 get_term_opt_idx(char_u **p)
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2388 {
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2389 int opt_idx;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2390
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 for (opt_idx = 1; options[opt_idx].fullname != NULL; opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2392 if (options[opt_idx].var == (char_u *)p)
14867
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2393 return opt_idx;
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2394 return -1; // cannot happen: didn't find it!
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2395 }
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2396
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2397 /*
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2398 * Mark a terminal option as allocated, found by a pointer into term_strings[].
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2399 * Return the option index or -1 if not found.
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2400 */
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2401 int
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2402 set_term_option_alloced(char_u **p)
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2403 {
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2404 int opt_idx = get_term_opt_idx(p);
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2405
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2406 if (opt_idx >= 0)
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2407 options[opt_idx].flags |= P_ALLOCED;
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2408 return opt_idx;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2409 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2410
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2411 #if defined(FEAT_EVAL) || defined(PROTO)
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2412 /*
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2413 * Return TRUE when option "opt" was set from a modeline or in secure mode.
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2414 * Return FALSE when it wasn't.
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2415 * Return -1 for an unknown option.
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2416 */
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2417 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2418 was_set_insecurely(char_u *opt, int opt_flags)
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2419 {
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2420 int idx = findoption(opt);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2421 long_u *flagp;
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2422
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2423 if (idx >= 0)
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2424 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2425 flagp = insecure_flag(idx, opt_flags);
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2426 return (*flagp & P_INSECURE) != 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2427 }
10359
66f1b5bf3fa6 commit https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f
Christian Brabandt <cb@256bit.org>
parents: 10357
diff changeset
2428 internal_error("was_set_insecurely()");
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2429 return -1;
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2430 }
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2431
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2432 /*
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2433 * Get a pointer to the flags used for the P_INSECURE flag of option
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2434 * "opt_idx". For some local options a local flags field is used.
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2435 */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2436 static long_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2437 insecure_flag(int opt_idx, int opt_flags)
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2438 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2439 if (opt_flags & OPT_LOCAL)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2440 switch ((int)options[opt_idx].indir)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2441 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2442 #ifdef FEAT_STL_OPT
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2443 case PV_STL: return &curwin->w_p_stl_flags;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2444 #endif
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2445 #ifdef FEAT_EVAL
885
2548cf0a5f62 updated for version 7.0-011
vimboss
parents: 875
diff changeset
2446 # ifdef FEAT_FOLDING
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2447 case PV_FDE: return &curwin->w_p_fde_flags;
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2448 case PV_FDT: return &curwin->w_p_fdt_flags;
885
2548cf0a5f62 updated for version 7.0-011
vimboss
parents: 875
diff changeset
2449 # endif
790
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
2450 # ifdef FEAT_BEVAL
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
2451 case PV_BEXPR: return &curbuf->b_p_bexpr_flags;
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
2452 # endif
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2453 # if defined(FEAT_CINDENT)
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2454 case PV_INDE: return &curbuf->b_p_inde_flags;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2455 # endif
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2456 case PV_FEX: return &curbuf->b_p_fex_flags;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2457 # ifdef FEAT_FIND_ID
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2458 case PV_INEX: return &curbuf->b_p_inex_flags;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2459 # endif
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2460 #endif
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2461 }
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2462
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2463 /* Nothing special, return global flags field. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2464 return &options[opt_idx].flags;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2465 }
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2466 #endif
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2467
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2468 #if defined(FEAT_TITLE) || defined(PROTO)
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2469 /*
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2470 * Redraw the window title and/or tab page text later.
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2471 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2472 void redraw_titles(void)
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2473 {
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2474 need_maketitle = TRUE;
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2475 redraw_tabline = TRUE;
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2476 }
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2477 #endif
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2478
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2479 /*
16277
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2480 * Return TRUE if "val" is a valid name: only consists of alphanumeric ASCII
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2481 * characters or characters in "allowed".
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2482 */
17940
079e10a49ea1 patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents: 17845
diff changeset
2483 int
16277
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2484 valid_name(char_u *val, char *allowed)
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2485 {
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2486 char_u *s;
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2487
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2488 for (s = val; *s != NUL; ++s)
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2489 if (!ASCII_ISALNUM(*s) && vim_strchr((char_u *)allowed, *s) == NULL)
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2490 return FALSE;
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2491 return TRUE;
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2492 }
5ef25fa57f71 patch 8.1.1143: may pass weird strings to file name expansion
Bram Moolenaar <Bram@vim.org>
parents: 16223
diff changeset
2493
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2494 #if defined(FEAT_CLIPBOARD) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2495 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 * Extract the items in the 'clipboard' option and set global values.
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2497 * Return an error message or NULL for success.
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2498 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2499 char *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2500 check_clipboard_option(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501 {
2654
2b475ed86e64 updated for version 7.3.074
Bram Moolenaar <bram@vim.org>
parents: 2652
diff changeset
2502 int new_unnamed = 0;
3678
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2503 int new_autoselect_star = FALSE;
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2504 int new_autoselect_plus = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505 int new_autoselectml = FALSE;
1904
062104a823df updated for version 7.2-201
vimboss
parents: 1883
diff changeset
2506 int new_html = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 regprog_T *new_exclude_prog = NULL;
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2508 char *errmsg = NULL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2511 for (p = p_cb; *p != NUL; )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 {
2654
2b475ed86e64 updated for version 7.3.074
Bram Moolenaar <bram@vim.org>
parents: 2652
diff changeset
2515 new_unnamed |= CLIP_UNNAMED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2516 p += 7;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517 }
3634
286ba0251c0a updated for version 7.3.577
Bram Moolenaar <bram@vim.org>
parents: 3443
diff changeset
2518 else if (STRNCMP(p, "unnamedplus", 11) == 0
2654
2b475ed86e64 updated for version 7.3.074
Bram Moolenaar <bram@vim.org>
parents: 2652
diff changeset
2519 && (p[11] == ',' || p[11] == NUL))
2b475ed86e64 updated for version 7.3.074
Bram Moolenaar <bram@vim.org>
parents: 2652
diff changeset
2520 {
2b475ed86e64 updated for version 7.3.074
Bram Moolenaar <bram@vim.org>
parents: 2652
diff changeset
2521 new_unnamed |= CLIP_UNNAMED_PLUS;
2b475ed86e64 updated for version 7.3.074
Bram Moolenaar <bram@vim.org>
parents: 2652
diff changeset
2522 p += 11;
2b475ed86e64 updated for version 7.3.074
Bram Moolenaar <bram@vim.org>
parents: 2652
diff changeset
2523 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2524 else if (STRNCMP(p, "autoselect", 10) == 0
3678
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2525 && (p[10] == ',' || p[10] == NUL))
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2526 {
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2527 new_autoselect_star = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 p += 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2529 }
3678
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2530 else if (STRNCMP(p, "autoselectplus", 14) == 0
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2531 && (p[14] == ',' || p[14] == NUL))
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2532 {
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2533 new_autoselect_plus = TRUE;
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2534 p += 14;
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2535 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2536 else if (STRNCMP(p, "autoselectml", 12) == 0
3678
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2537 && (p[12] == ',' || p[12] == NUL))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2538 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2539 new_autoselectml = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2540 p += 12;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2541 }
1904
062104a823df updated for version 7.2-201
vimboss
parents: 1883
diff changeset
2542 else if (STRNCMP(p, "html", 4) == 0 && (p[4] == ',' || p[4] == NUL))
062104a823df updated for version 7.2-201
vimboss
parents: 1883
diff changeset
2543 {
062104a823df updated for version 7.2-201
vimboss
parents: 1883
diff changeset
2544 new_html = TRUE;
062104a823df updated for version 7.2-201
vimboss
parents: 1883
diff changeset
2545 p += 4;
062104a823df updated for version 7.2-201
vimboss
parents: 1883
diff changeset
2546 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2548 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2549 p += 8;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2550 new_exclude_prog = vim_regcomp(p, RE_MAGIC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2551 if (new_exclude_prog == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2552 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2553 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2554 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2555 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2556 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2557 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2558 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2559 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2560 if (*p == ',')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2561 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2562 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2563 if (errmsg == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2564 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565 clip_unnamed = new_unnamed;
3678
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2566 clip_autoselect_star = new_autoselect_star;
b06578f1390f updated for version 7.3.599
Bram Moolenaar <bram@vim.org>
parents: 3634
diff changeset
2567 clip_autoselect_plus = new_autoselect_plus;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568 clip_autoselectml = new_autoselectml;
1904
062104a823df updated for version 7.2-201
vimboss
parents: 1883
diff changeset
2569 clip_html = new_html;
4805
66803af09906 updated for version 7.3.1149
Bram Moolenaar <bram@vim.org>
parents: 4736
diff changeset
2570 vim_regfree(clip_exclude_prog);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 clip_exclude_prog = new_exclude_prog;
2248
63157185aea5 updated for version 7.2.442
Bram Moolenaar <bram@vim.org>
parents: 2214
diff changeset
2572 #ifdef FEAT_GUI_GTK
2183
b0ebf9d121ff updated for version 7.2.442
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
2573 if (gui.in_use)
b0ebf9d121ff updated for version 7.2.442
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
2574 {
b0ebf9d121ff updated for version 7.2.442
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
2575 gui_gtk_set_selection_targets();
b0ebf9d121ff updated for version 7.2.442
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
2576 gui_gtk_set_dnd_targets();
b0ebf9d121ff updated for version 7.2.442
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
2577 }
b0ebf9d121ff updated for version 7.2.442
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
2578 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2580 else
4805
66803af09906 updated for version 7.3.1149
Bram Moolenaar <bram@vim.org>
parents: 4736
diff changeset
2581 vim_regfree(new_exclude_prog);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2583 return errmsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2587 #if defined(FEAT_EVAL) || defined(PROTO)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2588 /*
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2589 * Set the script_ctx for an option, taking care of setting the buffer- or
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2590 * window-local value.
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2591 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
2592 void
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2593 set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx)
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2594 {
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2595 int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2596 int indir = (int)options[opt_idx].indir;
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2597 sctx_T new_script_ctx = script_ctx;
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2598
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2599 new_script_ctx.sc_lnum += sourcing_lnum;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2600
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2601 /* Remember where the option was set. For local options need to do that
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2602 * in the buffer or window structure. */
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2603 if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0)
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2604 options[opt_idx].script_ctx = new_script_ctx;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2605 if (both || (opt_flags & OPT_LOCAL))
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2606 {
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2607 if (indir & PV_BUF)
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2608 curbuf->b_p_script_ctx[indir & PV_MASK] = new_script_ctx;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2609 else if (indir & PV_WIN)
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2610 curwin->w_p_script_ctx[indir & PV_MASK] = new_script_ctx;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2611 }
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2612 }
14867
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2613
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2614 /*
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2615 * Set the script_ctx for a termcap option.
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2616 * "name" must be the two character code, e.g. "RV".
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2617 * When "name" is NULL use "opt_idx".
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2618 */
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2619 void
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2620 set_term_option_sctx_idx(char *name, int opt_idx)
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2621 {
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2622 char_u buf[5];
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2623 int idx;
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2624
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2625 if (name == NULL)
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2626 idx = opt_idx;
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2627 else
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2628 {
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2629 buf[0] = 't';
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2630 buf[1] = '_';
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2631 buf[2] = name[0];
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2632 buf[3] = name[1];
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2633 buf[4] = 0;
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2634 idx = findoption(buf);
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2635 }
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2636 if (idx >= 0)
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2637 set_option_sctx_idx(idx, OPT_GLOBAL, current_sctx);
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
2638 }
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2639 #endif
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
2640
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2641 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 * Set the value of a boolean option, and take care of side effects.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 * Returns NULL for success, or an error message for an error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 */
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2645 static char *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2646 set_bool_option(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2647 int opt_idx, /* index in options[] table */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2648 char_u *varp, /* pointer to the option variable */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2649 int value, /* new value */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
2650 int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2652 int old_value = *(int *)varp;
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
2653 #if defined(FEAT_EVAL)
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2654 int old_global_value = 0;
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
2655 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 /* Disallow changing some options from secure mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 if ((secure
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659 #ifdef HAVE_SANDBOX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2660 || sandbox != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2661 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 ) && (options[opt_idx].flags & P_SECURE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2663 return e_secure;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2664
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
2665 #if defined(FEAT_EVAL)
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2666 // Save the global value before changing anything. This is needed as for
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2667 // a global-only option setting the "local value" in fact sets the global
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2668 // value (since there is only one value).
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2669 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2670 old_global_value = *(int *)get_varp_scope(&(options[opt_idx]),
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2671 OPT_GLOBAL);
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
2672 #endif
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
2673
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 *(int *)varp = value; /* set the new value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2675 #ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676 /* Remember where the option was set. */
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
2677 set_option_sctx_idx(opt_idx, opt_flags, current_sctx);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2678 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2679
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2680 #ifdef FEAT_GUI
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2681 need_mouse_correct = TRUE;
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2682 #endif
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
2683
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684 /* May set global value for local option. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2687
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 * Handle side effects of changing a bool option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2692 /* 'compatible' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693 if ((int *)varp == &p_cp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 compatible_set();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695
9925
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2696 #ifdef FEAT_LANGMAP
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2697 if ((int *)varp == &p_lrm)
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2698 /* 'langremap' -> !'langnoremap' */
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2699 p_lnr = !p_lrm;
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2700 else if ((int *)varp == &p_lnr)
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2701 /* 'langnoremap' -> !'langremap' */
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2702 p_lrm = !p_lnr;
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2703 #endif
3fba3e8326a7 commit https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb
Christian Brabandt <cb@256bit.org>
parents: 9877
diff changeset
2704
14846
10107703b9b2 patch 8.1.0435: cursorline highlight not removed in some situation
Christian Brabandt <cb@256bit.org>
parents: 14806
diff changeset
2705 #ifdef FEAT_SYN_HL
10107703b9b2 patch 8.1.0435: cursorline highlight not removed in some situation
Christian Brabandt <cb@256bit.org>
parents: 14806
diff changeset
2706 else if ((int *)varp == &curwin->w_p_cul && !value && old_value)
10107703b9b2 patch 8.1.0435: cursorline highlight not removed in some situation
Christian Brabandt <cb@256bit.org>
parents: 14806
diff changeset
2707 reset_cursorline();
10107703b9b2 patch 8.1.0435: cursorline highlight not removed in some situation
Christian Brabandt <cb@256bit.org>
parents: 14806
diff changeset
2708 #endif
10107703b9b2 patch 8.1.0435: cursorline highlight not removed in some situation
Christian Brabandt <cb@256bit.org>
parents: 14806
diff changeset
2709
3246
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2710 #ifdef FEAT_PERSISTENT_UNDO
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2711 /* 'undofile' */
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2712 else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf)
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2713 {
3894
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2714 /* Only take action when the option was set. When reset we do not
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2715 * delete the undo file, the option may be set again without making
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2716 * any changes in between. */
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2717 if (curbuf->b_p_udf || p_udf)
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2718 {
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2719 char_u hash[UNDO_HASH_SIZE];
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2720 buf_T *save_curbuf = curbuf;
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2721
9649
fd9727ae3c49 commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents: 9536
diff changeset
2722 FOR_ALL_BUFFERS(curbuf)
3894
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2723 {
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2724 /* When 'undofile' is set globally: for every buffer, otherwise
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2725 * only for the current buffer: Try to read in the undofile,
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2726 * if one exists, the buffer wasn't changed and the buffer was
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2727 * loaded */
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2728 if ((curbuf == save_curbuf
3246
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2729 || (opt_flags & OPT_GLOBAL) || opt_flags == 0)
3894
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2730 && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL)
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2731 {
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2732 u_compute_hash(hash);
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2733 u_read_undo(NULL, hash, curbuf->b_fname);
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2734 }
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2735 }
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2736 curbuf = save_curbuf;
f69321485951 updated for version 7.3.703
Bram Moolenaar <bram@vim.org>
parents: 3873
diff changeset
2737 }
3246
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2738 }
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2739 #endif
c4898d6d73a2 updated for version 7.3.392
Bram Moolenaar <bram@vim.org>
parents: 3170
diff changeset
2740
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2741 else if ((int *)varp == &curbuf->b_p_ro)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2742 {
548
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2743 /* when 'readonly' is reset globally, also reset readonlymode */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2744 if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2745 readonlymode = FALSE;
548
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2746
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2747 /* when 'readonly' is set may give W10 again */
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2748 if (curbuf->b_p_ro)
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2749 curbuf->b_did_warn = FALSE;
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2750
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2751 #ifdef FEAT_TITLE
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2752 redraw_titles();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2753 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2754 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2755
2362
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2756 #ifdef FEAT_GUI
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2757 else if ((int *)varp == &p_mh)
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2758 {
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2759 if (!p_mh)
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2760 gui_mch_mousehide(FALSE);
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2761 }
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2762 #endif
6cee3bf00495 When resetting 'mousehide' show the mouse pointer right away.
Bram Moolenaar <bram@vim.org>
parents: 2360
diff changeset
2763
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2764 /* when 'modifiable' is changed, redraw the window title */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2765 else if ((int *)varp == &curbuf->b_p_ma)
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2766 {
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2767 # ifdef FEAT_TERMINAL
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2768 /* Cannot set 'modifiable' when in Terminal mode. */
13429
1bb09ac80ef6 patch 8.0.1589: error for setting 'modifiable' when resetting it
Christian Brabandt <cb@256bit.org>
parents: 13384
diff changeset
2769 if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf)
1bb09ac80ef6 patch 8.0.1589: error for setting 'modifiable' when resetting it
Christian Brabandt <cb@256bit.org>
parents: 13384
diff changeset
2770 && curbuf->b_term != NULL && !term_is_finished(curbuf))))
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2771 {
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2772 curbuf->b_p_ma = FALSE;
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2773 return N_("E946: Cannot make a terminal with running job modifiable");
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2774 }
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2775 # endif
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2776 # ifdef FEAT_TITLE
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2777 redraw_titles();
11866
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2778 # endif
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2779 }
be40c8a9240d patch 8.0.0813: cannot use a terminal window while the job is running
Christian Brabandt <cb@256bit.org>
parents: 11814
diff changeset
2780 #ifdef FEAT_TITLE
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2781 /* when 'endofline' is changed, redraw the window title */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782 else if ((int *)varp == &curbuf->b_p_eol)
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2783 {
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2784 redraw_titles();
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2785 }
6933
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
2786 /* when 'fixeol' is changed, redraw the window title */
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
2787 else if ((int *)varp == &curbuf->b_p_fixeol)
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
2788 {
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
2789 redraw_titles();
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
2790 }
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2791 /* when 'bomb' is changed, redraw the window title and tab page text */
1352
c544a3507e83 updated for version 7.1-066
vimboss
parents: 1323
diff changeset
2792 else if ((int *)varp == &curbuf->b_p_bomb)
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2793 {
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2794 redraw_titles();
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2795 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2798 /* when 'bin' is set also set some other options */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799 else if ((int *)varp == &curbuf->b_p_bin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 #ifdef FEAT_TITLE
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2803 redraw_titles();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2806
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807 /* when 'buflisted' changes, trigger autocommands */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808 else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810 apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 NULL, NULL, TRUE, curbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2812 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 /* when 'swf' is set, create swapfile, when reset remove swapfile */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2815 else if ((int *)varp == &curbuf->b_p_swf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2816 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2817 if (curbuf->b_p_swf && p_uc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2818 ml_open_file(curbuf); /* create the swap file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2819 else
1157
4eb75f1f40df updated for version 7.1a
vimboss
parents: 1111
diff changeset
2820 /* no need to reset curbuf->b_may_swap, ml_open_file() will check
4eb75f1f40df updated for version 7.1a
vimboss
parents: 1111
diff changeset
2821 * buf->b_p_swf */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2822 mf_close_file(curbuf, TRUE); /* remove the swap file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2823 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2824
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2825 /* when 'terse' is set change 'shortmess' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2826 else if ((int *)varp == &p_terse)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2827 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2828 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2829
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2830 p = vim_strchr(p_shm, SHM_SEARCH);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 /* insert 's' in p_shm */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 if (p_terse && p == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 STRCPY(IObuff, p_shm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836 STRCAT(IObuff, "s");
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2837 set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE, 0);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2838 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2839 /* remove 's' from p_shm */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840 else if (!p_terse && p != NULL)
1622
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
2841 STRMOVE(p, p + 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2844 /* when 'paste' is set or reset also change other options */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845 else if ((int *)varp == &p_paste)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847 paste_option_changed();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2848 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850 /* when 'insertmode' is set from an autocommand need to do work here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 else if ((int *)varp == &p_im)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853 if (p_im)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855 if ((State & INSERT) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2856 need_start_insertmode = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857 stop_insert_mode = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2858 }
9359
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
2859 /* only reset if it was set previously */
35b173e37dc6 commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
2860 else if (old_value)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2862 need_start_insertmode = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2863 stop_insert_mode = TRUE;
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
2864 if (restart_edit != 0 && mode_displayed)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2865 clear_cmdline = TRUE; /* remove "(insert)" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2866 restart_edit = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2867 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2868 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2869
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2870 /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2871 else if ((int *)varp == &p_ic && p_hls)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2872 {
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
2873 redraw_all_later(SOME_VALID);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2874 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2875
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2876 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2877 /* when 'hlsearch' is set or reset: reset no_hlsearch */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2878 else if ((int *)varp == &p_hls)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2879 {
13792
0e9b2971d7c3 patch 8.0.1768: SET_NO_HLSEARCH() used in a wrong way
Christian Brabandt <cb@256bit.org>
parents: 13774
diff changeset
2880 set_no_hlsearch(FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2881 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2882 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2883
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2884 /* when 'scrollbind' is set: snapshot the current position to avoid a jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2885 * at the end of normal_cmd() */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2886 else if ((int *)varp == &curwin->w_p_scb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2887 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2888 if (curwin->w_p_scb)
5157
7a6ce0c426fe updated for version 7.4a.005
Bram Moolenaar <bram@vim.org>
parents: 5102
diff changeset
2889 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2890 do_check_scrollbind(FALSE);
5157
7a6ce0c426fe updated for version 7.4a.005
Bram Moolenaar <bram@vim.org>
parents: 5102
diff changeset
2891 curwin->w_scbind_pos = curwin->w_topline;
7a6ce0c426fe updated for version 7.4a.005
Bram Moolenaar <bram@vim.org>
parents: 5102
diff changeset
2892 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2893 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2894
12477
68d7bc045dbe patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 12469
diff changeset
2895 #if defined(FEAT_QUICKFIX)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2896 /* There can be only one window with 'previewwindow' set. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2897 else if ((int *)varp == &curwin->w_p_pvw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2898 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2899 if (curwin->w_p_pvw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2900 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2901 win_T *win;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2902
9649
fd9727ae3c49 commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents: 9536
diff changeset
2903 FOR_ALL_WINDOWS(win)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2904 if (win->w_p_pvw && win != curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2905 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2906 curwin->w_p_pvw = FALSE;
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
2907 return N_("E590: A preview window already exists");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2908 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2909 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2910 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2911 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2912
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2913 /* when 'textmode' is set or reset also change 'fileformat' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2914 else if ((int *)varp == &curbuf->b_p_tx)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2915 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2916 set_fileformat(curbuf->b_p_tx ? EOL_DOS : EOL_UNIX, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2917 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2918
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2919 /* when 'textauto' is set or reset also change 'fileformats' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2920 else if ((int *)varp == &p_ta)
16162
cd5c83115ec6 patch 8.1.1086: too many curly braces
Bram Moolenaar <Bram@vim.org>
parents: 16082
diff changeset
2921 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2922 set_string_option_direct((char_u *)"ffs", -1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2923 p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"",
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
2924 OPT_FREE | opt_flags, 0);
16162
cd5c83115ec6 patch 8.1.1086: too many curly braces
Bram Moolenaar <Bram@vim.org>
parents: 16082
diff changeset
2925 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2926
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2927 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2928 * When 'lisp' option changes include/exclude '-' in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2929 * keyword characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2930 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2931 #ifdef FEAT_LISP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2932 else if (varp == (char_u *)&(curbuf->b_p_lisp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2933 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2934 (void)buf_init_chartab(curbuf, FALSE); /* ignore errors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2935 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2936 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2937
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2938 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2939 /* when 'title' changed, may need to change the title; same for 'icon' */
14087
1d25a3e8e03c patch 8.1.0061: window title is wrong after resetting and setting 'title'
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
2940 else if ((int *)varp == &p_title || (int *)varp == &p_icon)
1d25a3e8e03c patch 8.1.0061: window title is wrong after resetting and setting 'title'
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
2941 {
1d25a3e8e03c patch 8.1.0061: window title is wrong after resetting and setting 'title'
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
2942 did_set_title();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2943 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2944 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2945
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2946 else if ((int *)varp == &curbuf->b_changed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2947 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2948 if (!value)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2949 save_file_ff(curbuf); /* Buffer is unchanged */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2950 #ifdef FEAT_TITLE
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
2951 redraw_titles();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2952 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2953 modified_was_set = value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2954 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2955
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2956 #ifdef BACKSLASH_IN_FILENAME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2957 else if ((int *)varp == &p_ssl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2958 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2959 if (p_ssl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2960 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2961 psepc = '/';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2962 psepcN = '\\';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2963 pseps[0] = '/';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2964 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2965 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2966 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2967 psepc = '\\';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2968 psepcN = '/';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2969 pseps[0] = '\\';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2970 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2971
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2972 /* need to adjust the file name arguments and buffer names. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2973 buflist_slash_adjust();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2974 alist_slash_adjust();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2975 # ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2976 scriptnames_slash_adjust();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2977 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2978 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2979 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2980
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2981 /* If 'wrap' is set, set w_leftcol to zero. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2982 else if ((int *)varp == &curwin->w_p_wrap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2983 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2984 if (curwin->w_p_wrap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2985 curwin->w_leftcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2986 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2987
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2988 else if ((int *)varp == &p_ea)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2989 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2990 if (p_ea && !old_value)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2991 win_equal(curwin, FALSE, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2992 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2993
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2994 else if ((int *)varp == &p_wiv)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2995 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2996 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2997 * When 'weirdinvert' changed, set/reset 't_xs'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2998 * Then set 'weirdinvert' according to value of 't_xs'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2999 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3000 if (p_wiv && !old_value)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3001 T_XS = (char_u *)"y";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3002 else if (!p_wiv && old_value)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3003 T_XS = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3004 p_wiv = (*T_XS != NUL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3005 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3006
12871
1a450ce6980c patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
3007 #ifdef FEAT_BEVAL_GUI
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3008 else if ((int *)varp == &p_beval)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3009 {
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3010 if (!balloonEvalForTerm)
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3011 {
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3012 if (p_beval && !old_value)
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3013 gui_mch_enable_beval_area(balloonEval);
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3014 else if (!p_beval && old_value)
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3015 gui_mch_disable_beval_area(balloonEval);
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3016 }
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3017 }
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3018 #endif
12871
1a450ce6980c patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
3019 #ifdef FEAT_BEVAL_TERM
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3020 else if ((int *)varp == &p_bevalterm)
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3021 {
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3022 mch_bevalterm_changed();
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12824
diff changeset
3023 }
12871
1a450ce6980c patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
3024 #endif
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
3025
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
3026 #ifdef FEAT_AUTOCHDIR
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3027 else if ((int *)varp == &p_acd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3028 {
961
c06c658691e2 updated for version 7.0-087
vimboss
parents: 944
diff changeset
3029 /* Change directories when the 'acd' option is set now. */
13632
cec5137d5332 patch 8.0.1688: some macros are used without a semicolon
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
3030 DO_AUTOCHDIR;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3031 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3032 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3034 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3035 /* 'diff' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3036 else if ((int *)varp == &curwin->w_p_diff)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3037 {
16
3ba373b54370 updated for version 7.0008
vimboss
parents: 15
diff changeset
3038 /* May add or remove the buffer from the list of diff buffers. */
3ba373b54370 updated for version 7.0008
vimboss
parents: 15
diff changeset
3039 diff_buf_adjust(curwin);
3ba373b54370 updated for version 7.0008
vimboss
parents: 15
diff changeset
3040 # ifdef FEAT_FOLDING
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3041 if (foldmethodIsDiff(curwin))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3042 foldUpdateAll(curwin);
16
3ba373b54370 updated for version 7.0008
vimboss
parents: 15
diff changeset
3043 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3044 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3045 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3046
13380
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
3047 #ifdef HAVE_INPUT_METHOD
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3048 /* 'imdisable' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3049 else if ((int *)varp == &p_imdisable)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3050 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3051 /* Only de-activate it here, it will be enabled when changing mode. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3052 if (p_imdisable)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3053 im_set_active(FALSE);
3129
dc3f90a73fb3 updated for version 7.3.335
Bram Moolenaar <bram@vim.org>
parents: 3089
diff changeset
3054 else if (State & INSERT)
dc3f90a73fb3 updated for version 7.3.335
Bram Moolenaar <bram@vim.org>
parents: 3089
diff changeset
3055 /* When the option is set from an autocommand, it may need to take
dc3f90a73fb3 updated for version 7.3.335
Bram Moolenaar <bram@vim.org>
parents: 3089
diff changeset
3056 * effect right away. */
dc3f90a73fb3 updated for version 7.3.335
Bram Moolenaar <bram@vim.org>
parents: 3089
diff changeset
3057 im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3058 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3059 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3060
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
3061 #ifdef FEAT_SPELL
258
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3062 /* 'spell' */
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3063 else if ((int *)varp == &curwin->w_p_spell)
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3064 {
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3065 if (curwin->w_p_spell)
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3066 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
3067 char *errmsg = did_set_spelllang(curwin);
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
3068
258
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3069 if (errmsg != NULL)
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
3070 emsg(_(errmsg));
258
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3071 }
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3072 }
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3073 #endif
f93df7322443 updated for version 7.0070
vimboss
parents: 237
diff changeset
3074
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3075 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3076 if ((int *)varp == &curwin->w_p_arab)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3077 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3078 if (curwin->w_p_arab)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3079 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3080 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3081 * 'arabic' is set, handle various sub-settings.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3082 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3083 if (!p_tbidi)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3084 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3085 /* set rightleft mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3086 if (!curwin->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3087 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3088 curwin->w_p_rl = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3089 changed_window_setting();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3090 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3091
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3092 /* Enable Arabic shaping (major part of what Arabic requires) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3093 if (!p_arshape)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3094 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3095 p_arshape = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3096 redraw_later_clear();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3097 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3098 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3099
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3100 /* Arabic requires a utf-8 encoding, inform the user if its not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3101 * set. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3102 if (STRCMP(p_enc, "utf-8") != 0)
16
3ba373b54370 updated for version 7.0008
vimboss
parents: 15
diff changeset
3103 {
1848
cfcc1421f5e4 updated for version 7.2-146
vimboss
parents: 1846
diff changeset
3104 static char *w_arabic = N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'");
cfcc1421f5e4 updated for version 7.2-146
vimboss
parents: 1846
diff changeset
3105
11158
501f46f7644c patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents: 11129
diff changeset
3106 msg_source(HL_ATTR(HLF_W));
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
3107 msg_attr(_(w_arabic), HL_ATTR(HLF_W));
1848
cfcc1421f5e4 updated for version 7.2-146
vimboss
parents: 1846
diff changeset
3108 #ifdef FEAT_EVAL
cfcc1421f5e4 updated for version 7.2-146
vimboss
parents: 1846
diff changeset
3109 set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1);
cfcc1421f5e4 updated for version 7.2-146
vimboss
parents: 1846
diff changeset
3110 #endif
16
3ba373b54370 updated for version 7.0008
vimboss
parents: 15
diff changeset
3111 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3113 /* set 'delcombine' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3114 p_deco = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3116 # ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3117 /* Force-set the necessary keymap for arabic */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3118 set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3119 OPT_LOCAL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3120 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3121 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3122 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3123 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3124 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3125 * 'arabic' is reset, handle various sub-settings.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3126 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3127 if (!p_tbidi)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3128 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3129 /* reset rightleft mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3130 if (curwin->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3131 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3132 curwin->w_p_rl = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3133 changed_window_setting();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3134 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3136 /* 'arabicshape' isn't reset, it is a global option and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3137 * another window may still need it "on". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3138 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3140 /* 'delcombine' isn't reset, it is a global option and another
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3141 * window may still want it "on". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3143 # ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3144 /* Revert to the default keymap */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3145 curbuf->b_p_iminsert = B_IMODE_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3146 curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3147 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3148 }
3443
21219ffc9790 updated for version 7.3.487
Bram Moolenaar <bram@vim.org>
parents: 3427
diff changeset
3149 }
21219ffc9790 updated for version 7.3.487
Bram Moolenaar <bram@vim.org>
parents: 3427
diff changeset
3150
1958
c51a4f993675 updated for version 7.2-255
vimboss
parents: 1945
diff changeset
3151 #endif
c51a4f993675 updated for version 7.2-255
vimboss
parents: 1945
diff changeset
3152
17827
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3153 #if defined(FEAT_SIGNS) && defined(FEAT_GUI)
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3154 else if (((int *)varp == &curwin->w_p_nu
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3155 || (int *)varp == &curwin->w_p_rnu)
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3156 && gui.in_use
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3157 && (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) == 'u')
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3158 && curbuf->b_signlist != NULL)
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3159 {
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3160 // If the 'number' or 'relativenumber' options are modified and
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3161 // 'signcolumn' is set to 'number', then clear the screen for a full
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3162 // refresh. Otherwise the sign icons are not displayed properly in the
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3163 // number column. If the 'number' option is set and only the
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3164 // 'relativenumber' option is toggled, then don't refresh the screen
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3165 // (optimization).
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3166 if (!(curwin->w_p_nu && ((int *)varp == &curwin->w_p_rnu)))
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3167 redraw_all_later(CLEAR);
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3168 }
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3169 #endif
6de5558c5242 patch 8.1.1910: redrawing too much when toggling 'relativenumber'
Bram Moolenaar <Bram@vim.org>
parents: 17809
diff changeset
3170
9027
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 8969
diff changeset
3171 #ifdef FEAT_TERMGUICOLORS
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 8969
diff changeset
3172 /* 'termguicolors' */
773d627cac0b commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents: 8969
diff changeset
3173 else if ((int *)varp == &p_tgc)
8969
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3174 {
13314
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3175 # ifdef FEAT_VTP
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3176 /* Do not turn on 'tgc' when 24-bit colors are not supported. */
16451
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
3177 if (
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
3178 # ifdef VIMDLL
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
3179 !gui.in_use && !gui.starting &&
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
3180 # endif
7ae2396cef62 patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents: 16447
diff changeset
3181 !has_vtp_working())
13314
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3182 {
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3183 p_tgc = 0;
15725
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15713
diff changeset
3184 return N_("E954: 24-bit colors are not supported on this environment");
13314
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3185 }
13823
d0d8125ba692 patch 8.0.1783: cannot use 256 colors in a MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13792
diff changeset
3186 if (is_term_win32())
d0d8125ba692 patch 8.0.1783: cannot use 256 colors in a MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13792
diff changeset
3187 swap_tcap();
13314
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3188 # endif
8969
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3189 # ifdef FEAT_GUI
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3190 if (!gui.in_use && !gui.starting)
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3191 # endif
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3192 highlight_gui_started();
13314
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3193 # ifdef FEAT_VTP
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3194 /* reset t_Co */
13823
d0d8125ba692 patch 8.0.1783: cannot use 256 colors in a MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13792
diff changeset
3195 if (is_term_win32())
14212
2bebc49116fd patch 8.1.0123: MS-Windows: colors are wrong after setting 'notgc'
Christian Brabandt <cb@256bit.org>
parents: 14194
diff changeset
3196 {
2bebc49116fd patch 8.1.0123: MS-Windows: colors are wrong after setting 'notgc'
Christian Brabandt <cb@256bit.org>
parents: 14194
diff changeset
3197 control_console_color_rgb();
13314
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3198 set_termname(T_NAME);
14212
2bebc49116fd patch 8.1.0123: MS-Windows: colors are wrong after setting 'notgc'
Christian Brabandt <cb@256bit.org>
parents: 14194
diff changeset
3199 init_highlight(TRUE, FALSE);
2bebc49116fd patch 8.1.0123: MS-Windows: colors are wrong after setting 'notgc'
Christian Brabandt <cb@256bit.org>
parents: 14194
diff changeset
3200 }
13314
65c3e8259124 patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents: 13244
diff changeset
3201 # endif
8969
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3202 }
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3203 #endif
c83e2c1e7f2b commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents: 8941
diff changeset
3204
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3205 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3206 * End of handling side effects for bool options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3207 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3208
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3209 /* after handling side effects, call autocommand */
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3210
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3211 options[opt_idx].flags |= P_WAS_SET;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3212
13380
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
3213 #if defined(FEAT_EVAL)
14804
cca823b02a04 patch 8.1.0414: v:option_old is cleared when using :set in OptionSet autocmd
Christian Brabandt <cb@256bit.org>
parents: 14748
diff changeset
3214 // Don't do this while starting up or recursively.
cca823b02a04 patch 8.1.0414: v:option_old is cleared when using :set in OptionSet autocmd
Christian Brabandt <cb@256bit.org>
parents: 14748
diff changeset
3215 if (!starting && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3216 {
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3217 char_u buf_old[2], buf_old_global[2], buf_new[2], buf_type[7];
14804
cca823b02a04 patch 8.1.0414: v:option_old is cleared when using :set in OptionSet autocmd
Christian Brabandt <cb@256bit.org>
parents: 14748
diff changeset
3218
6937
c31bd9ca75d2 patch 7.4.787
Bram Moolenaar <bram@vim.org>
parents: 6935
diff changeset
3219 vim_snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE);
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3220 vim_snprintf((char *)buf_old_global, 2, "%d",
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3221 old_global_value ? TRUE: FALSE);
6937
c31bd9ca75d2 patch 7.4.787
Bram Moolenaar <bram@vim.org>
parents: 6935
diff changeset
3222 vim_snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE);
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3223 vim_snprintf((char *)buf_type, 7, "%s",
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3224 (opt_flags & OPT_LOCAL) ? "local" : "global");
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3225 set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3226 set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3227 set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3228 if (opt_flags & OPT_LOCAL)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3229 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3230 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3231 set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3232 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3233 if (opt_flags & OPT_GLOBAL)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3234 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3235 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3236 set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3237 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3238 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3239 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3240 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3241 set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3242 set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old_global, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3243 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3244 if (opt_flags & OPT_MODELINE)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3245 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3246 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3247 set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3248 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3249 apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname,
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3250 NULL, FALSE, NULL);
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3251 reset_v_option_vars();
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3252 }
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3253 #endif
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3254
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3255 comp_col(); /* in case 'ruler' or 'showcmd' changed */
3443
21219ffc9790 updated for version 7.3.487
Bram Moolenaar <bram@vim.org>
parents: 3427
diff changeset
3256 if (curwin->w_curswant != MAXCOL
6669
5a12a6861367 updated for version 7.4.659
Bram Moolenaar <bram@vim.org>
parents: 6602
diff changeset
3257 && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
3443
21219ffc9790 updated for version 7.3.487
Bram Moolenaar <bram@vim.org>
parents: 3427
diff changeset
3258 curwin->w_set_curswant = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3259 check_redraw(options[opt_idx].flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3260
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3261 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3262 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3264 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3265 * Set the value of a number option, and take care of side effects.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3266 * Returns NULL for success, or an error message for an error.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3267 */
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
3268 static char *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3269 set_num_option(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3270 int opt_idx, /* index in options[] table */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3271 char_u *varp, /* pointer to the option variable */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3272 long value, /* new value */
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
3273 char *errbuf, /* buffer for error messages */
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3274 size_t errbuflen, /* length of "errbuf" */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3275 int opt_flags) /* OPT_LOCAL, OPT_GLOBAL and
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3276 OPT_MODELINE */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3277 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
3278 char *errmsg = NULL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3279 long old_value = *(long *)varp;
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
3280 #if defined(FEAT_EVAL)
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3281 long old_global_value = 0; // only used when setting a local and
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3282 // global option
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
3283 #endif
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3284 long old_Rows = Rows; // remember old Rows
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3285 long old_Columns = Columns; // remember old Columns
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3286 long *pp = (long *)varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3287
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3288 /* Disallow changing some options from secure mode. */
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3289 if ((secure
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3290 #ifdef HAVE_SANDBOX
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3291 || sandbox != 0
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3292 #endif
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3293 ) && (options[opt_idx].flags & P_SECURE))
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3294 return e_secure;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3295
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
3296 #if defined(FEAT_EVAL)
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3297 // Save the global value before changing anything. This is needed as for
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3298 // a global-only option setting the "local value" infact sets the global
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3299 // value (since there is only one value).
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3300 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
17115
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
3301 old_global_value = *(long *)get_varp_scope(&(options[opt_idx]),
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
3302 OPT_GLOBAL);
1c2d05cb4d1d patch 8.1.1557: compiler warning for unused variables in tiny version
Bram Moolenaar <Bram@vim.org>
parents: 17085
diff changeset
3303 #endif
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3304
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3305 *pp = value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3306 #ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3307 /* Remember where the option was set. */
14700
0a3b9ecf7cb8 patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents: 14479
diff changeset
3308 set_option_sctx_idx(opt_idx, opt_flags, current_sctx);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3309 #endif
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3310 #ifdef FEAT_GUI
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3311 need_mouse_correct = TRUE;
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
3312 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3313
3740
7de7ef01288d updated for version 7.3.629
Bram Moolenaar <bram@vim.org>
parents: 3678
diff changeset
3314 if (curbuf->b_p_sw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3315 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3316 errmsg = e_positive;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
3317 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
3318 // Use the first 'vartabstop' value, or 'tabstop' if vts isn't in use.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
3319 curbuf->b_p_sw = tabstop_count(curbuf->b_p_vts_array) > 0
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
3320 ? tabstop_first(curbuf->b_p_vts_array)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
3321 : curbuf->b_p_ts;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
3322 #else
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3323 curbuf->b_p_sw = curbuf->b_p_ts;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
3324 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3325 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3327 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3328 * Number options that need some action when changed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3329 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3330 if (pp == &p_wh || pp == &p_hh)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3331 {
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
3332 // 'winheight' and 'helpheight'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3333 if (p_wh < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3334 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3335 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3336 p_wh = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3337 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3338 if (p_wmh > p_wh)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3339 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3340 errmsg = e_winheight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3341 p_wh = p_wmh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3342 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3343 if (p_hh < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3344 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3345 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3346 p_hh = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3347 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3348
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3349 /* Change window height NOW */
10357
59d01e335858 commit https://github.com/vim/vim/commit/459ca563128f2edb7e3bb190090bbb755a56dd55
Christian Brabandt <cb@256bit.org>
parents: 10340
diff changeset
3350 if (!ONE_WINDOW)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3351 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3352 if (pp == &p_wh && curwin->w_height < p_wh)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3353 win_setheight((int)p_wh);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3354 if (pp == &p_hh && curbuf->b_help && curwin->w_height < p_hh)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3355 win_setheight((int)p_hh);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3356 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3357 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3358 else if (pp == &p_wmh)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3359 {
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
3360 // 'winminheight'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3361 if (p_wmh < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3362 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3363 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3364 p_wmh = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3365 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3366 if (p_wmh > p_wh)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3367 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3368 errmsg = e_winheight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3369 p_wmh = p_wh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3370 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3371 win_setminheight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3372 }
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3373 else if (pp == &p_wiw)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3374 {
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
3375 // 'winwidth'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3376 if (p_wiw < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3377 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3378 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3379 p_wiw = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3380 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3381 if (p_wmw > p_wiw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3382 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3383 errmsg = e_winwidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3384 p_wiw = p_wmw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3385 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3386
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3387 /* Change window width NOW */
10357
59d01e335858 commit https://github.com/vim/vim/commit/459ca563128f2edb7e3bb190090bbb755a56dd55
Christian Brabandt <cb@256bit.org>
parents: 10340
diff changeset
3388 if (!ONE_WINDOW && curwin->w_width < p_wiw)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3389 win_setwidth((int)p_wiw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3390 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3391 else if (pp == &p_wmw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3392 {
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
3393 // 'winminwidth'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3394 if (p_wmw < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3395 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3396 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3397 p_wmw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3398 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3399 if (p_wmw > p_wiw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3400 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3401 errmsg = e_winwidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3402 p_wmw = p_wiw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3403 }
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
3404 win_setminwidth();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3405 }
12477
68d7bc045dbe patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 12469
diff changeset
3406
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3407 /* (re)set last window status line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3408 else if (pp == &p_ls)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3409 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3410 last_status(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3411 }
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
3412
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
3413 /* (re)set tab page line */
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 671
diff changeset
3414 else if (pp == &p_stal)
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
3415 {
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
3416 shell_new_rows(); /* recompute window positions and heights */
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
3417 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3418
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3419 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3420 else if (pp == &p_linespace)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3421 {
444
d0d15b184c56 updated for version 7.0116
vimboss
parents: 440
diff changeset
3422 /* Recompute gui.char_height and resize the Vim window to keep the
d0d15b184c56 updated for version 7.0116
vimboss
parents: 440
diff changeset
3423 * same number of lines. */
d0d15b184c56 updated for version 7.0116
vimboss
parents: 440
diff changeset
3424 if (gui.in_use && gui_mch_adjust_charheight() == OK)
813
bb5d1fa78352 updated for version 7.0c01
vimboss
parents: 810
diff changeset
3425 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3426 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3427 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3428
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3429 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3430 /* 'foldlevel' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3431 else if (pp == &curwin->w_p_fdl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3432 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3433 if (curwin->w_p_fdl < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3434 curwin->w_p_fdl = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3435 newFoldLevel();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3436 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3437
1805
a5e1d6526ac7 updated for version 7.2-103
vimboss
parents: 1801
diff changeset
3438 /* 'foldminlines' */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3439 else if (pp == &curwin->w_p_fml)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3440 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3441 foldUpdateAll(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3442 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3443
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3444 /* 'foldnestmax' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3445 else if (pp == &curwin->w_p_fdn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3446 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3447 if (foldmethodIsSyntax(curwin) || foldmethodIsIndent(curwin))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3448 foldUpdateAll(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3449 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3451 /* 'foldcolumn' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3452 else if (pp == &curwin->w_p_fdc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3453 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3454 if (curwin->w_p_fdc < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3455 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3456 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3457 curwin->w_p_fdc = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3458 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3459 else if (curwin->w_p_fdc > 12)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3460 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3461 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3462 curwin->w_p_fdc = 12;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3463 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3464 }
5438
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3465 #endif /* FEAT_FOLDING */
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3466
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3467 #if defined(FEAT_FOLDING) || defined(FEAT_CINDENT)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3468 /* 'shiftwidth' or 'tabstop' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3469 else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3470 {
5438
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3471 # ifdef FEAT_FOLDING
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3472 if (foldmethodIsIndent(curwin))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3473 foldUpdateAll(curwin);
5438
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3474 # endif
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3475 # ifdef FEAT_CINDENT
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3476 /* When 'shiftwidth' changes, or it's zero and 'tabstop' changes:
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3477 * parse 'cinoptions'. */
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3478 if (pp == &curbuf->b_p_sw || curbuf->b_p_sw == 0)
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3479 parse_cino(curbuf);
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3480 # endif
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3481 }
878ed73c7070 updated for version 7.4.069
Bram Moolenaar <bram@vim.org>
parents: 5245
diff changeset
3482 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3483
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3484 /* 'maxcombine' */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3485 else if (pp == &p_mco)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3486 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3487 if (p_mco > MAX_MCO)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3488 p_mco = MAX_MCO;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3489 else if (p_mco < 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3490 p_mco = 0;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3491 screenclear(); /* will re-allocate the screen */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3492 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3493
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3494 else if (pp == &curbuf->b_p_iminsert)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3495 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3496 if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3497 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3498 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3499 curbuf->b_p_iminsert = B_IMODE_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3500 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3501 p_iminsert = curbuf->b_p_iminsert;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3502 if (termcap_active) /* don't do this in the alternate screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3503 showmode();
12477
68d7bc045dbe patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 12469
diff changeset
3504 #if defined(FEAT_KEYMAP)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3505 /* Show/unshow value of 'keymap' in status lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3506 status_redraw_curbuf();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3507 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3508 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3509
12293
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3510 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3511 /* 'imstyle' */
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3512 else if (pp == &p_imst)
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3513 {
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3514 if (p_imst != IM_ON_THE_SPOT && p_imst != IM_OVER_THE_SPOT)
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3515 errmsg = e_invarg;
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3516 }
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3517 #endif
1ff5e5dfa9b0 patch 8.0.1026: GTK on-the-spot input has problems
Christian Brabandt <cb@256bit.org>
parents: 12259
diff changeset
3518
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3519 else if (pp == &p_window)
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3520 {
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3521 if (p_window < 1)
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3522 p_window = 1;
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3523 else if (p_window >= Rows)
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3524 p_window = Rows - 1;
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3525 }
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3526
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3527 else if (pp == &curbuf->b_p_imsearch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3528 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3529 if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3530 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3531 errmsg = e_invarg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3532 curbuf->b_p_imsearch = B_IMODE_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3533 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3534 p_imsearch = curbuf->b_p_imsearch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3535 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3537 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3538 /* if 'titlelen' has changed, redraw the title */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3539 else if (pp == &p_titlelen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3540 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3541 if (p_titlelen < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3542 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3543 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3544 p_titlelen = 85;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3545 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3546 if (starting != NO_SCREEN && old_value != p_titlelen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3547 need_maketitle = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3548 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3549 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3551 /* if p_ch changed value, change the command line height */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3552 else if (pp == &p_ch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3553 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3554 if (p_ch < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3555 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3556 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3557 p_ch = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3558 }
1404
b00bc2bf23eb updated for version 7.1-119
vimboss
parents: 1384
diff changeset
3559 if (p_ch > Rows - min_rows() + 1)
b00bc2bf23eb updated for version 7.1-119
vimboss
parents: 1384
diff changeset
3560 p_ch = Rows - min_rows() + 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3562 /* Only compute the new window layout when startup has been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3563 * completed. Otherwise the frame sizes may be wrong. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3564 if (p_ch != old_value && full_screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3565 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3566 && !gui.starting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3567 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3568 )
824
8dd456c1e283 updated for version 7.0c13
vimboss
parents: 820
diff changeset
3569 command_height();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3570 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3571
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3572 /* when 'updatecount' changes from zero to non-zero, open swap files */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3573 else if (pp == &p_uc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3574 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3575 if (p_uc < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3576 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3577 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3578 p_uc = 100;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3579 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3580 if (p_uc && !old_value)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3581 ml_open_files();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3582 }
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3583 #ifdef FEAT_CONCEAL
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
3584 else if (pp == &curwin->w_p_cole)
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
3585 {
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
3586 if (curwin->w_p_cole < 0)
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3587 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3588 errmsg = e_positive;
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
3589 curwin->w_p_cole = 0;
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
3590 }
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
3591 else if (curwin->w_p_cole > 3)
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3592 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3593 errmsg = e_invarg;
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
3594 curwin->w_p_cole = 3;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3595 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3596 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
3597 #endif
16
3ba373b54370 updated for version 7.0008
vimboss
parents: 15
diff changeset
3598 #ifdef MZSCHEME_GUI_THREADS
14
946da5994c01 updated for version 7.0006
vimboss
parents: 13
diff changeset
3599 else if (pp == &p_mzq)
946da5994c01 updated for version 7.0006
vimboss
parents: 13
diff changeset
3600 mzvim_reset_timer();
946da5994c01 updated for version 7.0006
vimboss
parents: 13
diff changeset
3601 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3602
10722
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3603 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3604 /* 'pyxversion' */
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3605 else if (pp == &p_pyx)
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3606 {
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3607 if (p_pyx != 0 && p_pyx != 2 && p_pyx != 3)
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3608 errmsg = e_invarg;
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3609 }
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3610 #endif
7598ce51bf2a patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents: 10708
diff changeset
3611
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3612 /* sync undo before 'undolevels' changes */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3613 else if (pp == &p_ul)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3614 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3615 /* use the old value, otherwise u_sync() may not work properly */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3616 p_ul = old_value;
825
6675076019ae updated for version 7.0d
vimboss
parents: 824
diff changeset
3617 u_sync(TRUE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3618 p_ul = value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3619 }
5446
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
3620 else if (pp == &curbuf->b_p_ul)
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
3621 {
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
3622 /* use the old value, otherwise u_sync() may not work properly */
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
3623 curbuf->b_p_ul = old_value;
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
3624 u_sync(TRUE);
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
3625 curbuf->b_p_ul = value;
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
3626 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3627
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3628 #ifdef FEAT_LINEBREAK
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3629 /* 'numberwidth' must be positive */
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3630 else if (pp == &curwin->w_p_nuw)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3631 {
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3632 if (curwin->w_p_nuw < 1)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3633 {
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3634 errmsg = e_positive;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3635 curwin->w_p_nuw = 1;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3636 }
17229
f1c7b7a4d9e4 patch 8.1.1614: 'numberwidth' can only go up to 10
Bram Moolenaar <Bram@vim.org>
parents: 17176
diff changeset
3637 if (curwin->w_p_nuw > 20)
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3638 {
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3639 errmsg = e_invarg;
17229
f1c7b7a4d9e4 patch 8.1.1614: 'numberwidth' can only go up to 10
Bram Moolenaar <Bram@vim.org>
parents: 17176
diff changeset
3640 curwin->w_p_nuw = 20;
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3641 }
6727
7c5a0c69e1ac updated for version 7.4.687
Bram Moolenaar <bram@vim.org>
parents: 6669
diff changeset
3642 curwin->w_nrwidth_line_count = 0; /* trigger a redraw */
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3643 }
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3644 #endif
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3645
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3646 else if (pp == &curbuf->b_p_tw)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3647 {
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3648 if (curbuf->b_p_tw < 0)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3649 {
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3650 errmsg = e_positive;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3651 curbuf->b_p_tw = 0;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3652 }
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3653 #ifdef FEAT_SYN_HL
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3654 {
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3655 win_T *wp;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3656 tabpage_T *tp;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3657
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3658 FOR_ALL_TAB_WINDOWS(tp, wp)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3659 check_colorcolumn(wp);
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3660 }
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3661 #endif
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3662 }
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
3663
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3664 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3665 * Check the bounds for numeric options here
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3666 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3667 if (Rows < min_rows() && full_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3668 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3669 if (errbuf != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3670 {
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 258
diff changeset
3671 vim_snprintf((char *)errbuf, errbuflen,
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 258
diff changeset
3672 _("E593: Need at least %d lines"), min_rows());
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3673 errmsg = errbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3674 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3675 Rows = min_rows();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3676 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3677 if (Columns < MIN_COLUMNS && full_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3678 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3679 if (errbuf != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3680 {
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 258
diff changeset
3681 vim_snprintf((char *)errbuf, errbuflen,
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 258
diff changeset
3682 _("E594: Need at least %d columns"), MIN_COLUMNS);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3683 errmsg = errbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3684 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3685 Columns = MIN_COLUMNS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3686 }
5070
cf52d2a8c05c updated for version 7.3.1278
Bram Moolenaar <bram@vim.org>
parents: 5039
diff changeset
3687 limit_screen_size();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3688
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3689 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3690 * If the screen (shell) height has been changed, assume it is the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3691 * physical screenheight.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3692 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3693 if (old_Rows != Rows || old_Columns != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3694 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3695 /* Changing the screen size is not allowed while updating the screen. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3696 if (updating_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3697 *pp = old_value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3698 else if (full_screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3699 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3700 && !gui.starting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3701 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3702 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3703 set_shellsize((int)Columns, (int)Rows, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3704 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3705 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3706 /* Postpone the resizing; check the size and cmdline position for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3707 * messages. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3708 check_shellsize();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3709 if (cmdline_row > Rows - p_ch && Rows > p_ch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3710 cmdline_row = Rows - p_ch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3711 }
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 842
diff changeset
3712 if (p_window >= Rows || !option_was_set((char_u *)"window"))
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 161
diff changeset
3713 p_window = Rows - 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3714 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3716 if (curbuf->b_p_ts <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3717 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3718 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3719 curbuf->b_p_ts = 8;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3720 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3721 if (p_tm < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3722 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3723 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3724 p_tm = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3725 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3726 if ((curwin->w_p_scr <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3727 || (curwin->w_p_scr > curwin->w_height
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3728 && curwin->w_height > 0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3729 && full_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3730 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3731 if (pp == &(curwin->w_p_scr))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3732 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3733 if (curwin->w_p_scr != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3734 errmsg = e_scroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3735 win_comp_scroll(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3736 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3737 /* If 'scroll' became invalid because of a side effect silently adjust
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3738 * it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3739 else if (curwin->w_p_scr <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3740 curwin->w_p_scr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3741 else /* curwin->w_p_scr > curwin->w_height */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3742 curwin->w_p_scr = curwin->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3743 }
1726
1e25b58fbf7b updated for version 7.2-024
vimboss
parents: 1683
diff changeset
3744 if (p_hi < 0)
1e25b58fbf7b updated for version 7.2-024
vimboss
parents: 1683
diff changeset
3745 {
1e25b58fbf7b updated for version 7.2-024
vimboss
parents: 1683
diff changeset
3746 errmsg = e_positive;
1e25b58fbf7b updated for version 7.2-024
vimboss
parents: 1683
diff changeset
3747 p_hi = 0;
1e25b58fbf7b updated for version 7.2-024
vimboss
parents: 1683
diff changeset
3748 }
5991
a42ba1e50992 updated for version 7.4.336
Bram Moolenaar <bram@vim.org>
parents: 5883
diff changeset
3749 else if (p_hi > 10000)
a42ba1e50992 updated for version 7.4.336
Bram Moolenaar <bram@vim.org>
parents: 5883
diff changeset
3750 {
a42ba1e50992 updated for version 7.4.336
Bram Moolenaar <bram@vim.org>
parents: 5883
diff changeset
3751 errmsg = e_invarg;
a42ba1e50992 updated for version 7.4.336
Bram Moolenaar <bram@vim.org>
parents: 5883
diff changeset
3752 p_hi = 10000;
a42ba1e50992 updated for version 7.4.336
Bram Moolenaar <bram@vim.org>
parents: 5883
diff changeset
3753 }
4444
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 4367
diff changeset
3754 if (p_re < 0 || p_re > 2)
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 4367
diff changeset
3755 {
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 4367
diff changeset
3756 errmsg = e_invarg;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 4367
diff changeset
3757 p_re = 0;
ccecb03e5e8b updated for version 7.3.970
Bram Moolenaar <bram@vim.org>
parents: 4367
diff changeset
3758 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3759 if (p_report < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3760 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3761 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3762 p_report = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3763 }
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents: 523
diff changeset
3764 if ((p_sj < -100 || p_sj >= Rows) && full_screen)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3765 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3766 if (Rows != old_Rows) /* Rows changed, just adjust p_sj */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3767 p_sj = Rows / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3768 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3769 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3770 errmsg = e_scroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3771 p_sj = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3772 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3773 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3774 if (p_so < 0 && full_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3775 {
15713
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
3776 errmsg = e_positive;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3777 p_so = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3778 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3779 if (p_siso < 0 && full_screen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3780 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3781 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3782 p_siso = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3783 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3784 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3785 if (p_cwh < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3786 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3787 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3788 p_cwh = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3789 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3790 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3791 if (p_ut < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3792 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3793 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3794 p_ut = 2000;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3795 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3796 if (p_ss < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3797 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3798 errmsg = e_positive;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3799 p_ss = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3800 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3801
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3802 /* May set global value for local option. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3803 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3804 *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3805
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3806 options[opt_idx].flags |= P_WAS_SET;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3807
13380
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
3808 #if defined(FEAT_EVAL)
14804
cca823b02a04 patch 8.1.0414: v:option_old is cleared when using :set in OptionSet autocmd
Christian Brabandt <cb@256bit.org>
parents: 14748
diff changeset
3809 // Don't do this while starting up, failure or recursively.
cca823b02a04 patch 8.1.0414: v:option_old is cleared when using :set in OptionSet autocmd
Christian Brabandt <cb@256bit.org>
parents: 14748
diff changeset
3810 if (!starting && errmsg == NULL && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3811 {
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3812 char_u buf_old[11], buf_old_global[11], buf_new[11], buf_type[7];
6937
c31bd9ca75d2 patch 7.4.787
Bram Moolenaar <bram@vim.org>
parents: 6935
diff changeset
3813 vim_snprintf((char *)buf_old, 10, "%ld", old_value);
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3814 vim_snprintf((char *)buf_old_global, 10, "%ld", old_global_value);
6937
c31bd9ca75d2 patch 7.4.787
Bram Moolenaar <bram@vim.org>
parents: 6935
diff changeset
3815 vim_snprintf((char *)buf_new, 10, "%ld", value);
c31bd9ca75d2 patch 7.4.787
Bram Moolenaar <bram@vim.org>
parents: 6935
diff changeset
3816 vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3817 set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3818 set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3819 set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
17085
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3820 if (opt_flags & OPT_LOCAL)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3821 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3822 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3823 set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3824 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3825 if (opt_flags & OPT_GLOBAL)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3826 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3827 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3828 set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3829 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3830 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3831 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3832 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3833 set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3834 set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old_global, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3835 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3836 if (opt_flags & OPT_MODELINE)
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3837 {
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3838 set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3839 set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3840 }
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3841 apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname,
620e9011b685 patch 8.1.1542: an OptionSet autocommand does not get enough info
Bram Moolenaar <Bram@vim.org>
parents: 17039
diff changeset
3842 NULL, FALSE, NULL);
6935
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3843 reset_v_option_vars();
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3844 }
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3845 #endif
4db70c94226b patch 7.4.786
Bram Moolenaar <bram@vim.org>
parents: 6933
diff changeset
3846
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3847 comp_col(); /* in case 'columns' or 'ls' changed */
3443
21219ffc9790 updated for version 7.3.487
Bram Moolenaar <bram@vim.org>
parents: 3427
diff changeset
3848 if (curwin->w_curswant != MAXCOL
6669
5a12a6861367 updated for version 7.4.659
Bram Moolenaar <bram@vim.org>
parents: 6602
diff changeset
3849 && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
3443
21219ffc9790 updated for version 7.3.487
Bram Moolenaar <bram@vim.org>
parents: 3427
diff changeset
3850 curwin->w_set_curswant = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3851 check_redraw(options[opt_idx].flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3852
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3853 return errmsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3854 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3855
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3856 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3857 * Called after an option changed: check if something needs to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3858 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
3859 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3860 check_redraw(long_u flags)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3861 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3862 /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */
3263
320cc46d0eb0 updated for version 7.3.400
Bram Moolenaar <bram@vim.org>
parents: 3246
diff changeset
3863 int doclear = (flags & P_RCLR) == P_RCLR;
320cc46d0eb0 updated for version 7.3.400
Bram Moolenaar <bram@vim.org>
parents: 3246
diff changeset
3864 int all = ((flags & P_RALL) == P_RALL || doclear);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3865
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3866 if ((flags & P_RSTAT) || all) /* mark all status lines dirty */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3867 status_redraw_all();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3869 if ((flags & P_RBUF) || (flags & P_RWIN) || all)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3870 changed_window_setting();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3871 if (flags & P_RBUF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3872 redraw_curbuf_later(NOT_VALID);
10456
536a7d49249c commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents: 10424
diff changeset
3873 if (flags & P_RWINONLY)
536a7d49249c commit https://github.com/vim/vim/commit/a2477fd3490c1166522631eee53c57d34321086a
Christian Brabandt <cb@256bit.org>
parents: 10424
diff changeset
3874 redraw_later(NOT_VALID);
3263
320cc46d0eb0 updated for version 7.3.400
Bram Moolenaar <bram@vim.org>
parents: 3246
diff changeset
3875 if (doclear)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3876 redraw_all_later(CLEAR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3877 else if (all)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3878 redraw_all_later(NOT_VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3879 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3880
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3881 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3882 * Find index for option 'arg'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3883 * Return -1 if not found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3884 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
3885 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3886 findoption(char_u *arg)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3887 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3888 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3889 char *s, *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3890 static short quick_tab[27] = {0, 0}; /* quick access table */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3891 int is_term_opt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3892
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3893 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3894 * For first call: Initialize the quick-access table.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3895 * It contains the index for the first option that starts with a certain
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3896 * letter. There are 26 letters, plus the first "t_" option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3897 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3898 if (quick_tab[1] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3899 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3900 p = options[0].fullname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3901 for (opt_idx = 1; (s = options[opt_idx].fullname) != NULL; opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3902 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3903 if (s[0] != p[0])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3904 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3905 if (s[0] == 't' && s[1] == '_')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3906 quick_tab[26] = opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3907 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3908 quick_tab[CharOrdLow(s[0])] = opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3909 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3910 p = s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3911 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3912 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3913
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3914 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3915 * Check for name starting with an illegal character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3916 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3917 #ifdef EBCDIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3918 if (!islower(arg[0]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3919 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3920 if (arg[0] < 'a' || arg[0] > 'z')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3921 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3922 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3923
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3924 is_term_opt = (arg[0] == 't' && arg[1] == '_');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3925 if (is_term_opt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3926 opt_idx = quick_tab[26];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3927 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3928 opt_idx = quick_tab[CharOrdLow(arg[0])];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3929 for ( ; (s = options[opt_idx].fullname) != NULL; opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3930 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3931 if (STRCMP(arg, s) == 0) /* match full name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3932 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3933 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3934 if (s == NULL && !is_term_opt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3935 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3936 opt_idx = quick_tab[CharOrdLow(arg[0])];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3937 for ( ; options[opt_idx].fullname != NULL; opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3938 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3939 s = options[opt_idx].shortname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3940 if (s != NULL && STRCMP(arg, s) == 0) /* match short name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3941 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3942 s = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3943 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3944 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3945 if (s == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3946 opt_idx = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3947 return opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3948 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3949
14
946da5994c01 updated for version 7.0006
vimboss
parents: 13
diff changeset
3950 #if defined(FEAT_EVAL) || defined(FEAT_TCL) || defined(FEAT_MZSCHEME)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3951 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3952 * Get the value for an option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3953 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3954 * Returns:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3955 * Number or Toggle option: 1, *numval gets value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3956 * String option: 0, *stringval gets allocated string.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3957 * Hidden Number or Toggle option: -1.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3958 * hidden String option: -2.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3959 * unknown option: -3.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3960 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3961 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3962 get_option_value(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3963 char_u *name,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3964 long *numval,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3965 char_u **stringval, /* NULL when only checking existence */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
3966 int opt_flags)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3967 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3968 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3969 char_u *varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3970
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3971 opt_idx = findoption(name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3972 if (opt_idx < 0) /* unknown option */
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3973 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3974 int key;
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3975
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3976 if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
3977 && (key = find_key_option(name, FALSE)) != 0)
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3978 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3979 char_u key_name[2];
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3980 char_u *p;
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3981
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3982 if (key < 0)
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3983 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3984 key_name[0] = KEY2TERMCAP0(key);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3985 key_name[1] = KEY2TERMCAP1(key);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3986 }
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3987 else
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3988 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3989 key_name[0] = KS_KEY;
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3990 key_name[1] = (key & 0xff);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3991 }
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3992 p = find_termcode(key_name);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3993 if (p != NULL)
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3994 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3995 if (stringval != NULL)
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3996 *stringval = vim_strsave(p);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3997 return 0;
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3998 }
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
3999 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4000 return -3;
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4001 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4003 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4004
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4005 if (options[opt_idx].flags & P_STRING)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4006 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4007 if (varp == NULL) /* hidden option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4008 return -2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4009 if (stringval != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4010 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4011 #ifdef FEAT_CRYPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4012 /* never return the value of the crypt key */
1622
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
4013 if ((char_u **)varp == &curbuf->b_p_key
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
4014 && **(char_u **)(varp) != NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4015 *stringval = vim_strsave((char_u *)"*****");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4016 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4017 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4018 *stringval = vim_strsave(*(char_u **)(varp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4019 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4020 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4021 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4022
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4023 if (varp == NULL) /* hidden option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4024 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4025 if (options[opt_idx].flags & P_NUM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4026 *numval = *(long *)varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4027 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4028 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4029 /* Special case: 'modified' is b_changed, but we also want to consider
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4030 * it set when 'ff' or 'fenc' changed. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4031 if ((int *)varp == &curbuf->b_changed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4032 *numval = curbufIsChanged();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4033 else
9395
beab399e3883 commit https://github.com/vim/vim/commit/2acfbed9dbea990f129535de7ff3df360365130b
Christian Brabandt <cb@256bit.org>
parents: 9389
diff changeset
4034 *numval = (long) *(int *)varp;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4035 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4036 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4037 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4038 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4039
5610
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4040 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4041 /*
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4042 * Returns the option attributes and its value. Unlike the above function it
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4043 * will return either global value or local value of the option depending on
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4044 * what was requested, but it will never return global value if it was
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4045 * requested to return local one and vice versa. Neither it will return
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4046 * buffer-local value if it was requested to return window-local one.
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4047 *
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4048 * Pretends that option is absent if it is not present in the requested scope
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4049 * (i.e. has no global, window-local or buffer-local value depending on
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4050 * opt_type). Uses
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4051 *
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4052 * Returned flags:
5867
a6b59ee633a3 updated for version 7.4.276
Bram Moolenaar <bram@vim.org>
parents: 5735
diff changeset
4053 * 0 hidden or unknown option, also option that does not have requested
a6b59ee633a3 updated for version 7.4.276
Bram Moolenaar <bram@vim.org>
parents: 5735
diff changeset
4054 * type (see SREQ_* in vim.h)
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4055 * see SOPT_* in vim.h for other flags
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4056 *
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4057 * Possible opt_type values: see SREQ_* in vim.h
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4058 */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4059 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4060 get_option_value_strict(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4061 char_u *name,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4062 long *numval,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4063 char_u **stringval, /* NULL when only obtaining attributes */
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4064 int opt_type,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4065 void *from)
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4066 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4067 int opt_idx;
4367
b7f2d97ae2b7 updated for version 7.3.932
Bram Moolenaar <bram@vim.org>
parents: 4361
diff changeset
4068 char_u *varp = NULL;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4069 struct vimoption *p;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4070 int r = 0;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4071
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4072 opt_idx = findoption(name);
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4073 if (opt_idx < 0)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4074 return 0;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4075
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4076 p = &(options[opt_idx]);
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4077
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4078 /* Hidden option */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4079 if (p->var == NULL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4080 return 0;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4081
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4082 if (p->flags & P_BOOL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4083 r |= SOPT_BOOL;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4084 else if (p->flags & P_NUM)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4085 r |= SOPT_NUM;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4086 else if (p->flags & P_STRING)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4087 r |= SOPT_STRING;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4088
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4089 if (p->indir == PV_NONE)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4090 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4091 if (opt_type == SREQ_GLOBAL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4092 r |= SOPT_GLOBAL;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4093 else
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4094 return 0; /* Did not request global-only option */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4095 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4096 else
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4097 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4098 if (p->indir & PV_BOTH)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4099 r |= SOPT_GLOBAL;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4100 else if (opt_type == SREQ_GLOBAL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4101 return 0; /* Requested global option */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4102
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4103 if (p->indir & PV_WIN)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4104 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4105 if (opt_type == SREQ_BUF)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4106 return 0; /* Did not request window-local option */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4107 else
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4108 r |= SOPT_WIN;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4109 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4110 else if (p->indir & PV_BUF)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4111 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4112 if (opt_type == SREQ_WIN)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4113 return 0; /* Did not request buffer-local option */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4114 else
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4115 r |= SOPT_BUF;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4116 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4117 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4118
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4119 if (stringval == NULL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4120 return r;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4121
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4122 if (opt_type == SREQ_GLOBAL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4123 varp = p->var;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4124 else
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4125 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4126 if (opt_type == SREQ_BUF)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4127 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4128 /* Special case: 'modified' is b_changed, but we also want to
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4129 * consider it set when 'ff' or 'fenc' changed. */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4130 if (p->indir == PV_MOD)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4131 {
14179
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4132 *numval = bufIsChanged((buf_T *)from);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4133 varp = NULL;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4134 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4135 #ifdef FEAT_CRYPT
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4136 else if (p->indir == PV_KEY)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4137 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4138 /* never return the value of the crypt key */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4139 *stringval = NULL;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4140 varp = NULL;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4141 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4142 #endif
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4143 else
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4144 {
14179
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4145 buf_T *save_curbuf = curbuf;
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4146
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4147 // only getting a pointer, no need to use aucmd_prepbuf()
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4148 curbuf = (buf_T *)from;
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4149 curwin->w_buffer = curbuf;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4150 varp = get_varp(p);
14179
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4151 curbuf = save_curbuf;
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4152 curwin->w_buffer = curbuf;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4153 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4154 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4155 else if (opt_type == SREQ_WIN)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4156 {
14179
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4157 win_T *save_curwin = curwin;
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4158
ab64a4fb5edd patch 8.1.0107: Python: getting buffer option clears message
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
4159 curwin = (win_T *)from;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4160 curbuf = curwin->w_buffer;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4161 varp = get_varp(p);
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4162 curwin = save_curwin;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4163 curbuf = curwin->w_buffer;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4164 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4165 if (varp == p->var)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4166 return (r | SOPT_UNSET);
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4167 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4168
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4169 if (varp != NULL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4170 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4171 if (p->flags & P_STRING)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4172 *stringval = vim_strsave(*(char_u **)(varp));
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4173 else if (p->flags & P_NUM)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4174 *numval = *(long *) varp;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4175 else
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4176 *numval = *(int *)varp;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4177 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4178
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4179 return r;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4180 }
5610
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4181
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4182 /*
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
4183 * Iterate over options. First argument is a pointer to a pointer to a
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
4184 * structure inside options[] array, second is option type like in the above
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
4185 * function.
5610
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4186 *
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
4187 * If first argument points to NULL it is assumed that iteration just started
5610
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4188 * and caller needs the very first value.
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
4189 * If first argument points to the end marker function returns NULL and sets
5610
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4190 * first argument to NULL.
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4191 *
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4192 * Returns full option name for current option on each call.
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4193 */
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4194 char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4195 option_iter_next(void **option, int opt_type)
5610
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4196 {
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4197 struct vimoption *ret = NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4198 do
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4199 {
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4200 if (*option == NULL)
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4201 *option = (void *) options;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4202 else if (((struct vimoption *) (*option))->fullname == NULL)
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4203 {
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4204 *option = NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4205 return NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4206 }
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4207 else
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4208 *option = (void *) (((struct vimoption *) (*option)) + 1);
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4209
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4210 ret = ((struct vimoption *) (*option));
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4211
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4212 /* Hidden option */
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4213 if (ret->var == NULL)
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4214 {
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4215 ret = NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4216 continue;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4217 }
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4218
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4219 switch (opt_type)
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4220 {
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4221 case SREQ_GLOBAL:
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4222 if (!(ret->indir == PV_NONE || ret->indir & PV_BOTH))
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4223 ret = NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4224 break;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4225 case SREQ_BUF:
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4226 if (!(ret->indir & PV_BUF))
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4227 ret = NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4228 break;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4229 case SREQ_WIN:
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4230 if (!(ret->indir & PV_WIN))
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4231 ret = NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4232 break;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4233 default:
10359
66f1b5bf3fa6 commit https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f
Christian Brabandt <cb@256bit.org>
parents: 10357
diff changeset
4234 internal_error("option_iter_next()");
5610
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4235 return NULL;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4236 }
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4237 }
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4238 while (ret == NULL);
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4239
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4240 return (char_u *)ret->fullname;
2ace11abcfb5 updated for version 7.4.152
Bram Moolenaar <bram@vim.org>
parents: 5477
diff changeset
4241 }
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4242 #endif
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
4243
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4244 /*
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4245 * Return the flags for the option at 'opt_idx'.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4246 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4247 long_u
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4248 get_option_flags(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4249 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4250 return options[opt_idx].flags;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4251 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4252
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4253 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4254 * Set a flag for the option at 'opt_idx'.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4255 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4256 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4257 set_option_flag(int opt_idx, long_u flag)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4258 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4259 options[opt_idx].flags |= flag;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4260 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4261
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4262 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4263 * Clear a flag for the option at 'opt_idx'.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4264 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4265 void
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4266 clear_option_flag(int opt_idx, long_u flag)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4267 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4268 options[opt_idx].flags &= ~flag;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4269 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4270
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4271 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4272 * Returns TRUE if the option at 'opt_idx' is a global option
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4273 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4274 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4275 is_global_option(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4276 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4277 return options[opt_idx].indir == PV_NONE;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4278 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4279
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4280 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4281 * Returns TRUE if the option at 'opt_idx' is a global option which also has a
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4282 * local value.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4283 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4284 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4285 is_global_local_option(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4286 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4287 return options[opt_idx].indir & PV_BOTH;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4288 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4289
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4290 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4291 * Returns TRUE if the option at 'opt_idx' is a window-local option
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4292 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4293 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4294 is_window_local_option(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4295 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4296 return options[opt_idx].var == VAR_WIN;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4297 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4298
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4299 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4300 * Returns TRUE if the option at 'opt_idx' is a hidden option
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4301 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4302 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4303 is_hidden_option(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4304 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4305 return options[opt_idx].var == NULL;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4306 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4307
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4308 #if defined(FEAT_CRYPT) || defined(PROTO)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4309 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4310 * Returns TRUE if the option at 'opt_idx' is a crypt key option
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4311 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4312 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4313 is_crypt_key_option(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4314 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4315 return options[opt_idx].indir == PV_KEY;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4316 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4317 #endif
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4318
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
4319 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4320 * Set the value of option "name".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4321 * Use "string" for string options, use "number" for other options.
4513
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4322 *
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4323 * Returns NULL on success or error message on error.
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4324 */
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
4325 char *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4326 set_option_value(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4327 char_u *name,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4328 long number,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4329 char_u *string,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4330 int opt_flags) /* OPT_LOCAL or 0 (both) */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4331 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4332 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4333 char_u *varp;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 828
diff changeset
4334 long_u flags;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4336 opt_idx = findoption(name);
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
4337 if (opt_idx < 0)
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4338 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4339 int key;
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4340
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4341 if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4342 && (key = find_key_option(name, FALSE)) != 0)
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4343 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4344 char_u key_name[2];
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4345
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4346 if (key < 0)
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4347 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4348 key_name[0] = KEY2TERMCAP0(key);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4349 key_name[1] = KEY2TERMCAP1(key);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4350 }
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4351 else
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4352 {
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4353 key_name[0] = KS_KEY;
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4354 key_name[1] = (key & 0xff);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4355 }
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4356 add_termcode(key_name, string, FALSE);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4357 if (full_screen)
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4358 ttest(FALSE);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4359 redraw_all_later(CLEAR);
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4360 return NULL;
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4361 }
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4362
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
4363 semsg(_("E355: Unknown option: %s"), name);
10825
4dea7c96fc82 patch 8.0.0302: cannot set terminal key codes with :let
Christian Brabandt <cb@256bit.org>
parents: 10722
diff changeset
4364 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4365 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4366 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4367 flags = options[opt_idx].flags;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4368 #ifdef HAVE_SANDBOX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4369 /* Disallow changing some options in the sandbox */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4370 if (sandbox > 0 && (flags & P_SECURE))
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
4371 {
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
4372 emsg(_(e_sandbox));
4513
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4373 return NULL;
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
4374 }
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
4375 #endif
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
4376 if (flags & P_STRING)
4513
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4377 return set_string_option(opt_idx, string, opt_flags);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4378 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4379 {
1667
131dbd3d2a4b updated for version 7.2a-019
vimboss
parents: 1622
diff changeset
4380 varp = get_varp_scope(&(options[opt_idx]), opt_flags);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4381 if (varp != NULL) /* hidden option is not changed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4382 {
1298
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4383 if (number == 0 && string != NULL)
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4384 {
1757
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 1733
diff changeset
4385 int idx;
1298
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4386
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4387 /* Either we are given a string or we are setting option
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4388 * to zero. */
1757
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 1733
diff changeset
4389 for (idx = 0; string[idx] == '0'; ++idx)
1298
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4390 ;
1757
f10fe14748e2 updated for version 7.2-055
vimboss
parents: 1733
diff changeset
4391 if (string[idx] != NUL || idx == 0)
1298
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4392 {
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4393 /* There's another character after zeros or the string
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4394 * is empty. In both cases, we are trying to set a
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4395 * num option using a string. */
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
4396 semsg(_("E521: Number required: &%s = '%s'"),
1298
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4397 name, string);
4513
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4398 return NULL; /* do nothing as we hit an error */
1298
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4399
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4400 }
f4c7b5da017a updated for version 7.1-012
vimboss
parents: 1157
diff changeset
4401 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4402 if (flags & P_NUM)
4513
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4403 return set_num_option(opt_idx, varp, number,
274
8fa8d7964cf1 updated for version 7.0073
vimboss
parents: 258
diff changeset
4404 NULL, 0, opt_flags);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4405 else
4513
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4406 return set_bool_option(opt_idx, varp, (int)number,
634
1c586ee8dd45 updated for version 7.0183
vimboss
parents: 593
diff changeset
4407 opt_flags);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4408 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4409 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4410 }
4513
cadb57fbb781 updated for version 7.3.1004
Bram Moolenaar <bram@vim.org>
parents: 4444
diff changeset
4411 return NULL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4412 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4414 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4415 * Get the terminal code for a terminal option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4416 * Returns NULL when not found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4417 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4418 char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4419 get_term_code(char_u *tname)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4420 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4421 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4422 char_u *varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4424 if (tname[0] != 't' || tname[1] != '_' ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4425 tname[2] == NUL || tname[3] == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4426 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4427 if ((opt_idx = findoption(tname)) >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4428 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4429 varp = get_varp(&(options[opt_idx]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4430 if (varp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4431 varp = *(char_u **)(varp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4432 return varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4433 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4434 return find_termcode(tname + 2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4435 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4436
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4437 char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4438 get_highlight_default(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4439 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4440 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4442 i = findoption((char_u *)"hl");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4443 if (i >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4444 return options[i].def_val[VI_DEFAULT];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4445 return (char_u *)NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4446 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4447
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4448 char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4449 get_encoding_default(void)
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4450 {
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4451 int i;
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4452
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4453 i = findoption((char_u *)"enc");
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4454 if (i >= 0)
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4455 return options[i].def_val[VI_DEFAULT];
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4456 return (char_u *)NULL;
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4457 }
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4458
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4459 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4460 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4461 * When "has_lt" is true there is a '<' before "*arg_arg".
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4462 * Returns 0 when the key is not recognized.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4463 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4464 static int
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4465 find_key_option(char_u *arg_arg, int has_lt)
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4466 {
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4467 int key = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4468 int modifiers;
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4469 char_u *arg = arg_arg;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4470
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4471 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4472 * Don't use get_special_key_code() for t_xx, we don't want it to call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4473 * add_termcap_entry().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4474 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4475 if (arg[0] == 't' && arg[1] == '_' && arg[2] && arg[3])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4476 key = TERMCAP2KEY(arg[2], arg[3]);
14381
d9e6eec551e1 patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents: 14313
diff changeset
4477 else if (has_lt)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4478 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4479 --arg; /* put arg at the '<' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4480 modifiers = 0;
9869
989d44d35a66 commit https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
4481 key = find_special_key(&arg, &modifiers, TRUE, TRUE, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4482 if (modifiers) /* can't handle modifiers here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4483 key = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4484 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4485 return key;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4486 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4487
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4488 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4489 * if 'all' == 0: show changed options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4490 * if 'all' == 1: show all normal options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4491 * if 'all' == 2: show all terminal options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4492 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4493 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4494 showoptions(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4495 int all,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4496 int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4497 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4498 struct vimoption *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4499 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4500 int isterm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4501 char_u *varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4502 struct vimoption **items;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4503 int item_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4504 int run;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4505 int row, rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4506 int cols;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4507 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4508 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4509
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4510 #define INC 20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4511 #define GAP 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4512
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
4513 items = ALLOC_MULT(struct vimoption *, PARAM_COUNT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4514 if (items == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4515 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4516
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4517 /* Highlight title */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4518 if (all == 2)
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4519 msg_puts_title(_("\n--- Terminal codes ---"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4520 else if (opt_flags & OPT_GLOBAL)
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4521 msg_puts_title(_("\n--- Global option values ---"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4522 else if (opt_flags & OPT_LOCAL)
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4523 msg_puts_title(_("\n--- Local option values ---"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4524 else
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4525 msg_puts_title(_("\n--- Options ---"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4526
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4527 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4528 * do the loop two times:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4529 * 1. display the short items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4530 * 2. display the long items (only strings and numbers)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4531 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4532 for (run = 1; run <= 2 && !got_int; ++run)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4533 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4534 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4535 * collect the items in items[]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4536 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4537 item_count = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4538 for (p = &options[0]; p->fullname != NULL; p++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4539 {
14968
c5ec5ddbe814 patch 8.1.0495: :filter only supports some commands
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
4540 // apply :filter /pat/
c5ec5ddbe814 patch 8.1.0495: :filter only supports some commands
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
4541 if (message_filtered((char_u *) p->fullname))
c5ec5ddbe814 patch 8.1.0495: :filter only supports some commands
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
4542 continue;
c5ec5ddbe814 patch 8.1.0495: :filter only supports some commands
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
4543
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4544 varp = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4545 isterm = istermoption(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4546 if (opt_flags != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4547 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4548 if (p->indir != PV_NONE && !isterm)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4549 varp = get_varp_scope(p, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4550 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4551 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4552 varp = get_varp(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4553 if (varp != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4554 && ((all == 2 && isterm)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4555 || (all == 1 && !isterm)
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
4556 || (all == 0 && !optval_default(p, varp, p_cp))))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4557 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4558 if (p->flags & P_BOOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4559 len = 1; /* a toggle option fits always */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4560 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4561 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4562 option_value2string(p, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4563 len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4564 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4565 if ((len <= INC - GAP && run == 1) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4566 (len > INC - GAP && run == 2))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4567 items[item_count++] = p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4568 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4569 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4570
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4571 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4572 * display the items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4573 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4574 if (run == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4575 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4576 cols = (Columns + GAP - 3) / INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4577 if (cols == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4578 cols = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4579 rows = (item_count + cols - 1) / cols;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4580 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4581 else /* run == 2 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4582 rows = item_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4583 for (row = 0; row < rows && !got_int; ++row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4584 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4585 msg_putchar('\n'); /* go to next line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4586 if (got_int) /* 'q' typed in more */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4587 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4588 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4589 for (i = row; i < item_count; i += rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4590 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4591 msg_col = col; /* make columns */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4592 showoneopt(items[i], opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4593 col += INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4594 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4595 out_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4596 ui_breakcheck();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4597 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4598 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4599 vim_free(items);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4600 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4601
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4602 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4603 * Return TRUE if option "p" has its default value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4604 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4605 static int
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
4606 optval_default(struct vimoption *p, char_u *varp, int compatible)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4607 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4608 int dvi;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4609
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4610 if (varp == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4611 return TRUE; /* hidden option is always at default */
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
4612 dvi = ((p->flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4613 if (p->flags & P_NUM)
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
4614 return (*(long *)varp == (long)(long_i)p->def_val[dvi]);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4615 if (p->flags & P_BOOL)
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
4616 /* the cast to long is required for Manx C, long_i is
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
4617 * needed for MSVC */
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
4618 return (*(int *)varp == (int)(long)(long_i)p->def_val[dvi]);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4619 /* P_STRING */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4620 return (STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4621 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4622
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4623 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4624 * showoneopt: show the value of one option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4625 * must not be called with a hidden option!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4626 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4627 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4628 showoneopt(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4629 struct vimoption *p,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4630 int opt_flags) /* OPT_LOCAL or OPT_GLOBAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4631 {
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4632 char_u *varp;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4633 int save_silent = silent_mode;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4634
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4635 silent_mode = FALSE;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4636 info_message = TRUE; /* use mch_msg(), not mch_errmsg() */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4637
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4638 varp = get_varp_scope(p, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4640 /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4641 if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4642 ? !curbufIsChanged() : !*(int *)varp))
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4643 msg_puts("no");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4644 else if ((p->flags & P_BOOL) && *(int *)varp < 0)
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4645 msg_puts("--");
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4646 else
15543
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4647 msg_puts(" ");
dd725a8ab112 patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
4648 msg_puts(p->fullname);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4649 if (!(p->flags & P_BOOL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4650 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4651 msg_putchar('=');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4652 /* put value string in NameBuff */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4653 option_value2string(p, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4654 msg_outtrans(NameBuff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4655 }
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4656
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4657 silent_mode = save_silent;
4d9eabb1396e updated for version 7.0051
vimboss
parents: 164
diff changeset
4658 info_message = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4659 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4660
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4661 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4662 * Write modified options as ":set" commands to a file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4663 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4664 * There are three values for "opt_flags":
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4665 * OPT_GLOBAL: Write global option values and fresh values of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4666 * buffer-local options (used for start of a session
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4667 * file).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4668 * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4669 * curwin (used for a vimrc file).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4670 * OPT_LOCAL: Write buffer-local option values for curbuf, fresh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4671 * and local values for window-local options of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4672 * curwin. Local values are also written when at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4673 * default value, because a modeline or autocommand
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4674 * may have set them when doing ":edit file" and the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4675 * user has set them back at the default or fresh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4676 * value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4677 * When "local_only" is TRUE, don't write fresh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4678 * values, only local values (for ":mkview").
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4679 * (fresh value = value used for a new buffer or window for a local option).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4680 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4681 * Return FAIL on error, OK otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4682 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4683 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4684 makeset(FILE *fd, int opt_flags, int local_only)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4685 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4686 struct vimoption *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4687 char_u *varp; /* currently used value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4688 char_u *varp_fresh; /* local value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4689 char_u *varp_local = NULL; /* fresh value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4690 char *cmd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4691 int round;
1384
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4692 int pri;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4693
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4694 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4695 * The options that don't have a default (terminal name, columns, lines)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4696 * are never written. Terminal options are also not written.
1384
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4697 * Do the loop over "options[]" twice: once for options with the
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4698 * P_PRI_MKRC flag and once without.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4699 */
1384
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4700 for (pri = 1; pri >= 0; --pri)
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4701 {
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4702 for (p = &options[0]; !istermoption(p); p++)
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4703 if (!(p->flags & P_NO_MKRC)
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4704 && !istermoption(p)
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4705 && ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4706 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4707 /* skip global option when only doing locals */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4708 if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4709 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4710
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4711 /* Do not store options like 'bufhidden' and 'syntax' in a vimrc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4712 * file, they are always buffer-specific. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4713 if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4714 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4716 /* Global values are only written when not at the default value. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4717 varp = get_varp_scope(p, opt_flags);
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
4718 if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp, p_cp))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4719 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4720
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4721 round = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4722 if (p->indir != PV_NONE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4723 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4724 if (p->var == VAR_WIN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4725 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4726 /* skip window-local option when only doing globals */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4727 if (!(opt_flags & OPT_LOCAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4728 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4729 /* When fresh value of window-local option is not at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4730 * default, need to write it too. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4731 if (!(opt_flags & OPT_GLOBAL) && !local_only)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4732 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4733 varp_fresh = get_varp_scope(p, OPT_GLOBAL);
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
4734 if (!optval_default(p, varp_fresh, p_cp))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4735 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4736 round = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4737 varp_local = varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4738 varp = varp_fresh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4739 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4740 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4741 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4742 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4743
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4744 /* Round 1: fresh value for window-local options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4745 * Round 2: other values */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4746 for ( ; round <= 2; varp = varp_local, ++round)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4747 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4748 if (round == 1 || (opt_flags & OPT_GLOBAL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4749 cmd = "set";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4750 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4751 cmd = "setlocal";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4752
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4753 if (p->flags & P_BOOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4754 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4755 if (put_setbool(fd, cmd, p->fullname, *(int *)varp) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4756 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4757 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4758 else if (p->flags & P_NUM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4759 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4760 if (put_setnum(fd, cmd, p->fullname, (long *)varp) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4761 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4762 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4763 else /* P_STRING */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4764 {
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
4765 int do_endif = FALSE;
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
4766
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4767 /* Don't set 'syntax' and 'filetype' again if the value is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4768 * already right, avoids reloading the syntax file. */
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
4769 if (
13380
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
4770 #if defined(FEAT_SYN_HL)
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
4771 p->indir == PV_SYN ||
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
4772 #endif
69517d67421f patch 8.0.1564: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 13361
diff changeset
4773 p->indir == PV_FT)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4774 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4775 if (fprintf(fd, "if &%s != '%s'", p->fullname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4776 *(char_u **)(varp)) < 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4777 || put_eol(fd) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4778 return FAIL;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
4779 do_endif = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4780 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4781 if (put_setstring(fd, cmd, p->fullname, (char_u **)varp,
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4782 p->flags) == FAIL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4783 return FAIL;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
4784 if (do_endif)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4785 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4786 if (put_line(fd, "endif") == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4787 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4788 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4789 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4790 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4791 }
1384
5ef53a1677ee updated for version 7.1-099
vimboss
parents: 1382
diff changeset
4792 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4793 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4794 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4795
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4796 #if defined(FEAT_FOLDING) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4797 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4798 * Generate set commands for the local fold options only. Used when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4799 * 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4800 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4801 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4802 makefoldset(FILE *fd)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4803 {
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4804 if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, 0) == FAIL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4805 # ifdef FEAT_EVAL
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4806 || put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4807 == FAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4808 # endif
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4809 || put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4810 == FAIL
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4811 || put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4812 == FAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4813 || put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4814 || put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4815 || put_setnum(fd, "setlocal", "fdn", &curwin->w_p_fdn) == FAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4816 || put_setbool(fd, "setlocal", "fen", curwin->w_p_fen) == FAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4817 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4818 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4819
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4820 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4821 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4822 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4823
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4824 static int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4825 put_setstring(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4826 FILE *fd,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4827 char *cmd,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4828 char *name,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4829 char_u **valuep,
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4830 long_u flags)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4831 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4832 char_u *s;
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4833 char_u *buf = NULL;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4834 char_u *part = NULL;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4835 char_u *p;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4836
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4837 if (fprintf(fd, "%s %s=", cmd, name) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4838 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4839 if (*valuep != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4840 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4841 /* Output 'pastetoggle' as key names. For other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4842 * options some characters have to be escaped with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4843 * CTRL-V or backslash */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4844 if (valuep == &p_pt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4845 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4846 s = *valuep;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4847 while (*s != NUL)
1601
eef96cfdbbbe updated for version 7.1-314
vimboss
parents: 1564
diff changeset
4848 if (put_escstr(fd, str2special(&s, FALSE), 2) == FAIL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4849 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4850 }
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4851 // expand the option value, replace $HOME by ~
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4852 else if ((flags & P_EXPAND) != 0)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4853 {
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4854 int size = (int)STRLEN(*valuep) + 1;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4855
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4856 // replace home directory in the whole option value into "buf"
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4857 buf = alloc(size);
2780
5ddb68c2a845 updated for version 7.3.166
Bram Moolenaar <bram@vim.org>
parents: 2774
diff changeset
4858 if (buf == NULL)
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4859 goto fail;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4860 home_replace(NULL, *valuep, buf, size, FALSE);
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4861
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4862 // If the option value is longer than MAXPATHL, we need to append
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4863 // earch comma separated part of the option separately, so that it
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4864 // can be expanded when read back.
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4865 if (size >= MAXPATHL && (flags & P_COMMA) != 0
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4866 && vim_strchr(*valuep, ',') != NULL)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4867 {
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4868 part = alloc(size);
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4869 if (part == NULL)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4870 goto fail;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4871
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4872 // write line break to clear the option, e.g. ':set rtp='
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4873 if (put_eol(fd) == FAIL)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4874 goto fail;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4875
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4876 p = buf;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4877 while (*p != NUL)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4878 {
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4879 // for each comma separated option part, append value to
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4880 // the option, :set rtp+=value
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4881 if (fprintf(fd, "%s %s+=", cmd, name) < 0)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4882 goto fail;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4883 (void)copy_option_part(&p, part, size, ",");
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4884 if (put_escstr(fd, part, 2) == FAIL || put_eol(fd) == FAIL)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4885 goto fail;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4886 }
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4887 vim_free(buf);
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4888 vim_free(part);
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4889 return OK;
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4890 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4891 if (put_escstr(fd, buf, 2) == FAIL)
2780
5ddb68c2a845 updated for version 7.3.166
Bram Moolenaar <bram@vim.org>
parents: 2774
diff changeset
4892 {
5ddb68c2a845 updated for version 7.3.166
Bram Moolenaar <bram@vim.org>
parents: 2774
diff changeset
4893 vim_free(buf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4894 return FAIL;
2780
5ddb68c2a845 updated for version 7.3.166
Bram Moolenaar <bram@vim.org>
parents: 2774
diff changeset
4895 }
5ddb68c2a845 updated for version 7.3.166
Bram Moolenaar <bram@vim.org>
parents: 2774
diff changeset
4896 vim_free(buf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4897 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4898 else if (put_escstr(fd, *valuep, 2) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4899 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4900 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4901 if (put_eol(fd) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4902 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4903 return OK;
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4904 fail:
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4905 vim_free(buf);
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4906 vim_free(part);
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15597
diff changeset
4907 return FAIL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4908 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4909
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4910 static int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4911 put_setnum(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4912 FILE *fd,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4913 char *cmd,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4914 char *name,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4915 long *valuep)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4916 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4917 long wc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4918
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4919 if (fprintf(fd, "%s %s=", cmd, name) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4920 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4921 if (wc_use_keyname((char_u *)valuep, &wc))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4922 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4923 /* print 'wildchar' and 'wildcharm' as a key name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4924 if (fputs((char *)get_special_key_name((int)wc, 0), fd) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4925 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4926 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4927 else if (fprintf(fd, "%ld", *valuep) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4928 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4929 if (put_eol(fd) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4930 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4931 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4932 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4933
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4934 static int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4935 put_setbool(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4936 FILE *fd,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4937 char *cmd,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4938 char *name,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4939 int value)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4940 {
1416
0a80dc6d7804 updated for version 7.1-131
vimboss
parents: 1408
diff changeset
4941 if (value < 0) /* global/local option using global value */
0a80dc6d7804 updated for version 7.1-131
vimboss
parents: 1408
diff changeset
4942 return OK;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4943 if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4944 || put_eol(fd) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4945 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4946 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4947 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4949 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4950 * Clear all the terminal options.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4951 * If the option has been allocated, free the memory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4952 * Terminal options are never hidden or indirect.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4953 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4954 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4955 clear_termoptions(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4956 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4957 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4958 * Reset a few things before clearing the old options. This may cause
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4959 * outputting a few things that the terminal doesn't understand, but the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4960 * screen will be cleared later, so this is OK.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4961 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4962 #ifdef FEAT_MOUSE_TTY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4963 mch_setmouse(FALSE); /* switch mouse off */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4964 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4965 #ifdef FEAT_TITLE
14479
3375a8cbb442 patch 8.1.0253: saving and restoring window title does not always work
Christian Brabandt <cb@256bit.org>
parents: 14381
diff changeset
4966 mch_restore_title(SAVE_RESTORE_BOTH); /* restore window titles */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4967 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4968 #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4969 /* When starting the GUI close the display opened for the clipboard.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4970 * After restoring the title, because that will need the display. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4971 if (gui.starting)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4972 clear_xterm_clip();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4973 #endif
10264
c036c0f636d5 commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents: 10205
diff changeset
4974 stoptermcap(); /* stop termcap mode */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4975
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
4976 free_termoptions();
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
4977 }
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
4978
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
4979 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
4980 free_termoptions(void)
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
4981 {
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
4982 struct vimoption *p;
6c62b9b939bd updated for version 7.0093
vimboss
parents: 344
diff changeset
4983
14867
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
4984 for (p = options; p->fullname != NULL; p++)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4985 if (istermoption(p))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4986 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4987 if (p->flags & P_ALLOCED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4988 free_string_option(*(char_u **)(p->var));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4989 if (p->flags & P_DEF_ALLOCED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4990 free_string_option(p->def_val[VI_DEFAULT]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4991 *(char_u **)(p->var) = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4992 p->def_val[VI_DEFAULT] = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4993 p->flags &= ~(P_ALLOCED|P_DEF_ALLOCED);
14867
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
4994 #ifdef FEAT_EVAL
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
4995 // remember where the option was cleared
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
4996 set_option_sctx_idx((int)(p - options), OPT_GLOBAL, current_sctx);
cf4d6489c9eb patch 8.1.0445: setting 'term' does not store location for termcap options
Christian Brabandt <cb@256bit.org>
parents: 14862
diff changeset
4997 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4998 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4999 clear_termcodes();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5000 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5002 /*
1941
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5003 * Free the string for one term option, if it was allocated.
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5004 * Set the string to empty_option and clear allocated flag.
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5005 * "var" points to the option value.
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5006 */
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5007 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5008 free_one_termoption(char_u *var)
1941
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5009 {
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5010 struct vimoption *p;
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5011
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5012 for (p = &options[0]; p->fullname != NULL; p++)
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5013 if (p->var == var)
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5014 {
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5015 if (p->flags & P_ALLOCED)
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5016 free_string_option(*(char_u **)(p->var));
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5017 *(char_u **)(p->var) = empty_option;
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5018 p->flags &= ~P_ALLOCED;
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5019 break;
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5020 }
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5021 }
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5022
d92358c7d621 updated for version 7.2-238
vimboss
parents: 1911
diff changeset
5023 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5024 * Set the terminal option defaults to the current value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5025 * Used after setting the terminal name.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5026 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5027 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5028 set_term_defaults(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5029 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5030 struct vimoption *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5031
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5032 for (p = &options[0]; p->fullname != NULL; p++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5033 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5034 if (istermoption(p) && p->def_val[VI_DEFAULT] != *(char_u **)(p->var))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5035 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5036 if (p->flags & P_DEF_ALLOCED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5037 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5038 free_string_option(p->def_val[VI_DEFAULT]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5039 p->flags &= ~P_DEF_ALLOCED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5040 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5041 p->def_val[VI_DEFAULT] = *(char_u **)(p->var);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5042 if (p->flags & P_ALLOCED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5043 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5044 p->flags |= P_DEF_ALLOCED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5045 p->flags &= ~P_ALLOCED; /* don't free the value now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5046 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5047 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5048 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5049 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5050
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5051 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5052 * return TRUE if 'p' starts with 't_'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5053 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5054 static int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5055 istermoption(struct vimoption *p)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5056 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5057 return (p->fullname[0] == 't' && p->fullname[1] == '_');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5058 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5059
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5060 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5061 * Returns TRUE if the option at 'opt_idx' starts with 't_'
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5062 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5063 int
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5064 istermoption_idx(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5065 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5066 return istermoption(&options[opt_idx]);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5067 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5068
15555
d89c5b339c2a patch 8.1.0785: depending on the configuration some functions are unused
Bram Moolenaar <Bram@vim.org>
parents: 15543
diff changeset
5069 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5070 /*
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5071 * Unset local option value, similar to ":set opt<".
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5072 */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5073 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5074 unset_global_local_option(char_u *name, void *from)
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5075 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5076 struct vimoption *p;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5077 int opt_idx;
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5078 buf_T *buf = (buf_T *)from;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5079
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5080 opt_idx = findoption(name);
7007
5ea5bd9c18d2 patch 7.4.821
Bram Moolenaar <bram@vim.org>
parents: 6954
diff changeset
5081 if (opt_idx < 0)
5ea5bd9c18d2 patch 7.4.821
Bram Moolenaar <bram@vim.org>
parents: 6954
diff changeset
5082 return;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5083 p = &(options[opt_idx]);
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5084
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5085 switch ((int)p->indir)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5086 {
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5087 /* global option with local value: use local value if it's been set */
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5088 case PV_EP:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5089 clear_string_option(&buf->b_p_ep);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5090 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5091 case PV_KP:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5092 clear_string_option(&buf->b_p_kp);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5093 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5094 case PV_PATH:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5095 clear_string_option(&buf->b_p_path);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5096 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5097 case PV_AR:
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5098 buf->b_p_ar = -1;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5099 break;
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5100 case PV_BKC:
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5101 clear_string_option(&buf->b_p_bkc);
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5102 buf->b_bkc_flags = 0;
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5103 break;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5104 case PV_TAGS:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5105 clear_string_option(&buf->b_p_tags);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5106 break;
7266
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5107 case PV_TC:
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5108 clear_string_option(&buf->b_p_tc);
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5109 buf->b_tc_flags = 0;
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5110 break;
15713
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5111 case PV_SISO:
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5112 curwin->w_p_siso = -1;
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5113 break;
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5114 case PV_SO:
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5115 curwin->w_p_so = -1;
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5116 break;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5117 #ifdef FEAT_FIND_ID
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5118 case PV_DEF:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5119 clear_string_option(&buf->b_p_def);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5120 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5121 case PV_INC:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5122 clear_string_option(&buf->b_p_inc);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5123 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5124 #endif
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5125 case PV_DICT:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5126 clear_string_option(&buf->b_p_dict);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5127 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5128 case PV_TSR:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5129 clear_string_option(&buf->b_p_tsr);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5130 break;
10579
688b97124d23 patch 8.0.0179: cannot have a local value for 'formatprg'
Christian Brabandt <cb@256bit.org>
parents: 10456
diff changeset
5131 case PV_FP:
688b97124d23 patch 8.0.0179: cannot have a local value for 'formatprg'
Christian Brabandt <cb@256bit.org>
parents: 10456
diff changeset
5132 clear_string_option(&buf->b_p_fp);
688b97124d23 patch 8.0.0179: cannot have a local value for 'formatprg'
Christian Brabandt <cb@256bit.org>
parents: 10456
diff changeset
5133 break;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5134 #ifdef FEAT_QUICKFIX
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5135 case PV_EFM:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5136 clear_string_option(&buf->b_p_efm);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5137 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5138 case PV_GP:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5139 clear_string_option(&buf->b_p_gp);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5140 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5141 case PV_MP:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5142 clear_string_option(&buf->b_p_mp);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5143 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5144 #endif
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5145 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5146 case PV_BEXPR:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5147 clear_string_option(&buf->b_p_bexpr);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5148 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5149 #endif
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5150 #if defined(FEAT_CRYPT)
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5151 case PV_CM:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5152 clear_string_option(&buf->b_p_cm);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5153 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5154 #endif
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5155 #ifdef FEAT_STL_OPT
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5156 case PV_STL:
4361
94aa0d30a3ea updated for version 7.3.929
Bram Moolenaar <bram@vim.org>
parents: 4350
diff changeset
5157 clear_string_option(&((win_T *)from)->w_p_stl);
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5158 break;
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5159 #endif
5446
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
5160 case PV_UL:
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
5161 buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
5162 break;
5712
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5163 #ifdef FEAT_LISP
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5164 case PV_LW:
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5165 clear_string_option(&buf->b_p_lw);
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5166 break;
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5167 #endif
11063
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents: 10968
diff changeset
5168 case PV_MENC:
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents: 10968
diff changeset
5169 clear_string_option(&buf->b_p_menc);
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents: 10968
diff changeset
5170 break;
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5171 }
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5172 }
15555
d89c5b339c2a patch 8.1.0785: depending on the configuration some functions are unused
Bram Moolenaar <Bram@vim.org>
parents: 15543
diff changeset
5173 #endif
4350
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5174
7eaccdaa5304 updated for version 7.3.924
Bram Moolenaar <bram@vim.org>
parents: 4242
diff changeset
5175 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5176 * Get pointer to option variable, depending on local or global scope.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5177 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5178 static char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5179 get_varp_scope(struct vimoption *p, int opt_flags)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5180 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5181 if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5182 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5183 if (p->var == VAR_WIN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5184 return (char_u *)GLOBAL_WO(get_varp(p));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5185 return p->var;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5186 }
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 688
diff changeset
5187 if ((opt_flags & OPT_LOCAL) && ((int)p->indir & PV_BOTH))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5189 switch ((int)p->indir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5190 {
10579
688b97124d23 patch 8.0.0179: cannot have a local value for 'formatprg'
Christian Brabandt <cb@256bit.org>
parents: 10456
diff changeset
5191 case PV_FP: return (char_u *)&(curbuf->b_p_fp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5192 #ifdef FEAT_QUICKFIX
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5193 case PV_EFM: return (char_u *)&(curbuf->b_p_efm);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5194 case PV_GP: return (char_u *)&(curbuf->b_p_gp);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5195 case PV_MP: return (char_u *)&(curbuf->b_p_mp);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5196 #endif
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5197 case PV_EP: return (char_u *)&(curbuf->b_p_ep);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5198 case PV_KP: return (char_u *)&(curbuf->b_p_kp);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5199 case PV_PATH: return (char_u *)&(curbuf->b_p_path);
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 688
diff changeset
5200 case PV_AR: return (char_u *)&(curbuf->b_p_ar);
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5201 case PV_TAGS: return (char_u *)&(curbuf->b_p_tags);
7266
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5202 case PV_TC: return (char_u *)&(curbuf->b_p_tc);
15713
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5203 case PV_SISO: return (char_u *)&(curwin->w_p_siso);
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5204 case PV_SO: return (char_u *)&(curwin->w_p_so);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5205 #ifdef FEAT_FIND_ID
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5206 case PV_DEF: return (char_u *)&(curbuf->b_p_def);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5207 case PV_INC: return (char_u *)&(curbuf->b_p_inc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5208 #endif
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5209 case PV_DICT: return (char_u *)&(curbuf->b_p_dict);
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5210 case PV_TSR: return (char_u *)&(curbuf->b_p_tsr);
790
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5211 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5212 case PV_BEXPR: return (char_u *)&(curbuf->b_p_bexpr);
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5213 #endif
2360
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5214 #if defined(FEAT_CRYPT)
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5215 case PV_CM: return (char_u *)&(curbuf->b_p_cm);
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5216 #endif
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5217 #ifdef FEAT_STL_OPT
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5218 case PV_STL: return (char_u *)&(curwin->w_p_stl);
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5219 #endif
5446
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
5220 case PV_UL: return (char_u *)&(curbuf->b_p_ul);
5712
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5221 #ifdef FEAT_LISP
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5222 case PV_LW: return (char_u *)&(curbuf->b_p_lw);
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5223 #endif
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5224 case PV_BKC: return (char_u *)&(curbuf->b_p_bkc);
11063
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents: 10968
diff changeset
5225 case PV_MENC: return (char_u *)&(curbuf->b_p_menc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5226 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5227 return NULL; /* "cannot happen" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5228 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5229 return get_varp(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5232 /*
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5233 * Get pointer to option variable at 'opt_idx', depending on local or global
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5234 * scope.
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5235 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5236 char_u *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5237 get_option_varp_scope(int opt_idx, int opt_flags)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5238 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5239 return get_varp_scope(&(options[opt_idx]), opt_flags);
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5240 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5241
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5242 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5243 * Get pointer to option variable.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5244 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5245 static char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5246 get_varp(struct vimoption *p)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5247 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5248 /* hidden option, always return NULL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5249 if (p->var == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5250 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5252 switch ((int)p->indir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5253 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5254 case PV_NONE: return p->var;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5256 /* global option with local value: use local value if it's been set */
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5257 case PV_EP: return *curbuf->b_p_ep != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5258 ? (char_u *)&curbuf->b_p_ep : p->var;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5259 case PV_KP: return *curbuf->b_p_kp != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5260 ? (char_u *)&curbuf->b_p_kp : p->var;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5261 case PV_PATH: return *curbuf->b_p_path != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5262 ? (char_u *)&(curbuf->b_p_path) : p->var;
692
a28f83d37113 updated for version 7.0208
vimboss
parents: 688
diff changeset
5263 case PV_AR: return curbuf->b_p_ar >= 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5264 ? (char_u *)&(curbuf->b_p_ar) : p->var;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5265 case PV_TAGS: return *curbuf->b_p_tags != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5266 ? (char_u *)&(curbuf->b_p_tags) : p->var;
7266
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5267 case PV_TC: return *curbuf->b_p_tc != NUL
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5268 ? (char_u *)&(curbuf->b_p_tc) : p->var;
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5269 case PV_BKC: return *curbuf->b_p_bkc != NUL
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5270 ? (char_u *)&(curbuf->b_p_bkc) : p->var;
15713
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5271 case PV_SISO: return curwin->w_p_siso >= 0
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5272 ? (char_u *)&(curwin->w_p_siso) : p->var;
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5273 case PV_SO: return curwin->w_p_so >= 0
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
5274 ? (char_u *)&(curwin->w_p_so) : p->var;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5275 #ifdef FEAT_FIND_ID
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5276 case PV_DEF: return *curbuf->b_p_def != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5277 ? (char_u *)&(curbuf->b_p_def) : p->var;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5278 case PV_INC: return *curbuf->b_p_inc != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5279 ? (char_u *)&(curbuf->b_p_inc) : p->var;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5280 #endif
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5281 case PV_DICT: return *curbuf->b_p_dict != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5282 ? (char_u *)&(curbuf->b_p_dict) : p->var;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5283 case PV_TSR: return *curbuf->b_p_tsr != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5284 ? (char_u *)&(curbuf->b_p_tsr) : p->var;
10579
688b97124d23 patch 8.0.0179: cannot have a local value for 'formatprg'
Christian Brabandt <cb@256bit.org>
parents: 10456
diff changeset
5285 case PV_FP: return *curbuf->b_p_fp != NUL
688b97124d23 patch 8.0.0179: cannot have a local value for 'formatprg'
Christian Brabandt <cb@256bit.org>
parents: 10456
diff changeset
5286 ? (char_u *)&(curbuf->b_p_fp) : p->var;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5287 #ifdef FEAT_QUICKFIX
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5288 case PV_EFM: return *curbuf->b_p_efm != NUL
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5289 ? (char_u *)&(curbuf->b_p_efm) : p->var;
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5290 case PV_GP: return *curbuf->b_p_gp != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5291 ? (char_u *)&(curbuf->b_p_gp) : p->var;
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5292 case PV_MP: return *curbuf->b_p_mp != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5293 ? (char_u *)&(curbuf->b_p_mp) : p->var;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5294 #endif
790
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5295 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5296 case PV_BEXPR: return *curbuf->b_p_bexpr != NUL
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5297 ? (char_u *)&(curbuf->b_p_bexpr) : p->var;
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5298 #endif
2360
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5299 #if defined(FEAT_CRYPT)
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5300 case PV_CM: return *curbuf->b_p_cm != NUL
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5301 ? (char_u *)&(curbuf->b_p_cm) : p->var;
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5302 #endif
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5303 #ifdef FEAT_STL_OPT
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5304 case PV_STL: return *curwin->w_p_stl != NUL
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5305 ? (char_u *)&(curwin->w_p_stl) : p->var;
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5306 #endif
5446
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
5307 case PV_UL: return curbuf->b_p_ul != NO_LOCAL_UNDOLEVEL
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
5308 ? (char_u *)&(curbuf->b_p_ul) : p->var;
5712
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5309 #ifdef FEAT_LISP
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5310 case PV_LW: return *curbuf->b_p_lw != NUL
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5311 ? (char_u *)&(curbuf->b_p_lw) : p->var;
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5312 #endif
11063
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents: 10968
diff changeset
5313 case PV_MENC: return *curbuf->b_p_menc != NUL
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents: 10968
diff changeset
5314 ? (char_u *)&(curbuf->b_p_menc) : p->var;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5315 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5316 case PV_ARAB: return (char_u *)&(curwin->w_p_arab);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5317 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5318 case PV_LIST: return (char_u *)&(curwin->w_p_list);
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5319 #ifdef FEAT_SPELL
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5320 case PV_SPELL: return (char_u *)&(curwin->w_p_spell);
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5321 #endif
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 190
diff changeset
5322 #ifdef FEAT_SYN_HL
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5323 case PV_CUC: return (char_u *)&(curwin->w_p_cuc);
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5324 case PV_CUL: return (char_u *)&(curwin->w_p_cul);
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents: 17940
diff changeset
5325 case PV_CULOPT: return (char_u *)&(curwin->w_p_culopt);
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5326 case PV_CC: return (char_u *)&(curwin->w_p_cc);
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 190
diff changeset
5327 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5328 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5329 case PV_DIFF: return (char_u *)&(curwin->w_p_diff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5330 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5331 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5332 case PV_FDC: return (char_u *)&(curwin->w_p_fdc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5333 case PV_FEN: return (char_u *)&(curwin->w_p_fen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5334 case PV_FDI: return (char_u *)&(curwin->w_p_fdi);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5335 case PV_FDL: return (char_u *)&(curwin->w_p_fdl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5336 case PV_FDM: return (char_u *)&(curwin->w_p_fdm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5337 case PV_FML: return (char_u *)&(curwin->w_p_fml);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5338 case PV_FDN: return (char_u *)&(curwin->w_p_fdn);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5339 # ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5340 case PV_FDE: return (char_u *)&(curwin->w_p_fde);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5341 case PV_FDT: return (char_u *)&(curwin->w_p_fdt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5342 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5343 case PV_FMR: return (char_u *)&(curwin->w_p_fmr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5344 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5345 case PV_NU: return (char_u *)&(curwin->w_p_nu);
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
5346 case PV_RNU: return (char_u *)&(curwin->w_p_rnu);
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
5347 #ifdef FEAT_LINEBREAK
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
5348 case PV_NUW: return (char_u *)&(curwin->w_p_nuw);
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
5349 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5350 case PV_WFH: return (char_u *)&(curwin->w_p_wfh);
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 767
diff changeset
5351 case PV_WFW: return (char_u *)&(curwin->w_p_wfw);
12477
68d7bc045dbe patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents: 12469
diff changeset
5352 #if defined(FEAT_QUICKFIX)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5353 case PV_PVW: return (char_u *)&(curwin->w_p_pvw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5354 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5355 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5356 case PV_RL: return (char_u *)&(curwin->w_p_rl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5357 case PV_RLC: return (char_u *)&(curwin->w_p_rlc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5358 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5359 case PV_SCROLL: return (char_u *)&(curwin->w_p_scr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5360 case PV_WRAP: return (char_u *)&(curwin->w_p_wrap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5361 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5362 case PV_LBR: return (char_u *)&(curwin->w_p_lbr);
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5363 case PV_BRI: return (char_u *)&(curwin->w_p_bri);
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5364 case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5365 #endif
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16764
diff changeset
5366 case PV_WCR: return (char_u *)&(curwin->w_p_wcr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5367 case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5368 case PV_CRBIND: return (char_u *)&(curwin->w_p_crb);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5369 #ifdef FEAT_CONCEAL
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5370 case PV_COCU: return (char_u *)&(curwin->w_p_cocu);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5371 case PV_COLE: return (char_u *)&(curwin->w_p_cole);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5372 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5373 #ifdef FEAT_TERMINAL
13742
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5374 case PV_TWK: return (char_u *)&(curwin->w_p_twk);
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5375 case PV_TWS: return (char_u *)&(curwin->w_p_tws);
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5376 case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5377 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5379 case PV_AI: return (char_u *)&(curbuf->b_p_ai);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5380 case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5381 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5382 case PV_BH: return (char_u *)&(curbuf->b_p_bh);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5383 case PV_BT: return (char_u *)&(curbuf->b_p_bt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5384 case PV_BL: return (char_u *)&(curbuf->b_p_bl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5385 case PV_CI: return (char_u *)&(curbuf->b_p_ci);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5386 #ifdef FEAT_CINDENT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5387 case PV_CIN: return (char_u *)&(curbuf->b_p_cin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5388 case PV_CINK: return (char_u *)&(curbuf->b_p_cink);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5389 case PV_CINO: return (char_u *)&(curbuf->b_p_cino);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5390 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5391 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5392 case PV_CINW: return (char_u *)&(curbuf->b_p_cinw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5393 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5394 #ifdef FEAT_COMMENTS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5395 case PV_COM: return (char_u *)&(curbuf->b_p_com);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5396 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5397 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5398 case PV_CMS: return (char_u *)&(curbuf->b_p_cms);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5399 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5400 case PV_CPT: return (char_u *)&(curbuf->b_p_cpt);
17809
59f8948b7590 patch 8.1.1901: the +insert_expand feature is not always available
Bram Moolenaar <Bram@vim.org>
parents: 17791
diff changeset
5401 #ifdef BACKSLASH_IN_FILENAME
17543
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17476
diff changeset
5402 case PV_CSL: return (char_u *)&(curbuf->b_p_csl);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5403 #endif
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5404 #ifdef FEAT_COMPL_FUNC
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5405 case PV_CFU: return (char_u *)&(curbuf->b_p_cfu);
502
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 501
diff changeset
5406 case PV_OFU: return (char_u *)&(curbuf->b_p_ofu);
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5407 #endif
16447
54ffc82f38a8 patch 8.1.1228: not possible to process tags with a function
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
5408 #ifdef FEAT_EVAL
54ffc82f38a8 patch 8.1.1228: not possible to process tags with a function
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
5409 case PV_TFU: return (char_u *)&(curbuf->b_p_tfu);
54ffc82f38a8 patch 8.1.1228: not possible to process tags with a function
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
5410 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5411 case PV_EOL: return (char_u *)&(curbuf->b_p_eol);
6933
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
5412 case PV_FIXEOL: return (char_u *)&(curbuf->b_p_fixeol);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5413 case PV_ET: return (char_u *)&(curbuf->b_p_et);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5414 case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5415 case PV_FF: return (char_u *)&(curbuf->b_p_ff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5416 case PV_FT: return (char_u *)&(curbuf->b_p_ft);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5417 case PV_FO: return (char_u *)&(curbuf->b_p_fo);
41
f529edb9bab3 updated for version 7.0025
vimboss
parents: 40
diff changeset
5418 case PV_FLP: return (char_u *)&(curbuf->b_p_flp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5419 case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5420 case PV_IMS: return (char_u *)&(curbuf->b_p_imsearch);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5421 case PV_INF: return (char_u *)&(curbuf->b_p_inf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5422 case PV_ISK: return (char_u *)&(curbuf->b_p_isk);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5423 #ifdef FEAT_FIND_ID
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5424 # ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5425 case PV_INEX: return (char_u *)&(curbuf->b_p_inex);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5426 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5427 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5428 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5429 case PV_INDE: return (char_u *)&(curbuf->b_p_inde);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5430 case PV_INDK: return (char_u *)&(curbuf->b_p_indk);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5431 #endif
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 692
diff changeset
5432 #ifdef FEAT_EVAL
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 665
diff changeset
5433 case PV_FEX: return (char_u *)&(curbuf->b_p_fex);
9090f866cd57 updated for version 7.0197
vimboss
parents: 665
diff changeset
5434 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5435 #ifdef FEAT_CRYPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5436 case PV_KEY: return (char_u *)&(curbuf->b_p_key);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5437 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5438 #ifdef FEAT_LISP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5439 case PV_LISP: return (char_u *)&(curbuf->b_p_lisp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5440 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5441 case PV_ML: return (char_u *)&(curbuf->b_p_ml);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5442 case PV_MPS: return (char_u *)&(curbuf->b_p_mps);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5443 case PV_MA: return (char_u *)&(curbuf->b_p_ma);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5444 case PV_MOD: return (char_u *)&(curbuf->b_changed);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5445 case PV_NF: return (char_u *)&(curbuf->b_p_nf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5446 case PV_PI: return (char_u *)&(curbuf->b_p_pi);
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5447 #ifdef FEAT_TEXTOBJ
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5448 case PV_QE: return (char_u *)&(curbuf->b_p_qe);
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5449 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5450 case PV_RO: return (char_u *)&(curbuf->b_p_ro);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5451 #ifdef FEAT_SMARTINDENT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5452 case PV_SI: return (char_u *)&(curbuf->b_p_si);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5453 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5454 case PV_SN: return (char_u *)&(curbuf->b_p_sn);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5455 case PV_STS: return (char_u *)&(curbuf->b_p_sts);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5456 #ifdef FEAT_SEARCHPATH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5457 case PV_SUA: return (char_u *)&(curbuf->b_p_sua);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5458 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5459 case PV_SWF: return (char_u *)&(curbuf->b_p_swf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5460 #ifdef FEAT_SYN_HL
410
c60ba877860b updated for version 7.0107
vimboss
parents: 402
diff changeset
5461 case PV_SMC: return (char_u *)&(curbuf->b_p_smc);
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5462 case PV_SYN: return (char_u *)&(curbuf->b_p_syn);
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5463 #endif
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5464 #ifdef FEAT_SPELL
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5465 case PV_SPC: return (char_u *)&(curwin->w_s->b_p_spc);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5466 case PV_SPF: return (char_u *)&(curwin->w_s->b_p_spf);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5467 case PV_SPL: return (char_u *)&(curwin->w_s->b_p_spl);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5468 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5469 case PV_SW: return (char_u *)&(curbuf->b_p_sw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5470 case PV_TS: return (char_u *)&(curbuf->b_p_ts);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5471 case PV_TW: return (char_u *)&(curbuf->b_p_tw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5472 case PV_TX: return (char_u *)&(curbuf->b_p_tx);
2214
f8222d1f9a73 Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents: 2184
diff changeset
5473 #ifdef FEAT_PERSISTENT_UNDO
f8222d1f9a73 Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents: 2184
diff changeset
5474 case PV_UDF: return (char_u *)&(curbuf->b_p_udf);
f8222d1f9a73 Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents: 2184
diff changeset
5475 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5476 case PV_WM: return (char_u *)&(curbuf->b_p_wm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5477 #ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5478 case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5479 #endif
9852
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5480 #ifdef FEAT_SIGNS
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5481 case PV_SCL: return (char_u *)&(curwin->w_p_scl);
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5482 #endif
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5483 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5484 case PV_VSTS: return (char_u *)&(curbuf->b_p_vsts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5485 case PV_VTS: return (char_u *)&(curbuf->b_p_vts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5486 #endif
15470
55ccc2d353bd patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents: 15207
diff changeset
5487 default: iemsg(_("E356: get_varp ERROR"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5488 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5489 /* always return a valid pointer to avoid a crash! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5490 return (char_u *)&(curbuf->b_p_wm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5491 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5492
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5493 /*
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5494 * Return a pointer to the variable for option at 'opt_idx'
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5495 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5496 char_u *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5497 get_option_var(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5498 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5499 return options[opt_idx].var;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5500 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5501
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5502 /*
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5503 * Return the full name of the option at 'opt_idx'
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5504 */
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5505 char_u *
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5506 get_option_fullname(int opt_idx)
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5507 {
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5508 return (char_u *)options[opt_idx].fullname;
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5509 }
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5510
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
5511 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5512 * Get the value of 'equalprg', either the buffer-local one or the global one.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5513 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5514 char_u *
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5515 get_equalprg(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5516 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5517 if (*curbuf->b_p_ep == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5518 return p_ep;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5519 return curbuf->b_p_ep;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5520 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5521
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5522 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5523 * Copy options from one window to another.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5524 * Used when splitting a window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5525 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5526 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5527 win_copy_options(win_T *wp_from, win_T *wp_to)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5528 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5529 copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5530 copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
6162
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
5531 #if defined(FEAT_LINEBREAK)
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
5532 briopt_check(wp_to);
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
5533 #endif
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
5534 #ifdef FEAT_SYN_HL
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
5535 fill_culopt_flags(NULL, wp_to);
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
5536 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5537 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5538
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5539 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5540 * Copy the options from one winopt_T to another.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5541 * Doesn't free the old option values in "to", use clear_winopt() for that.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5542 * The 'scroll' option is not copied, because it depends on the window height.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5543 * The 'previewwindow' option is reset, there can be only one preview window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5544 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5545 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5546 copy_winopt(winopt_T *from, winopt_T *to)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5547 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5548 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5549 to->wo_arab = from->wo_arab;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5550 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5551 to->wo_list = from->wo_list;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5552 to->wo_nu = from->wo_nu;
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2144
diff changeset
5553 to->wo_rnu = from->wo_rnu;
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
5554 #ifdef FEAT_LINEBREAK
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
5555 to->wo_nuw = from->wo_nuw;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
5556 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5557 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5558 to->wo_rl = from->wo_rl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5559 to->wo_rlc = vim_strsave(from->wo_rlc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5560 #endif
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5561 #ifdef FEAT_STL_OPT
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5562 to->wo_stl = vim_strsave(from->wo_stl);
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5563 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5564 to->wo_wrap = from->wo_wrap;
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5565 #ifdef FEAT_DIFF
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5566 to->wo_wrap_save = from->wo_wrap_save;
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5567 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5568 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5569 to->wo_lbr = from->wo_lbr;
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5570 to->wo_bri = from->wo_bri;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5571 to->wo_briopt = vim_strsave(from->wo_briopt);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5572 #endif
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16764
diff changeset
5573 to->wo_wcr = vim_strsave(from->wo_wcr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5574 to->wo_scb = from->wo_scb;
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5575 to->wo_scb_save = from->wo_scb_save;
2651
b254cfdd7405 updated for version 7.3.071
Bram Moolenaar <bram@vim.org>
parents: 2599
diff changeset
5576 to->wo_crb = from->wo_crb;
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5577 to->wo_crb_save = from->wo_crb_save;
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5578 #ifdef FEAT_SPELL
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5579 to->wo_spell = from->wo_spell;
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5580 #endif
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 190
diff changeset
5581 #ifdef FEAT_SYN_HL
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5582 to->wo_cuc = from->wo_cuc;
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5583 to->wo_cul = from->wo_cul;
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents: 17940
diff changeset
5584 to->wo_culopt = vim_strsave(from->wo_culopt);
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5585 to->wo_cc = vim_strsave(from->wo_cc);
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 190
diff changeset
5586 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5587 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5588 to->wo_diff = from->wo_diff;
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5589 to->wo_diff_saved = from->wo_diff_saved;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5590 #endif
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5591 #ifdef FEAT_CONCEAL
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5592 to->wo_cocu = vim_strsave(from->wo_cocu);
2379
b67b0b5a93d3 Window split didn't copy the value of 'conceallevel'.
Bram Moolenaar <bram@vim.org>
parents: 2378
diff changeset
5593 to->wo_cole = from->wo_cole;
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5594 #endif
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5595 #ifdef FEAT_TERMINAL
13742
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5596 to->wo_twk = vim_strsave(from->wo_twk);
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5597 to->wo_tws = vim_strsave(from->wo_tws);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5598 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5599 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5600 to->wo_fdc = from->wo_fdc;
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5601 to->wo_fdc_save = from->wo_fdc_save;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5602 to->wo_fen = from->wo_fen;
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5603 to->wo_fen_save = from->wo_fen_save;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5604 to->wo_fdi = vim_strsave(from->wo_fdi);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5605 to->wo_fml = from->wo_fml;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5606 to->wo_fdl = from->wo_fdl;
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5607 to->wo_fdl_save = from->wo_fdl_save;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5608 to->wo_fdm = vim_strsave(from->wo_fdm);
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5609 to->wo_fdm_save = from->wo_diff_saved
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5610 ? vim_strsave(from->wo_fdm_save) : empty_option;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5611 to->wo_fdn = from->wo_fdn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5612 # ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5613 to->wo_fde = vim_strsave(from->wo_fde);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5614 to->wo_fdt = vim_strsave(from->wo_fdt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5615 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5616 to->wo_fmr = vim_strsave(from->wo_fmr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5617 #endif
9852
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5618 #ifdef FEAT_SIGNS
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5619 to->wo_scl = vim_strsave(from->wo_scl);
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5620 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5621 check_winopt(to); /* don't want NULL pointers */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5622 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5624 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5625 * Check string options in a window for a NULL value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5626 */
17789
0f7ae8010787 patch 8.1.1891: functions used in one file are global
Bram Moolenaar <Bram@vim.org>
parents: 17781
diff changeset
5627 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5628 check_win_options(win_T *win)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5629 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5630 check_winopt(&win->w_onebuf_opt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5631 check_winopt(&win->w_allbuf_opt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5632 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5633
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5634 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5635 * Check for NULL pointers in a winopt_T and replace them with empty_option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5636 */
5997
fd7110d0c3bf updated for version 7.4.339
Bram Moolenaar <bram@vim.org>
parents: 5995
diff changeset
5637 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5638 check_winopt(winopt_T *wop UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5639 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5640 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5641 check_string_option(&wop->wo_fdi);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5642 check_string_option(&wop->wo_fdm);
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5643 check_string_option(&wop->wo_fdm_save);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5644 # ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5645 check_string_option(&wop->wo_fde);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5646 check_string_option(&wop->wo_fdt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5647 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5648 check_string_option(&wop->wo_fmr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5649 #endif
9852
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5650 #ifdef FEAT_SIGNS
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5651 check_string_option(&wop->wo_scl);
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5652 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5653 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5654 check_string_option(&wop->wo_rlc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5655 #endif
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5656 #ifdef FEAT_STL_OPT
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5657 check_string_option(&wop->wo_stl);
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5658 #endif
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5659 #ifdef FEAT_SYN_HL
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents: 17940
diff changeset
5660 check_string_option(&wop->wo_culopt);
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5661 check_string_option(&wop->wo_cc);
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5662 #endif
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5663 #ifdef FEAT_CONCEAL
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5664 check_string_option(&wop->wo_cocu);
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5665 #endif
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5666 #ifdef FEAT_TERMINAL
13742
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5667 check_string_option(&wop->wo_twk);
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5668 check_string_option(&wop->wo_tws);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5669 #endif
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5670 #ifdef FEAT_LINEBREAK
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5671 check_string_option(&wop->wo_briopt);
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5672 #endif
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16764
diff changeset
5673 check_string_option(&wop->wo_wcr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5674 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5675
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5676 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5677 * Free the allocated memory inside a winopt_T.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5678 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5679 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5680 clear_winopt(winopt_T *wop UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5681 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5682 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5683 clear_string_option(&wop->wo_fdi);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5684 clear_string_option(&wop->wo_fdm);
5102
11d0c6df1d7b updated for version 7.3.1294
Bram Moolenaar <bram@vim.org>
parents: 5070
diff changeset
5685 clear_string_option(&wop->wo_fdm_save);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5686 # ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5687 clear_string_option(&wop->wo_fde);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5688 clear_string_option(&wop->wo_fdt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5689 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5690 clear_string_option(&wop->wo_fmr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5691 #endif
9852
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5692 #ifdef FEAT_SIGNS
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5693 clear_string_option(&wop->wo_scl);
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
5694 #endif
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5695 #ifdef FEAT_LINEBREAK
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5696 clear_string_option(&wop->wo_briopt);
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
5697 #endif
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16764
diff changeset
5698 clear_string_option(&wop->wo_wcr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5699 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5700 clear_string_option(&wop->wo_rlc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5701 #endif
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5702 #ifdef FEAT_STL_OPT
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5703 clear_string_option(&wop->wo_stl);
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5704 #endif
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5705 #ifdef FEAT_SYN_HL
18047
6650e3dff8d4 patch 8.1.2019: 'cursorline' always highlights the whole line
Bram Moolenaar <Bram@vim.org>
parents: 17940
diff changeset
5706 clear_string_option(&wop->wo_culopt);
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5707 clear_string_option(&wop->wo_cc);
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2311
diff changeset
5708 #endif
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5709 #ifdef FEAT_CONCEAL
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5710 clear_string_option(&wop->wo_cocu);
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2362
diff changeset
5711 #endif
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5712 #ifdef FEAT_TERMINAL
13742
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5713 clear_string_option(&wop->wo_twk);
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5714 clear_string_option(&wop->wo_tws);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents: 11587
diff changeset
5715 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5716 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5717
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5718 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5719 * Copy global option values to local options for one buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5720 * Used when creating a new buffer and sometimes when entering a buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5721 * flags:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5722 * BCO_ENTER We will enter the buf buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5723 * BCO_ALWAYS Always copy the options, but only set b_p_initialized when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5724 * appropriate.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5725 * BCO_NOHELP Don't copy the values to a help buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5726 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5727 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
5728 buf_copy_options(buf_T *buf, int flags)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5729 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5730 int should_copy = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5731 char_u *save_p_isk = NULL; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5732 int dont_do_help;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5733 int did_isk = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5734
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5735 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5736 * Skip this when the option defaults have not been set yet. Happens when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5737 * main() allocates the first buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5738 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5739 if (p_cpo != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5740 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5741 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5742 * Always copy when entering and 'cpo' contains 'S'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5743 * Don't copy when already initialized.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5744 * Don't copy when 'cpo' contains 's' and not entering.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5745 * 'S' BCO_ENTER initialized 's' should_copy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5746 * yes yes X X TRUE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5747 * yes no yes X FALSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5748 * no X yes X FALSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5749 * X no no yes FALSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5750 * X no no no TRUE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5751 * no yes no X TRUE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5752 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5753 if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5754 && (buf->b_p_initialized
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5755 || (!(flags & BCO_ENTER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5756 && vim_strchr(p_cpo, CPO_BUFOPT) != NULL)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5757 should_copy = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5758
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5759 if (should_copy || (flags & BCO_ALWAYS))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5760 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5761 /* Don't copy the options specific to a help buffer when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5762 * BCO_NOHELP is given or the options were initialized already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5763 * (jumping back to a help file with CTRL-T or CTRL-O) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5764 dont_do_help = ((flags & BCO_NOHELP) && buf->b_help)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5765 || buf->b_p_initialized;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5766 if (dont_do_help) /* don't free b_p_isk */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5767 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5768 save_p_isk = buf->b_p_isk;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5769 buf->b_p_isk = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5770 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5771 /*
14479
3375a8cbb442 patch 8.1.0253: saving and restoring window title does not always work
Christian Brabandt <cb@256bit.org>
parents: 14381
diff changeset
5772 * Always free the allocated strings. If not already initialized,
3375a8cbb442 patch 8.1.0253: saving and restoring window title does not always work
Christian Brabandt <cb@256bit.org>
parents: 14381
diff changeset
5773 * reset 'readonly' and copy 'fileformat'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5774 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5775 if (!buf->b_p_initialized)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5776 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5777 free_buf_options(buf, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5778 buf->b_p_ro = FALSE; /* don't copy readonly */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5779 buf->b_p_tx = p_tx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5780 buf->b_p_fenc = vim_strsave(p_fenc);
10268
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5781 switch (*p_ffs)
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5782 {
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5783 case 'm':
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5784 buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break;
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5785 case 'd':
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5786 buf->b_p_ff = vim_strsave((char_u *)FF_DOS); break;
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5787 case 'u':
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5788 buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); break;
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5789 default:
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5790 buf->b_p_ff = vim_strsave(p_ff);
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5791 }
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5792 if (buf->b_p_ff != NULL)
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents: 10264
diff changeset
5793 buf->b_start_ffc = *buf->b_p_ff;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5794 buf->b_p_bh = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5795 buf->b_p_bt = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5796 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5797 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5798 free_buf_options(buf, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5799
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5800 buf->b_p_ai = p_ai;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5801 buf->b_p_ai_nopaste = p_ai_nopaste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5802 buf->b_p_sw = p_sw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5803 buf->b_p_tw = p_tw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5804 buf->b_p_tw_nopaste = p_tw_nopaste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5805 buf->b_p_tw_nobin = p_tw_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5806 buf->b_p_wm = p_wm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5807 buf->b_p_wm_nopaste = p_wm_nopaste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5808 buf->b_p_wm_nobin = p_wm_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5809 buf->b_p_bin = p_bin;
402
5b1544b1b228 updated for version 7.0105
vimboss
parents: 389
diff changeset
5810 buf->b_p_bomb = p_bomb;
6954
a958ac497a81 patch 7.4.795
Bram Moolenaar <bram@vim.org>
parents: 6949
diff changeset
5811 buf->b_p_fixeol = p_fixeol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5812 buf->b_p_et = p_et;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5813 buf->b_p_et_nobin = p_et_nobin;
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
5814 buf->b_p_et_nopaste = p_et_nopaste;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5815 buf->b_p_ml = p_ml;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5816 buf->b_p_ml_nobin = p_ml_nobin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5817 buf->b_p_inf = p_inf;
11321
f57dce6b934b patch 8.0.0546: swap file exists briefly when opening the command window
Christian Brabandt <cb@256bit.org>
parents: 11158
diff changeset
5818 buf->b_p_swf = cmdmod.noswapfile ? FALSE : p_swf;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5819 buf->b_p_cpt = vim_strsave(p_cpt);
17809
59f8948b7590 patch 8.1.1901: the +insert_expand feature is not always available
Bram Moolenaar <Bram@vim.org>
parents: 17791
diff changeset
5820 #ifdef BACKSLASH_IN_FILENAME
17543
77c3f6428b6c patch 8.1.1769: 'shellslash' is also used for completion
Bram Moolenaar <Bram@vim.org>
parents: 17476
diff changeset
5821 buf->b_p_csl = vim_strsave(p_csl);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5822 #endif
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5823 #ifdef FEAT_COMPL_FUNC
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5824 buf->b_p_cfu = vim_strsave(p_cfu);
502
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 501
diff changeset
5825 buf->b_p_ofu = vim_strsave(p_ofu);
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5826 #endif
16447
54ffc82f38a8 patch 8.1.1228: not possible to process tags with a function
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
5827 #ifdef FEAT_EVAL
54ffc82f38a8 patch 8.1.1228: not possible to process tags with a function
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
5828 buf->b_p_tfu = vim_strsave(p_tfu);
54ffc82f38a8 patch 8.1.1228: not possible to process tags with a function
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
5829 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5830 buf->b_p_sts = p_sts;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5831 buf->b_p_sts_nopaste = p_sts_nopaste;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5832 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5833 buf->b_p_vsts = vim_strsave(p_vsts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5834 if (p_vsts && p_vsts != empty_option)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5835 tabstop_set(p_vsts, &buf->b_p_vsts_array);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5836 else
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5837 buf->b_p_vsts_array = 0;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5838 buf->b_p_vsts_nopaste = p_vsts_nopaste
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5839 ? vim_strsave(p_vsts_nopaste) : NULL;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5840 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5841 buf->b_p_sn = p_sn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5842 #ifdef FEAT_COMMENTS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5843 buf->b_p_com = vim_strsave(p_com);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5844 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5845 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5846 buf->b_p_cms = vim_strsave(p_cms);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5847 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5848 buf->b_p_fo = vim_strsave(p_fo);
41
f529edb9bab3 updated for version 7.0025
vimboss
parents: 40
diff changeset
5849 buf->b_p_flp = vim_strsave(p_flp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5850 buf->b_p_nf = vim_strsave(p_nf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5851 buf->b_p_mps = vim_strsave(p_mps);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5852 #ifdef FEAT_SMARTINDENT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5853 buf->b_p_si = p_si;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5854 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5855 buf->b_p_ci = p_ci;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5856 #ifdef FEAT_CINDENT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5857 buf->b_p_cin = p_cin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5858 buf->b_p_cink = vim_strsave(p_cink);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5859 buf->b_p_cino = vim_strsave(p_cino);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5860 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5861 /* Don't copy 'filetype', it must be detected */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5862 buf->b_p_ft = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5863 buf->b_p_pi = p_pi;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5864 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5865 buf->b_p_cinw = vim_strsave(p_cinw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5866 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5867 #ifdef FEAT_LISP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5868 buf->b_p_lisp = p_lisp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5869 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5870 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5871 /* Don't copy 'syntax', it must be set */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5872 buf->b_p_syn = empty_option;
410
c60ba877860b updated for version 7.0107
vimboss
parents: 402
diff changeset
5873 buf->b_p_smc = p_smc;
7687
61354fabf8a2 commit https://github.com/vim/vim/commit/b8060fe862f684b591f9ac679eac5b2594d6c5a0
Christian Brabandt <cb@256bit.org>
parents: 7538
diff changeset
5874 buf->b_s.b_syn_isk = empty_option;
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5875 #endif
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
5876 #ifdef FEAT_SPELL
2599
8aa94f8080bd updated for version 7.3.022
Bram Moolenaar <bram@vim.org>
parents: 2577
diff changeset
5877 buf->b_s.b_p_spc = vim_strsave(p_spc);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5878 (void)compile_cap_prog(&buf->b_s);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5879 buf->b_s.b_p_spf = vim_strsave(p_spf);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2248
diff changeset
5880 buf->b_s.b_p_spl = vim_strsave(p_spl);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5881 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5882 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5883 buf->b_p_inde = vim_strsave(p_inde);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5884 buf->b_p_indk = vim_strsave(p_indk);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5885 #endif
10579
688b97124d23 patch 8.0.0179: cannot have a local value for 'formatprg'
Christian Brabandt <cb@256bit.org>
parents: 10456
diff changeset
5886 buf->b_p_fp = empty_option;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 665
diff changeset
5887 #if defined(FEAT_EVAL)
9090f866cd57 updated for version 7.0197
vimboss
parents: 665
diff changeset
5888 buf->b_p_fex = vim_strsave(p_fex);
9090f866cd57 updated for version 7.0197
vimboss
parents: 665
diff changeset
5889 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5890 #ifdef FEAT_CRYPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5891 buf->b_p_key = vim_strsave(p_key);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5892 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5893 #ifdef FEAT_SEARCHPATH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5894 buf->b_p_sua = vim_strsave(p_sua);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5895 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5896 #ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5897 buf->b_p_keymap = vim_strsave(p_keymap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5898 buf->b_kmap_state |= KEYMAP_INIT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5899 #endif
13742
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5900 #ifdef FEAT_TERMINAL
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5901 buf->b_p_twsl = p_twsl;
a34b1323286c patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents: 13700
diff changeset
5902 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5903 /* This isn't really an option, but copying the langmap and IME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5904 * state from the current buffer is better than resetting it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5905 buf->b_p_iminsert = p_iminsert;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5906 buf->b_p_imsearch = p_imsearch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5907
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5908 /* options that are normally global but also have a local value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5909 * are not copied, start using the global value */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5910 buf->b_p_ar = -1;
5446
d0595545e98a updated for version 7.4.073
Bram Moolenaar <bram@vim.org>
parents: 5438
diff changeset
5911 buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5912 buf->b_p_bkc = empty_option;
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
5913 buf->b_bkc_flags = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5914 #ifdef FEAT_QUICKFIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5915 buf->b_p_gp = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5916 buf->b_p_mp = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5917 buf->b_p_efm = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5918 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5919 buf->b_p_ep = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5920 buf->b_p_kp = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5921 buf->b_p_path = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5922 buf->b_p_tags = empty_option;
7266
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5923 buf->b_p_tc = empty_option;
6ba7182fb7bd commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents: 7218
diff changeset
5924 buf->b_tc_flags = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5925 #ifdef FEAT_FIND_ID
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5926 buf->b_p_def = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5927 buf->b_p_inc = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5928 # ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5929 buf->b_p_inex = vim_strsave(p_inex);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5930 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5931 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5932 buf->b_p_dict = empty_option;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5933 buf->b_p_tsr = empty_option;
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5934 #ifdef FEAT_TEXTOBJ
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5935 buf->b_p_qe = vim_strsave(p_qe);
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
5936 #endif
790
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5937 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5938 buf->b_p_bexpr = empty_option;
c8680debe1cc updated for version 7.0230
vimboss
parents: 786
diff changeset
5939 #endif
2360
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5940 #if defined(FEAT_CRYPT)
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5941 buf->b_p_cm = empty_option;
d8e4b27cef80 Change 'cryptmethod' from a number to a string option. Make it global-local.
Bram Moolenaar <bram@vim.org>
parents: 2348
diff changeset
5942 #endif
2214
f8222d1f9a73 Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents: 2184
diff changeset
5943 #ifdef FEAT_PERSISTENT_UNDO
f8222d1f9a73 Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents: 2184
diff changeset
5944 buf->b_p_udf = p_udf;
f8222d1f9a73 Included patch for persistent undo. Lots of changes and added test.
Bram Moolenaar <bram@vim.org>
parents: 2184
diff changeset
5945 #endif
5712
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5946 #ifdef FEAT_LISP
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5947 buf->b_p_lw = empty_option;
06e5f65c34d8 updated for version 7.4.201
Bram Moolenaar <bram@vim.org>
parents: 5610
diff changeset
5948 #endif
11063
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents: 10968
diff changeset
5949 buf->b_p_menc = empty_option;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5950
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5951 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5952 * Don't copy the options set by ex_help(), use the saved values,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5953 * when going from a help buffer to a non-help buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5954 * Don't touch these at all when BCO_NOHELP is used and going from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5955 * or to a help buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5956 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5957 if (dont_do_help)
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5958 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5959 buf->b_p_isk = save_p_isk;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5960 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5961 if (p_vts && p_vts != empty_option && !buf->b_p_vts_array)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5962 tabstop_set(p_vts, &buf->b_p_vts_array);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5963 else
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5964 buf->b_p_vts_array = NULL;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5965 #endif
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5966 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5967 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5968 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5969 buf->b_p_isk = vim_strsave(p_isk);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5970 did_isk = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5971 buf->b_p_ts = p_ts;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5972 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5973 buf->b_p_vts = vim_strsave(p_vts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5974 if (p_vts && p_vts != empty_option && !buf->b_p_vts_array)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5975 tabstop_set(p_vts, &buf->b_p_vts_array);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5976 else
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5977 buf->b_p_vts_array = NULL;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
5978 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5979 buf->b_help = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5980 if (buf->b_p_bt[0] == 'h')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5981 clear_string_option(&buf->b_p_bt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5982 buf->b_p_ma = p_ma;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5983 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5984 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5985
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5986 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5987 * When the options should be copied (ignoring BCO_ALWAYS), set the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5988 * flag that indicates that the options have been initialized.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5989 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5990 if (should_copy)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5991 buf->b_p_initialized = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5992 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5993
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5994 check_buf_options(buf); /* make sure we don't have NULLs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5995 if (did_isk)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5996 (void)buf_init_chartab(buf, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5997 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5998
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5999 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6000 * Reset the 'modifiable' option and its default value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6001 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6002 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6003 reset_modifiable(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6004 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6005 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6006
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6007 curbuf->b_p_ma = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6008 p_ma = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6009 opt_idx = findoption((char_u *)"ma");
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
6010 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
6011 options[opt_idx].def_val[VI_DEFAULT] = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6012 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6013
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6014 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6015 * Set the global value for 'iminsert' to the local value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6016 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6017 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6018 set_iminsert_global(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6019 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6020 p_iminsert = curbuf->b_p_iminsert;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6021 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6022
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6023 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6024 * Set the global value for 'imsearch' to the local value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6025 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6026 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6027 set_imsearch_global(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6028 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6029 p_imsearch = curbuf->b_p_imsearch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6030 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6031
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6032 static int expand_option_idx = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6033 static char_u expand_option_name[5] = {'t', '_', NUL, NUL, NUL};
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6034 static int expand_option_flags = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6035
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6036 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6037 set_context_in_set_cmd(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6038 expand_T *xp,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6039 char_u *arg,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6040 int opt_flags) /* OPT_GLOBAL and/or OPT_LOCAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6041 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6042 int nextchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6043 long_u flags = 0; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6044 int opt_idx = 0; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6045 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6046 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6047 int is_term_option = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6048 int key;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6049
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6050 expand_option_flags = opt_flags;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6051
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6052 xp->xp_context = EXPAND_SETTINGS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6053 if (*arg == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6054 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6055 xp->xp_pattern = arg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6056 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6057 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6058 p = arg + STRLEN(arg) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6059 if (*p == ' ' && *(p - 1) != '\\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6060 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6061 xp->xp_pattern = p + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6062 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6063 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6064 while (p > arg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6065 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6066 s = p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6067 /* count number of backslashes before ' ' or ',' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6068 if (*p == ' ' || *p == ',')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6069 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6070 while (s > arg && *(s - 1) == '\\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6071 --s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6072 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6073 /* break at a space with an even number of backslashes */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6074 if (*p == ' ' && ((p - s) & 1) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6075 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6076 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6077 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6078 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6079 --p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6080 }
1911
afbe4a4c884c updated for version 7.2-208
vimboss
parents: 1904
diff changeset
6081 if (STRNCMP(p, "no", 2) == 0 && STRNCMP(p, "novice", 6) != 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6082 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6083 xp->xp_context = EXPAND_BOOL_SETTINGS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6084 p += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6085 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6086 if (STRNCMP(p, "inv", 3) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6087 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6088 xp->xp_context = EXPAND_BOOL_SETTINGS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6089 p += 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6090 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6091 xp->xp_pattern = arg = p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6092 if (*arg == '<')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6093 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6094 while (*p != '>')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6095 if (*p++ == NUL) /* expand terminal option name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6096 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6097 key = get_special_key_code(arg + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6098 if (key == 0) /* unknown name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6099 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6100 xp->xp_context = EXPAND_NOTHING;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6101 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6102 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6103 nextchar = *++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6104 is_term_option = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6105 expand_option_name[2] = KEY2TERMCAP0(key);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6106 expand_option_name[3] = KEY2TERMCAP1(key);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6107 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6108 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6109 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6110 if (p[0] == 't' && p[1] == '_')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6111 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6112 p += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6113 if (*p != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6114 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6115 if (*p == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6116 return; /* expand option name */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6117 nextchar = *++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6118 is_term_option = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6119 expand_option_name[2] = p[-2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6120 expand_option_name[3] = p[-1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6121 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6122 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6123 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6124 /* Allow * wildcard */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6125 while (ASCII_ISALNUM(*p) || *p == '_' || *p == '*')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6126 p++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6127 if (*p == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6128 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6129 nextchar = *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6130 *p = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6131 opt_idx = findoption(arg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6132 *p = nextchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6133 if (opt_idx == -1 || options[opt_idx].var == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6134 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6135 xp->xp_context = EXPAND_NOTHING;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6136 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6137 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6138 flags = options[opt_idx].flags;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6139 if (flags & P_BOOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6140 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6141 xp->xp_context = EXPAND_NOTHING;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6142 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6143 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6144 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6145 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6146 /* handle "-=" and "+=" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6147 if ((nextchar == '-' || nextchar == '+' || nextchar == '^') && p[1] == '=')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6148 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6149 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6150 nextchar = '=';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6151 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6152 if ((nextchar != '=' && nextchar != ':')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6153 || xp->xp_context == EXPAND_BOOL_SETTINGS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6154 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6155 xp->xp_context = EXPAND_UNSUCCESSFUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6156 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6157 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6158 if (xp->xp_context != EXPAND_BOOL_SETTINGS && p[1] == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6159 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6160 xp->xp_context = EXPAND_OLD_SETTING;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6161 if (is_term_option)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6162 expand_option_idx = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6163 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6164 expand_option_idx = opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6165 xp->xp_pattern = p + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6166 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6167 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6168 xp->xp_context = EXPAND_NOTHING;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6169 if (is_term_option || (flags & P_NUM))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6170 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6172 xp->xp_pattern = p + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6174 if (flags & P_EXPAND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6175 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6176 p = options[opt_idx].var;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6177 if (p == (char_u *)&p_bdir
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6178 || p == (char_u *)&p_dir
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6179 || p == (char_u *)&p_path
8182
95d59081580f commit https://github.com/vim/vim/commit/f6fee0e2d4341c0c2f5339c1268e5877fafd07cf
Christian Brabandt <cb@256bit.org>
parents: 8163
diff changeset
6180 || p == (char_u *)&p_pp
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6181 || p == (char_u *)&p_rtp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6182 #ifdef FEAT_SEARCHPATH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6183 || p == (char_u *)&p_cdpath
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6184 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6185 #ifdef FEAT_SESSION
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6186 || p == (char_u *)&p_vdir
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6187 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6188 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6189 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6190 xp->xp_context = EXPAND_DIRECTORIES;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6191 if (p == (char_u *)&p_path
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6192 #ifdef FEAT_SEARCHPATH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6193 || p == (char_u *)&p_cdpath
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6194 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6195 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6196 xp->xp_backslash = XP_BS_THREE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6197 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6198 xp->xp_backslash = XP_BS_ONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6199 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6200 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6201 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6202 xp->xp_context = EXPAND_FILES;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6203 /* for 'tags' need three backslashes for a space */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6204 if (p == (char_u *)&p_tags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6205 xp->xp_backslash = XP_BS_THREE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6206 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6207 xp->xp_backslash = XP_BS_ONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6208 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6209 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6211 /* For an option that is a list of file names, find the start of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6212 * last file name. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6213 for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; --p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6214 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6215 /* count number of backslashes before ' ' or ',' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6216 if (*p == ' ' || *p == ',')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6217 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6218 s = p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6219 while (s > xp->xp_pattern && *(s - 1) == '\\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6220 --s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6221 if ((*p == ' ' && (xp->xp_backslash == XP_BS_THREE && (p - s) < 3))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6222 || (*p == ',' && (flags & P_COMMA) && ((p - s) & 1) == 0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6223 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6224 xp->xp_pattern = p + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6225 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6226 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6227 }
374
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6228
744
07f7b4a7755c updated for version 7.0222
vimboss
parents: 731
diff changeset
6229 #ifdef FEAT_SPELL
374
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6230 /* for 'spellsuggest' start at "file:" */
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6231 if (options[opt_idx].var == (char_u *)&p_sps
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6232 && STRNCMP(p, "file:", 5) == 0)
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6233 {
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6234 xp->xp_pattern = p + 5;
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6235 break;
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6236 }
575dacb554d8 updated for version 7.0096
vimboss
parents: 359
diff changeset
6237 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6238 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6240 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6241 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6243 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6244 ExpandSettings(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6245 expand_T *xp,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6246 regmatch_T *regmatch,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6247 int *num_file,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6248 char_u ***file)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6249 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6250 int num_normal = 0; /* Nr of matching non-term-code settings */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6251 int num_term = 0; /* Nr of matching terminal code settings */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6252 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6253 int match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6254 int count = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6255 char_u *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6256 int loop;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6257 int is_term_opt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6258 char_u name_buf[MAX_KEY_NAME_LEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6259 static char *(names[]) = {"all", "termcap"};
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6260 int ic = regmatch->rm_ic; /* remember the ignore-case flag */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6262 /* do this loop twice:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6263 * loop == 0: count the number of matching options
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6264 * loop == 1: copy the matching options into allocated memory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6265 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6266 for (loop = 0; loop <= 1; ++loop)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6267 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6268 regmatch->rm_ic = ic;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6269 if (xp->xp_context != EXPAND_BOOL_SETTINGS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6270 {
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1877
diff changeset
6271 for (match = 0; match < (int)(sizeof(names) / sizeof(char *));
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1877
diff changeset
6272 ++match)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6273 if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6274 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6275 if (loop == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6276 num_normal++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6277 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6278 (*file)[count++] = vim_strsave((char_u *)names[match]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6279 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6280 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6281 for (opt_idx = 0; (str = (char_u *)options[opt_idx].fullname) != NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6282 opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6283 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6284 if (options[opt_idx].var == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6285 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6286 if (xp->xp_context == EXPAND_BOOL_SETTINGS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6287 && !(options[opt_idx].flags & P_BOOL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6288 continue;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
6289 is_term_opt = istermoption_idx(opt_idx);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6290 if (is_term_opt && num_normal > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6291 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6292 match = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6293 if (vim_regexec(regmatch, str, (colnr_T)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6294 || (options[opt_idx].shortname != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6295 && vim_regexec(regmatch,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6296 (char_u *)options[opt_idx].shortname, (colnr_T)0)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6297 match = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6298 else if (is_term_opt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6299 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6300 name_buf[0] = '<';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6301 name_buf[1] = 't';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6302 name_buf[2] = '_';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6303 name_buf[3] = str[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6304 name_buf[4] = str[3];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6305 name_buf[5] = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6306 name_buf[6] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6307 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6308 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6309 match = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6310 str = name_buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6311 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6312 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6313 if (match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6314 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6315 if (loop == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6316 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6317 if (is_term_opt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6318 num_term++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6319 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6320 num_normal++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6321 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6322 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6323 (*file)[count++] = vim_strsave(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6324 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6325 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6326 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6327 * Check terminal key codes, these are not in the option table
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6328 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6329 if (xp->xp_context != EXPAND_BOOL_SETTINGS && num_normal == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6330 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6331 for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6332 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6333 if (!isprint(str[0]) || !isprint(str[1]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6334 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6336 name_buf[0] = 't';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6337 name_buf[1] = '_';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6338 name_buf[2] = str[0];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6339 name_buf[3] = str[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6340 name_buf[4] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6342 match = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6343 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6344 match = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6345 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6346 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6347 name_buf[0] = '<';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6348 name_buf[1] = 't';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6349 name_buf[2] = '_';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6350 name_buf[3] = str[0];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6351 name_buf[4] = str[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6352 name_buf[5] = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6353 name_buf[6] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6355 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6356 match = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6357 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6358 if (match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6359 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6360 if (loop == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6361 num_term++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6362 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6363 (*file)[count++] = vim_strsave(name_buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6364 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6365 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6366
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6367 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6368 * Check special key names.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6369 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6370 regmatch->rm_ic = TRUE; /* ignore case here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6371 for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6373 name_buf[0] = '<';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6374 STRCPY(name_buf + 1, str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6375 STRCAT(name_buf, ">");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6377 if (vim_regexec(regmatch, name_buf, (colnr_T)0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6378 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6379 if (loop == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6380 num_term++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6381 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6382 (*file)[count++] = vim_strsave(name_buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6383 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6384 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6385 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6386 if (loop == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6387 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6388 if (num_normal > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6389 *num_file = num_normal;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6390 else if (num_term > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6391 *num_file = num_term;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6392 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6393 return OK;
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
6394 *file = ALLOC_MULT(char_u *, *num_file);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6395 if (*file == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6396 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6397 *file = (char_u **)"";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6398 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6399 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6400 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6401 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6402 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6403 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6404
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6405 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6406 ExpandOldSetting(int *num_file, char_u ***file)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6407 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6408 char_u *var = NULL; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6409 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6410
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6411 *num_file = 0;
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
6412 *file = ALLOC_ONE(char_u *);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6413 if (*file == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6414 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6416 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6417 * For a terminal key code expand_option_idx is < 0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6418 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6419 if (expand_option_idx < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6420 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6421 var = find_termcode(expand_option_name + 2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6422 if (var == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6423 expand_option_idx = findoption(expand_option_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6424 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6426 if (expand_option_idx >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6427 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6428 /* put string of option value in NameBuff */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6429 option_value2string(&options[expand_option_idx], expand_option_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6430 var = NameBuff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6431 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6432 else if (var == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6433 var = (char_u *)"";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6434
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6435 /* A backslash is required before some characters. This is the reverse of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6436 * what happens in do_set(). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6437 buf = vim_strsave_escaped(var, escape_chars);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6438
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6439 if (buf == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6440 {
13244
ac42c4b11dbc patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents: 13242
diff changeset
6441 VIM_CLEAR(*file);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6442 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6443 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6444
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6445 #ifdef BACKSLASH_IN_FILENAME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6446 /* For MS-Windows et al. we don't double backslashes at the start and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6447 * before a file name character. */
11127
506f5d8b7d8b patch 8.0.0451: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents: 11121
diff changeset
6448 for (var = buf; *var != NUL; MB_PTR_ADV(var))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6449 if (var[0] == '\\' && var[1] == '\\'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6450 && expand_option_idx >= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6451 && (options[expand_option_idx].flags & P_EXPAND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6452 && vim_isfilec(var[2])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6453 && (var[2] != '\\' || (var == buf && var[4] != '\\')))
1622
149d8b46404c updated for version 7.2a
vimboss
parents: 1601
diff changeset
6454 STRMOVE(var, var + 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6455 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6457 *file[0] = buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6458 *num_file = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6459 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6460 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6462 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6463 * Get the value for the numeric or string option *opp in a nice format into
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6464 * NameBuff[]. Must not be called with a hidden option!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6465 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6466 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6467 option_value2string(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6468 struct vimoption *opp,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6469 int opt_flags) /* OPT_GLOBAL and/or OPT_LOCAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6470 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6471 char_u *varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6472
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6473 varp = get_varp_scope(opp, opt_flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6474
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6475 if (opp->flags & P_NUM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6476 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6477 long wc = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6478
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6479 if (wc_use_keyname(varp, &wc))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6480 STRCPY(NameBuff, get_special_key_name((int)wc, 0));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6481 else if (wc != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6482 STRCPY(NameBuff, transchar((int)wc));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6483 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6484 sprintf((char *)NameBuff, "%ld", *(long *)varp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6485 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6486 else /* P_STRING */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6487 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6488 varp = *(char_u **)(varp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6489 if (varp == NULL) /* just in case */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6490 NameBuff[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6491 #ifdef FEAT_CRYPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6492 /* don't show the actual value of 'key', only that it's set */
840
2c885fab04e3 updated for version 7.0e06
vimboss
parents: 839
diff changeset
6493 else if (opp->var == (char_u *)&p_key && *varp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6494 STRCPY(NameBuff, "*****");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6495 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6496 else if (opp->flags & P_EXPAND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6497 home_replace(NULL, varp, NameBuff, MAXPATHL, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6498 /* Translate 'pastetoggle' into special key names */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6499 else if ((char_u **)opp->var == &p_pt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6500 str2specialbuf(p_pt, NameBuff, MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6501 else
419
f713fc55bf7b updated for version 7.0109
vimboss
parents: 410
diff changeset
6502 vim_strncpy(NameBuff, varp, MAXPATHL - 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6503 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6504 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6505
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6506 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6507 * Return TRUE if "varp" points to 'wildchar' or 'wildcharm' and it can be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6508 * printed as a keyname.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6509 * "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6510 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6511 static int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6512 wc_use_keyname(char_u *varp, long *wcp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6513 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6514 if (((long *)varp == &p_wc) || ((long *)varp == &p_wcm))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6515 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6516 *wcp = *(long *)varp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6517 if (IS_SPECIAL(*wcp) || find_special_key_in_table((int)*wcp) >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6518 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6519 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6520 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6521 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6523 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6524 * Return TRUE if format option 'x' is in effect.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6525 * Take care of no formatting when 'paste' is set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6526 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6527 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6528 has_format_option(int x)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6529 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6530 if (p_paste)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6531 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6532 return (vim_strchr(curbuf->b_p_fo, x) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6533 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6534
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6535 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6536 * Return TRUE if "x" is present in 'shortmess' option, or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6537 * 'shortmess' contains 'a' and "x" is present in SHM_A.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6538 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6539 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6540 shortmess(int x)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6541 {
3384
da670fb71d30 updated for version 7.3.458
Bram Moolenaar <bram@vim.org>
parents: 3359
diff changeset
6542 return p_shm != NULL &&
da670fb71d30 updated for version 7.3.458
Bram Moolenaar <bram@vim.org>
parents: 3359
diff changeset
6543 ( vim_strchr(p_shm, x) != NULL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6544 || (vim_strchr(p_shm, 'a') != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6545 && vim_strchr((char_u *)SHM_A, x) != NULL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6546 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6547
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6548 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6549 * paste_option_changed() - Called after p_paste was set or reset.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6550 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6551 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6552 paste_option_changed(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6553 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6554 static int old_p_paste = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6555 static int save_sm = 0;
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6556 static int save_sta = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6557 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6558 static int save_ru = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6559 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6560 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6561 static int save_ri = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6562 static int save_hkmap = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6563 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6564 buf_T *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6565
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6566 if (p_paste)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6567 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6568 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6569 * Paste switched from off to on.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6570 * Save the current values, so they can be restored later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6571 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6572 if (!old_p_paste)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6573 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6574 /* save options for each buffer */
9649
fd9727ae3c49 commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents: 9536
diff changeset
6575 FOR_ALL_BUFFERS(buf)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6576 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6577 buf->b_p_tw_nopaste = buf->b_p_tw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6578 buf->b_p_wm_nopaste = buf->b_p_wm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6579 buf->b_p_sts_nopaste = buf->b_p_sts;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6580 buf->b_p_ai_nopaste = buf->b_p_ai;
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6581 buf->b_p_et_nopaste = buf->b_p_et;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6582 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6583 if (buf->b_p_vsts_nopaste)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6584 vim_free(buf->b_p_vsts_nopaste);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6585 buf->b_p_vsts_nopaste = buf->b_p_vsts && buf->b_p_vsts != empty_option
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6586 ? vim_strsave(buf->b_p_vsts) : NULL;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6587 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6588 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6589
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6590 /* save global options */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6591 save_sm = p_sm;
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6592 save_sta = p_sta;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6593 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6594 save_ru = p_ru;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6595 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6596 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6597 save_ri = p_ri;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6598 save_hkmap = p_hkmap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6599 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6600 /* save global values for local buffer options */
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6601 p_ai_nopaste = p_ai;
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6602 p_et_nopaste = p_et;
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6603 p_sts_nopaste = p_sts;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6604 p_tw_nopaste = p_tw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6605 p_wm_nopaste = p_wm;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6606 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6607 if (p_vsts_nopaste)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6608 vim_free(p_vsts_nopaste);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6609 p_vsts_nopaste = p_vsts && p_vsts != empty_option ? vim_strsave(p_vsts) : NULL;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6610 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6611 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6612
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6613 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6614 * Always set the option values, also when 'paste' is set when it is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6615 * already on.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6616 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6617 /* set options for each buffer */
9649
fd9727ae3c49 commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents: 9536
diff changeset
6618 FOR_ALL_BUFFERS(buf)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6619 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6620 buf->b_p_tw = 0; /* textwidth is 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6621 buf->b_p_wm = 0; /* wrapmargin is 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6622 buf->b_p_sts = 0; /* softtabstop is 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6623 buf->b_p_ai = 0; /* no auto-indent */
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6624 buf->b_p_et = 0; /* no expandtab */
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6625 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6626 if (buf->b_p_vsts)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6627 free_string_option(buf->b_p_vsts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6628 buf->b_p_vsts = empty_option;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6629 if (buf->b_p_vsts_array)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6630 vim_free(buf->b_p_vsts_array);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6631 buf->b_p_vsts_array = 0;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6632 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6633 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6634
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6635 /* set global options */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6636 p_sm = 0; /* no showmatch */
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6637 p_sta = 0; /* no smarttab */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6638 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6639 if (p_ru)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6640 status_redraw_all(); /* redraw to remove the ruler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6641 p_ru = 0; /* no ruler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6642 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6643 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6644 p_ri = 0; /* no reverse insert */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6645 p_hkmap = 0; /* no Hebrew keyboard */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6646 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6647 /* set global values for local buffer options */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6648 p_tw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6649 p_wm = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6650 p_sts = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6651 p_ai = 0;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6652 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6653 if (p_vsts)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6654 free_string_option(p_vsts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6655 p_vsts = empty_option;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6656 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6657 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6658
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6659 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6660 * Paste switched from on to off: Restore saved values.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6661 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6662 else if (old_p_paste)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6663 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6664 /* restore options for each buffer */
9649
fd9727ae3c49 commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents: 9536
diff changeset
6665 FOR_ALL_BUFFERS(buf)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6666 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6667 buf->b_p_tw = buf->b_p_tw_nopaste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6668 buf->b_p_wm = buf->b_p_wm_nopaste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6669 buf->b_p_sts = buf->b_p_sts_nopaste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6670 buf->b_p_ai = buf->b_p_ai_nopaste;
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6671 buf->b_p_et = buf->b_p_et_nopaste;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6672 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6673 if (buf->b_p_vsts)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6674 free_string_option(buf->b_p_vsts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6675 buf->b_p_vsts = buf->b_p_vsts_nopaste
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6676 ? vim_strsave(buf->b_p_vsts_nopaste) : empty_option;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6677 if (buf->b_p_vsts_array)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6678 vim_free(buf->b_p_vsts_array);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6679 if (buf->b_p_vsts && buf->b_p_vsts != empty_option)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6680 tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6681 else
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6682 buf->b_p_vsts_array = 0;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6683 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6684 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6685
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6686 /* restore global options */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6687 p_sm = save_sm;
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6688 p_sta = save_sta;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6689 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6690 if (p_ru != save_ru)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6691 status_redraw_all(); /* redraw to draw the ruler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6692 p_ru = save_ru;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6693 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6694 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6695 p_ri = save_ri;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6696 p_hkmap = save_hkmap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6697 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6698 /* set global values for local buffer options */
7113
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6699 p_ai = p_ai_nopaste;
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6700 p_et = p_et_nopaste;
83b3261352b3 commit https://github.com/vim/vim/commit/54f018cd5994c3ffcd0740526e56db6934edf1f2
Christian Brabandt <cb@256bit.org>
parents: 7058
diff changeset
6701 p_sts = p_sts_nopaste;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6702 p_tw = p_tw_nopaste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6703 p_wm = p_wm_nopaste;
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6704 #ifdef FEAT_VARTABS
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6705 if (p_vsts)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6706 free_string_option(p_vsts);
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6707 p_vsts = p_vsts_nopaste ? vim_strsave(p_vsts_nopaste) : empty_option;
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents: 14099
diff changeset
6708 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6709 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6710
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6711 old_p_paste = p_paste;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6712 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6714 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6715 * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6716 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6717 * Reset 'compatible' and set the values for options that didn't get set yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6718 * to the Vim defaults.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6719 * Don't do this if the 'compatible' option has been set or reset before.
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6720 * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6721 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6722 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6723 vimrc_found(char_u *fname, char_u *envname)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6724 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6725 int opt_idx;
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 825
diff changeset
6726 int dofree = FALSE;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6727 char_u *p;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6729 if (!option_was_set((char_u *)"cp"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6730 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6731 p_cp = FALSE;
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
6732 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6733 if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6734 set_option_default(opt_idx, OPT_FREE, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6735 didset_options();
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
6736 didset_options2();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6737 }
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6738
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6739 if (fname != NULL)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6740 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6741 p = vim_getenv(envname, &dofree);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6742 if (p == NULL)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6743 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6744 /* Set $MYVIMRC to the first vimrc file found. */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6745 p = FullName_save(fname, FALSE);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6746 if (p != NULL)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6747 {
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6748 vim_setenv(envname, p);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6749 vim_free(p);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6750 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6751 }
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6752 else if (dofree)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6753 vim_free(p);
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
6754 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6755 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6756
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6757 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6758 * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6759 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6760 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6761 change_compatible(int on)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6762 {
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
6763 int opt_idx;
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
6764
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6765 if (p_cp != on)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6766 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6767 p_cp = on;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6768 compatible_set();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6769 }
838
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
6770 opt_idx = findoption((char_u *)"cp");
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
6771 if (opt_idx >= 0)
8e5830943bff updated for version 7.0e04
vimboss
parents: 836
diff changeset
6772 options[opt_idx].flags |= P_WAS_SET;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6773 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6775 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6776 * Return TRUE when option "name" has been set.
5245
8c6615a30951 updated for version 7.4a.047
Bram Moolenaar <bram@vim.org>
parents: 5157
diff changeset
6777 * Only works correctly for global options.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6778 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6779 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6780 option_was_set(char_u *name)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6781 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6782 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6783
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6784 idx = findoption(name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6785 if (idx < 0) /* unknown option */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6786 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6787 if (options[idx].flags & P_WAS_SET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6788 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6789 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6790 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6791
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6792 /*
3980
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6793 * Reset the flag indicating option "name" was set.
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6794 */
14748
00da090af0ab patch 8.1.0386: cannot test with non-default option value
Christian Brabandt <cb@256bit.org>
parents: 14702
diff changeset
6795 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6796 reset_option_was_set(char_u *name)
3980
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6797 {
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6798 int idx = findoption(name);
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6799
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6800 if (idx >= 0)
14748
00da090af0ab patch 8.1.0386: cannot test with non-default option value
Christian Brabandt <cb@256bit.org>
parents: 14702
diff changeset
6801 {
3980
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6802 options[idx].flags &= ~P_WAS_SET;
14748
00da090af0ab patch 8.1.0386: cannot test with non-default option value
Christian Brabandt <cb@256bit.org>
parents: 14702
diff changeset
6803 return OK;
00da090af0ab patch 8.1.0386: cannot test with non-default option value
Christian Brabandt <cb@256bit.org>
parents: 14702
diff changeset
6804 }
00da090af0ab patch 8.1.0386: cannot test with non-default option value
Christian Brabandt <cb@256bit.org>
parents: 14702
diff changeset
6805 return FAIL;
3980
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6806 }
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6807
aab4b29520e7 updated for version 7.3.745
Bram Moolenaar <bram@vim.org>
parents: 3894
diff changeset
6808 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6809 * compatible_set() - Called when 'compatible' has been set or unset.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6810 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6811 * When 'compatible' set: Set all relevant options (those that have the P_VIM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6812 * flag) to a Vi compatible value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6813 * When 'compatible' is unset: Set all options that have a different default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6814 * for Vim (without the P_VI_DEF flag) to that default.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6815 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6816 static void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6817 compatible_set(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6818 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6819 int opt_idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6820
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
6821 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6822 if ( ((options[opt_idx].flags & P_VIM) && p_cp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6823 || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6824 set_option_default(opt_idx, OPT_FREE, p_cp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6825 didset_options();
7040
17a3fa77e941 commit https://github.com/vim/vim/commit/e68c25c677167bb90ac5ec77038e340c730b6567
Christian Brabandt <cb@256bit.org>
parents: 7034
diff changeset
6826 didset_options2();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6827 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6828
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
6829 #if defined(FEAT_LINEBREAK) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6830
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6831 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6832 * fill_breakat_flags() -- called when 'breakat' changes value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6833 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
6834 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6835 fill_breakat_flags(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6836 {
500
4772a5e3f9fa updated for version 7.0138
vimboss
parents: 484
diff changeset
6837 char_u *p;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6838 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6839
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6840 for (i = 0; i < 256; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6841 breakat_flags[i] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6843 if (p_breakat != NULL)
500
4772a5e3f9fa updated for version 7.0138
vimboss
parents: 484
diff changeset
6844 for (p = p_breakat; *p; p++)
4772a5e3f9fa updated for version 7.0138
vimboss
parents: 484
diff changeset
6845 breakat_flags[*p] = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6846 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6847 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6848
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6849 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6850 * Read the 'wildmode' option, fill wim_flags[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6851 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
6852 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6853 check_opt_wim(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6854 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6855 char_u new_wim_flags[4];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6856 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6857 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6858 int idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6859
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6860 for (i = 0; i < 4; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6861 new_wim_flags[i] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6862
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6863 for (p = p_wim; *p; ++p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6864 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6865 for (i = 0; ASCII_ISALPHA(p[i]); ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6866 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6867 if (p[i] != NUL && p[i] != ',' && p[i] != ':')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6868 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6869 if (i == 7 && STRNCMP(p, "longest", 7) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6870 new_wim_flags[idx] |= WIM_LONGEST;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6871 else if (i == 4 && STRNCMP(p, "full", 4) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6872 new_wim_flags[idx] |= WIM_FULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6873 else if (i == 4 && STRNCMP(p, "list", 4) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6874 new_wim_flags[idx] |= WIM_LIST;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6875 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6876 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6877 p += i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6878 if (*p == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6879 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6880 if (*p == ',')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6881 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6882 if (idx == 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6883 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6884 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6885 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6886 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6887
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6888 /* fill remaining entries with last flag */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6889 while (idx < 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6890 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6891 new_wim_flags[idx + 1] = new_wim_flags[idx];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6892 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6893 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6894
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6895 /* only when there are no errors, wim_flags[] is changed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6896 for (i = 0; i < 4; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6897 wim_flags[i] = new_wim_flags[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6898 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6899 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6900
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6901 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6902 * Check if backspacing over something is allowed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6903 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6904 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6905 can_bs(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6906 int what) /* BS_INDENT, BS_EOL or BS_START */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6907 {
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
6908 #ifdef FEAT_JOB_CHANNEL
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
6909 if (what == BS_START && bt_prompt(curbuf))
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
6910 return FALSE;
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
6911 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6912 switch (*p_bs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6913 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6914 case '2': return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6915 case '1': return (what != BS_START);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6916 case '0': return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6917 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6918 return vim_strchr(p_bs, what) != NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6919 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6920
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6921 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6922 * Save the current values of 'fileformat' and 'fileencoding', so that we know
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6923 * the file must be considered changed when the value is different.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6924 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6925 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6926 save_file_ff(buf_T *buf)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6927 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6928 buf->b_start_ffc = *buf->b_p_ff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6929 buf->b_start_eol = buf->b_p_eol;
1352
c544a3507e83 updated for version 7.1-066
vimboss
parents: 1323
diff changeset
6930 buf->b_start_bomb = buf->b_p_bomb;
c544a3507e83 updated for version 7.1-066
vimboss
parents: 1323
diff changeset
6931
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6932 /* Only use free/alloc when necessary, they take time. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6933 if (buf->b_start_fenc == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6934 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6935 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6936 vim_free(buf->b_start_fenc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6937 buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6938 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6939 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6940
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6941 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6942 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6943 * from when editing started (save_file_ff() called).
1352
c544a3507e83 updated for version 7.1-066
vimboss
parents: 1323
diff changeset
6944 * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
c544a3507e83 updated for version 7.1-066
vimboss
parents: 1323
diff changeset
6945 * changed and 'binary' is not set.
6933
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
6946 * Also when 'endofline' was changed and 'fixeol' is not set.
2685
862d920800b1 updated for version 7.3.103
Bram Moolenaar <bram@vim.org>
parents: 2654
diff changeset
6947 * When "ignore_empty" is true don't consider a new, empty buffer to be
862d920800b1 updated for version 7.3.103
Bram Moolenaar <bram@vim.org>
parents: 2654
diff changeset
6948 * changed.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6949 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6950 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6951 file_ff_differs(buf_T *buf, int ignore_empty)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6952 {
1319
76c2b2dd25c9 updated for version 7.1-033
vimboss
parents: 1298
diff changeset
6953 /* In a buffer that was never loaded the options are not valid. */
76c2b2dd25c9 updated for version 7.1-033
vimboss
parents: 1298
diff changeset
6954 if (buf->b_flags & BF_NEVERLOADED)
76c2b2dd25c9 updated for version 7.1-033
vimboss
parents: 1298
diff changeset
6955 return FALSE;
2685
862d920800b1 updated for version 7.3.103
Bram Moolenaar <bram@vim.org>
parents: 2654
diff changeset
6956 if (ignore_empty
862d920800b1 updated for version 7.3.103
Bram Moolenaar <bram@vim.org>
parents: 2654
diff changeset
6957 && (buf->b_flags & BF_NEW)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6958 && buf->b_ml.ml_line_count == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6959 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6960 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6961 if (buf->b_start_ffc != *buf->b_p_ff)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6962 return TRUE;
6933
62ba356c2d4e patch 7.4.785
Bram Moolenaar <bram@vim.org>
parents: 6927
diff changeset
6963 if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6964 return TRUE;
1352
c544a3507e83 updated for version 7.1-066
vimboss
parents: 1323
diff changeset
6965 if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
c544a3507e83 updated for version 7.1-066
vimboss
parents: 1323
diff changeset
6966 return TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6967 if (buf->b_start_fenc == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6968 return (*buf->b_p_fenc != NUL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6969 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6970 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6971
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6972 /*
15713
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6973 * Return the effective 'scrolloff' value for the current window, using the
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6974 * global value when appropriate.
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6975 */
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6976 long
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6977 get_scrolloff_value(void)
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6978 {
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6979 return curwin->w_p_so < 0 ? p_so : curwin->w_p_so;
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6980 }
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6981
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6982 /*
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6983 * Return the effective 'sidescrolloff' value for the current window, using the
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6984 * global value when appropriate.
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6985 */
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6986 long
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6987 get_sidescrolloff_value(void)
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6988 {
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6989 return curwin->w_p_siso < 0 ? p_siso : curwin->w_p_siso;
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6990 }
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6991
ad8b2c109b22 patch 8.1.0864: cannot have a local value for 'scrolloff' and 'sidescrolloff'
Bram Moolenaar <Bram@vim.org>
parents: 15701
diff changeset
6992 /*
4029
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
6993 * Check matchpairs option for "*initc".
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
6994 * If there is a match set "*initc" to the matching character and "*findc" to
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
6995 * the opposite character. Set "*backwards" to the direction.
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
6996 * When "switchit" is TRUE swap the direction.
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
6997 */
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
6998 void
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
6999 find_mps_values(
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
7000 int *initc,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
7001 int *findc,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
7002 int *backwards,
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
7003 int switchit)
4029
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7004 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7005 char_u *ptr;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7006
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7007 ptr = curbuf->b_p_mps;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7008 while (*ptr != NUL)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7009 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7010 if (has_mbyte)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7011 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7012 char_u *prev;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7013
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7014 if (mb_ptr2char(ptr) == *initc)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7015 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7016 if (switchit)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7017 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7018 *findc = *initc;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7019 *initc = mb_ptr2char(ptr + mb_ptr2len(ptr) + 1);
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7020 *backwards = TRUE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7021 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7022 else
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7023 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7024 *findc = mb_ptr2char(ptr + mb_ptr2len(ptr) + 1);
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7025 *backwards = FALSE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7026 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7027 return;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7028 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7029 prev = ptr;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7030 ptr += mb_ptr2len(ptr) + 1;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7031 if (mb_ptr2char(ptr) == *initc)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7032 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7033 if (switchit)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7034 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7035 *findc = *initc;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7036 *initc = mb_ptr2char(prev);
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7037 *backwards = FALSE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7038 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7039 else
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7040 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7041 *findc = mb_ptr2char(prev);
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7042 *backwards = TRUE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7043 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7044 return;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7045 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7046 ptr += mb_ptr2len(ptr);
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7047 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7048 else
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7049 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7050 if (*ptr == *initc)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7051 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7052 if (switchit)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7053 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7054 *backwards = TRUE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7055 *findc = *initc;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7056 *initc = ptr[2];
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7057 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7058 else
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7059 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7060 *backwards = FALSE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7061 *findc = ptr[2];
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7062 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7063 return;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7064 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7065 ptr += 2;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7066 if (*ptr == *initc)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7067 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7068 if (switchit)
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7069 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7070 *backwards = FALSE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7071 *findc = *initc;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7072 *initc = ptr[-2];
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7073 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7074 else
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7075 {
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7076 *backwards = TRUE;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7077 *findc = ptr[-2];
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7078 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7079 return;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7080 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7081 ++ptr;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7082 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7083 if (*ptr == ',')
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7084 ++ptr;
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7085 }
d179a8eff9d7 updated for version 7.3.769
Bram Moolenaar <bram@vim.org>
parents: 3980
diff changeset
7086 }
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7087
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7088 #if defined(FEAT_LINEBREAK) || defined(PROTO)
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7089 /*
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7090 * This is called when 'breakindentopt' is changed and when a window is
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7091 * initialized.
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7092 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
7093 int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
7094 briopt_check(win_T *wp)
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7095 {
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7096 char_u *p;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7097 int bri_shift = 0;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7098 long bri_min = 20;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7099 int bri_sbr = FALSE;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7100
6162
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
7101 p = wp->w_p_briopt;
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7102 while (*p != NUL)
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7103 {
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7104 if (STRNCMP(p, "shift:", 6) == 0
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7105 && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7106 {
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7107 p += 6;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7108 bri_shift = getdigits(&p);
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7109 }
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7110 else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7111 {
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7112 p += 4;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7113 bri_min = getdigits(&p);
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7114 }
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7115 else if (STRNCMP(p, "sbr", 3) == 0)
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7116 {
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7117 p += 3;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7118 bri_sbr = TRUE;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7119 }
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7120 if (*p != ',' && *p != NUL)
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7121 return FAIL;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7122 if (*p == ',')
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7123 ++p;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7124 }
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7125
6162
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
7126 wp->w_p_brishift = bri_shift;
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
7127 wp->w_p_brimin = bri_min;
e60327caf909 updated for version 7.4.417
Bram Moolenaar <bram@vim.org>
parents: 6130
diff changeset
7128 wp->w_p_brisbr = bri_sbr;
5995
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7129
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7130 return OK;
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7131 }
ef83b423ebf7 updated for version 7.4.338
Bram Moolenaar <bram@vim.org>
parents: 5991
diff changeset
7132 #endif
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7133
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7134 /*
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7135 * Get the local or global value of 'backupcopy'.
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7136 */
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7137 unsigned int
7829
2a8d6b2dd925 commit https://github.com/vim/vim/commit/9b57814db13c29ecb08260b36923c0e1c8a373a9
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
7138 get_bkc_value(buf_T *buf)
6243
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7139 {
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7140 return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
54194bd6ed60 updated for version 7.4.456
Bram Moolenaar <bram@vim.org>
parents: 6205
diff changeset
7141 }
9852
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7142
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7143 #if defined(FEAT_SIGNS) || defined(PROTO)
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7144 /*
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7145 * Return TRUE when window "wp" has a column to draw signs in.
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7146 */
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7147 int
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7148 signcolumn_on(win_T *wp)
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7149 {
17129
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17115
diff changeset
7150 // If 'signcolumn' is set to 'number', signs are displayed in the 'number'
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17115
diff changeset
7151 // column (if present). Otherwise signs are to be displayed in the sign
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17115
diff changeset
7152 // column.
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17115
diff changeset
7153 if (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17115
diff changeset
7154 return wp->w_buffer->b_signlist != NULL && !wp->w_p_nu && !wp->w_p_rnu;
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17115
diff changeset
7155
9852
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7156 if (*wp->w_p_scl == 'n')
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7157 return FALSE;
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7158 if (*wp->w_p_scl == 'y')
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7159 return TRUE;
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7160 return (wp->w_buffer->b_signlist != NULL
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7161 # ifdef FEAT_NETBEANS_INTG
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7162 || wp->w_buffer->b_has_sign_column
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7163 # endif
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7164 );
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7165 }
4eea48b76d03 commit https://github.com/vim/vim/commit/95ec9d6a6ab3117d60ff638670a803d43974ba51
Christian Brabandt <cb@256bit.org>
parents: 9798
diff changeset
7166 #endif
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7167
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7168 #if defined(FEAT_EVAL) || defined(PROTO)
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7169 /*
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7170 * Get window or buffer local options.
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7171 */
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7172 dict_T *
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7173 get_winbuf_options(int bufopt)
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7174 {
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7175 dict_T *d;
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7176 int opt_idx;
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7177
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7178 d = dict_alloc();
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7179 if (d == NULL)
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7180 return NULL;
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7181
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
7182 for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++)
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7183 {
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7184 struct vimoption *opt = &options[opt_idx];
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7185
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7186 if ((bufopt && (opt->indir & PV_BUF))
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7187 || (!bufopt && (opt->indir & PV_WIN)))
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7188 {
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7189 char_u *varp = get_varp(opt);
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7190
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7191 if (varp != NULL)
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7192 {
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7193 if (opt->flags & P_STRING)
14301
3c80092eb211 patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents: 14243
diff changeset
7194 dict_add_string(d, opt->fullname, *(char_u **)varp);
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10070
diff changeset
7195 else if (opt->flags & P_NUM)
14301
3c80092eb211 patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents: 14243
diff changeset
7196 dict_add_number(d, opt->fullname, *(long *)varp);
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7197 else
14301
3c80092eb211 patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents: 14243
diff changeset
7198 dict_add_number(d, opt->fullname, *(int *)varp);
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7199 }
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7200 }
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7201 }
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7202
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7203 return d;
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7204 }
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents: 9854
diff changeset
7205 #endif
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7206
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
7207 #if defined(FEAT_SYN_HL) || defined(PROTO)
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7208 /*
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7209 * This is called when 'culopt' is changed
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7210 */
18100
df5778d73320 patch 8.1.2045: the option.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 18068
diff changeset
7211 int
18068
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7212 fill_culopt_flags(char_u *val, win_T *wp)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7213 {
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7214 char_u *p;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7215 char_u culopt_flags_new = 0;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7216
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7217 if (val == NULL)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7218 p = wp->w_p_culopt;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7219 else
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7220 p = val;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7221 while (*p != NUL)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7222 {
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7223 if (STRNCMP(p, "line", 4) == 0)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7224 {
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7225 p += 4;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7226 culopt_flags_new |= CULOPT_LINE;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7227 }
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7228 else if (STRNCMP(p, "both", 4) == 0)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7229 {
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7230 p += 4;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7231 culopt_flags_new |= CULOPT_LINE | CULOPT_NBR;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7232 }
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7233 else if (STRNCMP(p, "number", 6) == 0)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7234 {
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7235 p += 6;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7236 culopt_flags_new |= CULOPT_NBR;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7237 }
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7238 else if (STRNCMP(p, "screenline", 10) == 0)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7239 {
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7240 p += 10;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7241 culopt_flags_new |= CULOPT_SCRLINE;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7242 }
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7243
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7244 if (*p != ',' && *p != NUL)
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7245 return FAIL;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7246 if (*p == ',')
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7247 ++p;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7248 }
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7249
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7250 // Can't have both "line" and "screenline".
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7251 if ((culopt_flags_new & CULOPT_LINE) && (culopt_flags_new & CULOPT_SCRLINE))
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7252 return FAIL;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7253 wp->w_p_culopt_flags = culopt_flags_new;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7254
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7255 return OK;
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7256 }
1101eacc1444 patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents: 18054
diff changeset
7257 #endif