comparison src/optionstr.c @ 31996:ca6bc7c04163 v9.0.1330

patch 9.0.1330: handling new value of an option has a long "else if" chain Commit: https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Feb 20 12:16:39 2023 +0000 patch 9.0.1330: handling new value of an option has a long "else if" chain Problem: Handling new value of an option has a long "else if" chain. Solution: Use a function pointer. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/12015)
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Feb 2023 13:30:05 +0100
parents 4efcb5c68112
children 4545f58c8490
comparison
equal deleted inserted replaced
31995:95971aa5e525 31996:ca6bc7c04163
539 saved_oldval_g = vim_strsave(oldval_g); 539 saved_oldval_g = vim_strsave(oldval_g);
540 saved_oldval = vim_strsave(oldval); 540 saved_oldval = vim_strsave(oldval);
541 saved_newval = vim_strsave(s); 541 saved_newval = vim_strsave(s);
542 } 542 }
543 #endif 543 #endif
544 if ((errmsg = did_set_string_option(opt_idx, varp, oldval, errbuf, 544 if ((errmsg = did_set_string_option(opt_idx, varp, oldval, value, errbuf,
545 opt_flags, &value_checked)) == NULL) 545 opt_flags, &value_checked)) == NULL)
546 did_set_option(opt_idx, opt_flags, TRUE, value_checked); 546 did_set_option(opt_idx, opt_flags, TRUE, value_checked);
547 547
548 #if defined(FEAT_EVAL) 548 #if defined(FEAT_EVAL)
549 // call autocommand after handling side effects 549 // call autocommand after handling side effects
689 } 689 }
690 690
691 /* 691 /*
692 * The 'backupcopy' option is changed. 692 * The 'backupcopy' option is changed.
693 */ 693 */
694 static char * 694 char *
695 did_set_backupcopy( 695 did_set_backupcopy(optset_T *args)
696 char_u *oldval,
697 int opt_flags)
698 { 696 {
699 char_u *bkc = p_bkc; 697 char_u *bkc = p_bkc;
700 unsigned int *flags = &bkc_flags; 698 unsigned int *flags = &bkc_flags;
701 char *errmsg = NULL; 699 char *errmsg = NULL;
702 700
703 if (opt_flags & OPT_LOCAL) 701 if (args->os_flags & OPT_LOCAL)
704 { 702 {
705 bkc = curbuf->b_p_bkc; 703 bkc = curbuf->b_p_bkc;
706 flags = &curbuf->b_bkc_flags; 704 flags = &curbuf->b_bkc_flags;
707 } 705 }
708 706
709 if ((opt_flags & OPT_LOCAL) && *bkc == NUL) 707 if ((args->os_flags & OPT_LOCAL) && *bkc == NUL)
710 // make the local value empty: use the global value 708 // make the local value empty: use the global value
711 *flags = 0; 709 *flags = 0;
712 else 710 else
713 { 711 {
714 if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK) 712 if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK)
716 if ((((int)*flags & BKC_AUTO) != 0) 714 if ((((int)*flags & BKC_AUTO) != 0)
717 + (((int)*flags & BKC_YES) != 0) 715 + (((int)*flags & BKC_YES) != 0)
718 + (((int)*flags & BKC_NO) != 0) != 1) 716 + (((int)*flags & BKC_NO) != 0) != 1)
719 { 717 {
720 // Must have exactly one of "auto", "yes" and "no". 718 // Must have exactly one of "auto", "yes" and "no".
721 (void)opt_strings_flags(oldval, p_bkc_values, flags, TRUE); 719 (void)opt_strings_flags(args->os_oldval.string, p_bkc_values,
720 flags, TRUE);
722 errmsg = e_invalid_argument; 721 errmsg = e_invalid_argument;
723 } 722 }
724 } 723 }
725 724
726 return errmsg; 725 return errmsg;
727 } 726 }
728 727
729 /* 728 /*
730 * The 'backupext' or the 'patchmode' option is changed. 729 * The 'backupext' or the 'patchmode' option is changed.
731 */ 730 */
732 static char * 731 char *
733 did_set_backupext_or_patchmode(void) 732 did_set_backupext_or_patchmode(optset_T *args UNUSED)
734 { 733 {
735 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex, 734 if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
736 *p_pm == '.' ? p_pm + 1 : p_pm) == 0) 735 *p_pm == '.' ? p_pm + 1 : p_pm) == 0)
737 return e_backupext_and_patchmode_are_equal; 736 return e_backupext_and_patchmode_are_equal;
738 737
739 return NULL; 738 return NULL;
740 } 739 }
741 740
742 #ifdef FEAT_LINEBREAK 741 #if defined(FEAT_LINEBREAK) || defined(PROTO)
743 /* 742 /*
744 * The 'breakindentopt' option is changed. 743 * The 'breakindentopt' option is changed.
745 */ 744 */
746 static char * 745 char *
747 did_set_breakindentopt(void) 746 did_set_breakindentopt(optset_T *args UNUSED)
748 { 747 {
749 char *errmsg = NULL; 748 char *errmsg = NULL;
750 749
751 if (briopt_check(curwin) == FAIL) 750 if (briopt_check(curwin) == FAIL)
752 errmsg = e_invalid_argument; 751 errmsg = e_invalid_argument;
778 } 777 }
779 778
780 /* 779 /*
781 * The 'helpfile' option is changed. 780 * The 'helpfile' option is changed.
782 */ 781 */
783 static void 782 char *
784 did_set_helpfile(void) 783 did_set_helpfile(optset_T *args UNUSED)
785 { 784 {
786 // May compute new values for $VIM and $VIMRUNTIME 785 // May compute new values for $VIM and $VIMRUNTIME
787 if (didset_vim) 786 if (didset_vim)
788 vim_unsetenv_ext((char_u *)"VIM"); 787 vim_unsetenv_ext((char_u *)"VIM");
789 if (didset_vimruntime) 788 if (didset_vimruntime)
790 vim_unsetenv_ext((char_u *)"VIMRUNTIME"); 789 vim_unsetenv_ext((char_u *)"VIMRUNTIME");
790 return NULL;
791 } 791 }
792 792
793 #ifdef FEAT_SYN_HL 793 #ifdef FEAT_SYN_HL
794 /* 794 /*
795 * The 'cursorlineopt' option is changed. 795 * The 'cursorlineopt' option is changed.
802 802
803 return NULL; 803 return NULL;
804 } 804 }
805 #endif 805 #endif
806 806
807 #ifdef FEAT_MULTI_LANG 807 #if defined(FEAT_MULTI_LANG) || defined(PROTO)
808 /* 808 /*
809 * The 'helplang' option is changed. 809 * The 'helplang' option is changed.
810 */ 810 */
811 static char * 811 char *
812 did_set_helplang(void) 812 did_set_helplang(optset_T *args UNUSED)
813 { 813 {
814 char *errmsg = NULL; 814 char *errmsg = NULL;
815 815
816 // Check for "", "ab", "ab,cd", etc. 816 // Check for "", "ab", "ab,cd", etc.
817 for (char_u *s = p_hlg; *s != NUL; s += 3) 817 for (char_u *s = p_hlg; *s != NUL; s += 3)
830 #endif 830 #endif
831 831
832 /* 832 /*
833 * The 'highlight' option is changed. 833 * The 'highlight' option is changed.
834 */ 834 */
835 static char * 835 char *
836 did_set_highlight(void) 836 did_set_highlight(optset_T *args UNUSED)
837 { 837 {
838 if (highlight_changed() == FAIL) 838 if (highlight_changed() == FAIL)
839 return e_invalid_argument; // invalid flags 839 return e_invalid_argument; // invalid flags
840 840
841 return NULL; 841 return NULL;
866 866
867 #ifdef FEAT_SESSION 867 #ifdef FEAT_SESSION
868 /* 868 /*
869 * The 'sessionoptions' option is changed. 869 * The 'sessionoptions' option is changed.
870 */ 870 */
871 static char * 871 char *
872 did_set_sessionoptions(char_u *oldval) 872 did_set_sessionoptions(optset_T *args)
873 { 873 {
874 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK) 874 if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
875 return e_invalid_argument; 875 return e_invalid_argument;
876 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) 876 if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR))
877 { 877 {
878 // Don't allow both "sesdir" and "curdir". 878 // Don't allow both "sesdir" and "curdir".
879 (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, TRUE); 879 (void)opt_strings_flags(args->os_oldval.string, p_ssop_values,
880 &ssop_flags, TRUE);
880 return e_invalid_argument; 881 return e_invalid_argument;
881 } 882 }
882 883
883 return NULL; 884 return NULL;
884 } 885 }
885 #endif 886 #endif
886 887
887 /* 888 /*
888 * The 'ambiwidth' option is changed. 889 * The 'ambiwidth' option is changed.
889 */ 890 */
890 static char * 891 char *
891 did_set_ambiwidth(void) 892 did_set_ambiwidth(optset_T *args UNUSED)
892 { 893 {
893 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK) 894 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
894 return e_invalid_argument; 895 return e_invalid_argument;
895 896
896 return check_chars_options(); 897 return check_chars_options();
897 } 898 }
898 899
899 /* 900 /*
900 * The 'background' option is changed. 901 * The 'background' option is changed.
901 */ 902 */
902 static char * 903 char *
903 did_set_background(void) 904 did_set_background(optset_T *args UNUSED)
904 { 905 {
905 if (check_opt_strings(p_bg, p_bg_values, FALSE) == FAIL) 906 if (check_opt_strings(p_bg, p_bg_values, FALSE) == FAIL)
906 return e_invalid_argument; 907 return e_invalid_argument;
907 908
908 #ifdef FEAT_EVAL 909 #ifdef FEAT_EVAL
933 } 934 }
934 935
935 /* 936 /*
936 * The 'wildmode' option is changed. 937 * The 'wildmode' option is changed.
937 */ 938 */
938 static char * 939 char *
939 did_set_wildmode(void) 940 did_set_wildmode(optset_T *args UNUSED)
940 { 941 {
941 if (check_opt_wim() == FAIL) 942 if (check_opt_wim() == FAIL)
942 return e_invalid_argument; 943 return e_invalid_argument;
943 return NULL; 944 return NULL;
944 } 945 }
945 946
946 #ifdef FEAT_WAK 947 #if defined(FEAT_WAK) || defined(PROTO)
947 /* 948 /*
948 * The 'winaltkeys' option is changed. 949 * The 'winaltkeys' option is changed.
949 */ 950 */
950 static char * 951 char *
951 did_set_winaltkeys(void) 952 did_set_winaltkeys(optset_T *args UNUSED)
952 { 953 {
953 char *errmsg = NULL; 954 char *errmsg = NULL;
954 955
955 if (*p_wak == NUL 956 if (*p_wak == NUL
956 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK) 957 || check_opt_strings(p_wak, p_wak_values, FALSE) != OK)
969 #endif 970 #endif
970 971
971 /* 972 /*
972 * The 'eventignore' option is changed. 973 * The 'eventignore' option is changed.
973 */ 974 */
974 static char * 975 char *
975 did_set_eventignore(void) 976 did_set_eventignore(optset_T *args UNUSED)
976 { 977 {
977 if (check_ei() == FAIL) 978 if (check_ei() == FAIL)
978 return e_invalid_argument; 979 return e_invalid_argument;
979 return NULL; 980 return NULL;
980 } 981 }
1064 } 1065 }
1065 1066
1066 return errmsg; 1067 return errmsg;
1067 } 1068 }
1068 1069
1069 #if defined(FEAT_POSTSCRIPT) 1070 #if defined(FEAT_POSTSCRIPT) || defined(PROTO)
1070 /* 1071 /*
1071 * The 'printencoding' option is changed. 1072 * The 'printencoding' option is changed.
1072 */ 1073 */
1073 static void 1074 char *
1074 did_set_printencoding(void) 1075 did_set_printencoding(optset_T *args UNUSED)
1075 { 1076 {
1076 char_u *s, *p; 1077 char_u *s, *p;
1077 1078
1078 // Canonize 'printencoding' if VIM standard one 1079 // Canonize 'printencoding' if VIM standard one
1079 p = enc_canonize(p_penc); 1080 p = enc_canonize(p_penc);
1091 *s = '-'; 1092 *s = '-';
1092 else 1093 else
1093 *s = TOLOWER_ASC(*s); 1094 *s = TOLOWER_ASC(*s);
1094 } 1095 }
1095 } 1096 }
1096 } 1097
1097 #endif 1098 return NULL;
1098 1099 }
1099 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) 1100 #endif
1101
1102 #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(PROTO)
1100 /* 1103 /*
1101 * The 'imactivatekey' option is changed. 1104 * The 'imactivatekey' option is changed.
1102 */ 1105 */
1103 static char * 1106 char *
1104 did_set_imactivatekey(void) 1107 did_set_imactivatekey(optset_T *args UNUSED)
1105 { 1108 {
1106 if (!im_xim_isvalid_imactivate()) 1109 if (!im_xim_isvalid_imactivate())
1107 return e_invalid_argument; 1110 return e_invalid_argument;
1108 return NULL; 1111 return NULL;
1109 } 1112 }
1168 #endif 1171 #endif
1169 1172
1170 /* 1173 /*
1171 * The 'fileformat' option is changed. 1174 * The 'fileformat' option is changed.
1172 */ 1175 */
1173 static char * 1176 char *
1174 did_set_fileformat(char_u **varp, char_u *oldval, int opt_flags) 1177 did_set_fileformat(optset_T *args)
1175 { 1178 {
1176 if (!curbuf->b_p_ma && !(opt_flags & OPT_GLOBAL)) 1179 if (!curbuf->b_p_ma && !(args->os_flags & OPT_GLOBAL))
1177 return e_cannot_make_changes_modifiable_is_off; 1180 return e_cannot_make_changes_modifiable_is_off;
1178 else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK) 1181 else if (check_opt_strings(args->os_varp, p_ff_values, FALSE) != OK)
1179 return e_invalid_argument; 1182 return e_invalid_argument;
1180 1183
1181 // may also change 'textmode' 1184 // may also change 'textmode'
1182 if (get_fileformat(curbuf) == EOL_DOS) 1185 if (get_fileformat(curbuf) == EOL_DOS)
1183 curbuf->b_p_tx = TRUE; 1186 curbuf->b_p_tx = TRUE;
1186 redraw_titles(); 1189 redraw_titles();
1187 // update flag in swap file 1190 // update flag in swap file
1188 ml_setflags(curbuf); 1191 ml_setflags(curbuf);
1189 // Redraw needed when switching to/from "mac": a CR in the text 1192 // Redraw needed when switching to/from "mac": a CR in the text
1190 // will be displayed differently. 1193 // will be displayed differently.
1191 if (get_fileformat(curbuf) == EOL_MAC || *oldval == 'm') 1194 if (get_fileformat(curbuf) == EOL_MAC || *args->os_oldval.string == 'm')
1192 redraw_curbuf_later(UPD_NOT_VALID); 1195 redraw_curbuf_later(UPD_NOT_VALID);
1193 1196
1194 return NULL; 1197 return NULL;
1195 } 1198 }
1196 1199
1197 /* 1200 /*
1198 * The 'fileformats' option is changed. 1201 * The 'fileformats' option is changed.
1199 */ 1202 */
1200 static char * 1203 char *
1201 did_set_fileformats(void) 1204 did_set_fileformats(optset_T *args UNUSED)
1202 { 1205 {
1203 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK) 1206 if (check_opt_strings(p_ffs, p_ff_values, TRUE) != OK)
1204 return e_invalid_argument; 1207 return e_invalid_argument;
1205 1208
1206 // also change 'textauto' 1209 // also change 'textauto'
1210 p_ta = TRUE; 1213 p_ta = TRUE;
1211 1214
1212 return NULL; 1215 return NULL;
1213 } 1216 }
1214 1217
1215 #if defined(FEAT_CRYPT) 1218 #if defined(FEAT_CRYPT) || defined(PROTO)
1216 /* 1219 /*
1217 * The 'cryptkey' option is changed. 1220 * The 'cryptkey' option is changed.
1218 */ 1221 */
1219 static void 1222 char *
1220 did_set_cryptkey(char_u *oldval) 1223 did_set_cryptkey(optset_T *args)
1221 { 1224 {
1222 // Make sure the ":set" command doesn't show the new value in the 1225 // Make sure the ":set" command doesn't show the new value in the
1223 // history. 1226 // history.
1224 remove_key_from_history(); 1227 remove_key_from_history();
1225 1228
1226 if (STRCMP(curbuf->b_p_key, oldval) != 0) 1229 if (STRCMP(curbuf->b_p_key, args->os_oldval.string) != 0)
1227 { 1230 {
1228 // Need to update the swapfile. 1231 // Need to update the swapfile.
1229 ml_set_crypt_key(curbuf, oldval, 1232 ml_set_crypt_key(curbuf, args->os_oldval.string,
1230 *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm); 1233 *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
1231 changed_internal(); 1234 changed_internal();
1232 } 1235 }
1236
1237 return NULL;
1233 } 1238 }
1234 1239
1235 /* 1240 /*
1236 * The 'cryptmethod' option is changed. 1241 * The 'cryptmethod' option is changed.
1237 */ 1242 */
1238 static char * 1243 char *
1239 did_set_cryptmethod(char_u *oldval, int opt_flags) 1244 did_set_cryptmethod(optset_T *args)
1240 { 1245 {
1241 char_u *p; 1246 char_u *p;
1242 char_u *s; 1247 char_u *s;
1243 1248
1244 if (opt_flags & OPT_LOCAL) 1249 if (args->os_flags & OPT_LOCAL)
1245 p = curbuf->b_p_cm; 1250 p = curbuf->b_p_cm;
1246 else 1251 else
1247 p = p_cm; 1252 p = p_cm;
1248 if (check_opt_strings(p, p_cm_values, TRUE) != OK) 1253 if (check_opt_strings(p, p_cm_values, TRUE) != OK)
1249 return e_invalid_argument; 1254 return e_invalid_argument;
1257 p_cm = vim_strsave((char_u *)"zip"); 1262 p_cm = vim_strsave((char_u *)"zip");
1258 } 1263 }
1259 // When using ":set cm=name" the local value is going to be empty. 1264 // When using ":set cm=name" the local value is going to be empty.
1260 // Do that here, otherwise the crypt functions will still use the 1265 // Do that here, otherwise the crypt functions will still use the
1261 // local value. 1266 // local value.
1262 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) 1267 if ((args->os_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
1263 { 1268 {
1264 free_string_option(curbuf->b_p_cm); 1269 free_string_option(curbuf->b_p_cm);
1265 curbuf->b_p_cm = empty_option; 1270 curbuf->b_p_cm = empty_option;
1266 } 1271 }
1267 1272
1268 // Need to update the swapfile when the effective method changed. 1273 // Need to update the swapfile when the effective method changed.
1269 // Set "s" to the effective old value, "p" to the effective new 1274 // Set "s" to the effective old value, "p" to the effective new
1270 // method and compare. 1275 // method and compare.
1271 if ((opt_flags & OPT_LOCAL) && *oldval == NUL) 1276 if ((args->os_flags & OPT_LOCAL) && *args->os_oldval.string == NUL)
1272 s = p_cm; // was previously using the global value 1277 s = p_cm; // was previously using the global value
1273 else 1278 else
1274 s = oldval; 1279 s = args->os_oldval.string;
1275 if (*curbuf->b_p_cm == NUL) 1280 if (*curbuf->b_p_cm == NUL)
1276 p = p_cm; // is now using the global value 1281 p = p_cm; // is now using the global value
1277 else 1282 else
1278 p = curbuf->b_p_cm; 1283 p = curbuf->b_p_cm;
1279 if (STRCMP(s, p) != 0) 1284 if (STRCMP(s, p) != 0)
1280 ml_set_crypt_key(curbuf, curbuf->b_p_key, s); 1285 ml_set_crypt_key(curbuf, curbuf->b_p_key, s);
1281 1286
1282 // If the global value changes need to update the swapfile for all 1287 // If the global value changes need to update the swapfile for all
1283 // buffers using that value. 1288 // buffers using that value.
1284 if ((opt_flags & OPT_GLOBAL) && STRCMP(p_cm, oldval) != 0) 1289 if ((args->os_flags & OPT_GLOBAL)
1290 && STRCMP(p_cm, args->os_oldval.string) != 0)
1285 { 1291 {
1286 buf_T *buf; 1292 buf_T *buf;
1287 1293
1288 FOR_ALL_BUFFERS(buf) 1294 FOR_ALL_BUFFERS(buf)
1289 if (buf != curbuf && *buf->b_p_cm == NUL) 1295 if (buf != curbuf && *buf->b_p_cm == NUL)
1290 ml_set_crypt_key(buf, buf->b_p_key, oldval); 1296 ml_set_crypt_key(buf, buf->b_p_key, args->os_oldval.string);
1291 } 1297 }
1292 return NULL; 1298 return NULL;
1293 } 1299 }
1294 #endif 1300 #endif
1295 1301
1296 /* 1302 /*
1297 * The 'matchpairs' option is changed. 1303 * The 'matchpairs' option is changed.
1298 */ 1304 */
1299 static char * 1305 char *
1300 did_set_matchpairs(char_u **varp) 1306 did_set_matchpairs(optset_T *args)
1301 { 1307 {
1302 char_u *p; 1308 char_u *p;
1303 1309
1304 if (has_mbyte) 1310 if (has_mbyte)
1305 { 1311 {
1306 for (p = *varp; *p != NUL; ++p) 1312 for (p = args->os_varp; *p != NUL; ++p)
1307 { 1313 {
1308 int x2 = -1; 1314 int x2 = -1;
1309 int x3 = -1; 1315 int x3 = -1;
1310 1316
1311 p += mb_ptr2len(p); 1317 p += mb_ptr2len(p);
1323 } 1329 }
1324 } 1330 }
1325 else 1331 else
1326 { 1332 {
1327 // Check for "x:y,x:y" 1333 // Check for "x:y,x:y"
1328 for (p = *varp; *p != NUL; p += 4) 1334 for (p = args->os_varp; *p != NUL; p += 4)
1329 { 1335 {
1330 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ',')) 1336 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
1331 return e_invalid_argument; 1337 return e_invalid_argument;
1332 if (p[3] == NUL) 1338 if (p[3] == NUL)
1333 break; 1339 break;
1417 } 1423 }
1418 1424
1419 /* 1425 /*
1420 * The 'verbosefile' option is changed. 1426 * The 'verbosefile' option is changed.
1421 */ 1427 */
1422 static char * 1428 char *
1423 did_set_verbosefile(void) 1429 did_set_verbosefile(optset_T *args UNUSED)
1424 { 1430 {
1425 verbose_stop(); 1431 verbose_stop();
1426 if (*p_vfile != NUL && verbose_open() == FAIL) 1432 if (*p_vfile != NUL && verbose_open() == FAIL)
1427 return e_invalid_argument; 1433 return e_invalid_argument;
1428 1434
1558 else 1564 else
1559 out_str(T_BE); 1565 out_str(T_BE);
1560 } 1566 }
1561 } 1567 }
1562 1568
1563 #ifdef FEAT_LINEBREAK 1569 #if defined(FEAT_LINEBREAK) || defined(PROTO)
1564 /* 1570 /*
1565 * The 'showbreak' option is changed. 1571 * The 'showbreak' option is changed.
1566 */ 1572 */
1567 static char * 1573 char *
1568 did_set_showbreak(char_u **varp) 1574 did_set_showbreak(optset_T *args)
1569 { 1575 {
1570 char_u *s; 1576 char_u *s;
1571 1577
1572 for (s = *varp; *s; ) 1578 for (s = args->os_varp; *s; )
1573 { 1579 {
1574 if (ptr2cells(s) != 1) 1580 if (ptr2cells(s) != 1)
1575 return e_showbreak_contains_unprintable_or_wide_character; 1581 return e_showbreak_contains_unprintable_or_wide_character;
1576 MB_PTR_ADV(s); 1582 MB_PTR_ADV(s);
1577 } 1583 }
1578 1584
1579 return NULL; 1585 return NULL;
1580 } 1586 }
1581 #endif 1587 #endif
1582 1588
1583 #ifdef FEAT_GUI 1589 #if defined(FEAT_GUI) || defined(PROTO)
1584 /* 1590 /*
1585 * The 'guifont' option is changed. 1591 * The 'guifont' option is changed.
1586 */ 1592 */
1587 static char * 1593 char *
1588 did_set_guifont(char_u *oldval UNUSED) 1594 did_set_guifont(optset_T *args UNUSED)
1589 { 1595 {
1590 char_u *p; 1596 char_u *p;
1591 char *errmsg = NULL; 1597 char *errmsg = NULL;
1592 1598
1593 if (gui.in_use) 1599 if (gui.in_use)
1597 // Put up a font dialog and let the user select a new value. 1603 // Put up a font dialog and let the user select a new value.
1598 // If this is cancelled go back to the old value but don't 1604 // If this is cancelled go back to the old value but don't
1599 // give an error message. 1605 // give an error message.
1600 if (STRCMP(p, "*") == 0) 1606 if (STRCMP(p, "*") == 0)
1601 { 1607 {
1602 p = gui_mch_font_dialog(oldval); 1608 p = gui_mch_font_dialog(args->os_oldval.string);
1603 free_string_option(p_guifont); 1609 free_string_option(p_guifont);
1604 p_guifont = (p != NULL) ? p : vim_strsave(oldval); 1610 p_guifont = (p != NULL) ? p : vim_strsave(args->os_oldval.string);
1605 } 1611 }
1606 # endif 1612 # endif
1607 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK) 1613 if (p != NULL && gui_init_font(p_guifont, FALSE) != OK)
1608 { 1614 {
1609 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON) 1615 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)
1610 if (STRCMP(p_guifont, "*") == 0) 1616 if (STRCMP(p_guifont, "*") == 0)
1611 { 1617 {
1612 // Dialog was cancelled: Keep the old value without giving 1618 // Dialog was cancelled: Keep the old value without giving
1613 // an error message. 1619 // an error message.
1614 free_string_option(p_guifont); 1620 free_string_option(p_guifont);
1615 p_guifont = vim_strsave(oldval); 1621 p_guifont = vim_strsave(args->os_oldval.string);
1616 } 1622 }
1617 else 1623 else
1618 # endif 1624 # endif
1619 errmsg = e_invalid_fonts; 1625 errmsg = e_invalid_fonts;
1620 } 1626 }
1621 } 1627 }
1622 1628
1623 return errmsg; 1629 return errmsg;
1624 } 1630 }
1625 1631
1626 # ifdef FEAT_XFONTSET 1632 # if defined(FEAT_XFONTSET) || defined(PROTO)
1627 /* 1633 /*
1628 * The 'guifontset' option is changed. 1634 * The 'guifontset' option is changed.
1629 */ 1635 */
1630 static char * 1636 char *
1631 did_set_guifontset() 1637 did_set_guifontset(optset_T *args UNUSED)
1632 { 1638 {
1633 char *errmsg = NULL; 1639 char *errmsg = NULL;
1634 1640
1635 if (STRCMP(p_guifontset, "*") == 0) 1641 if (STRCMP(p_guifontset, "*") == 0)
1636 errmsg = e_cant_select_fontset; 1642 errmsg = e_cant_select_fontset;
1642 # endif 1648 # endif
1643 1649
1644 /* 1650 /*
1645 * The 'guifontwide' option is changed. 1651 * The 'guifontwide' option is changed.
1646 */ 1652 */
1647 static char * 1653 char *
1648 did_set_guifontwide(void) 1654 did_set_guifontwide(optset_T *args UNUSED)
1649 { 1655 {
1650 char *errmsg = NULL; 1656 char *errmsg = NULL;
1651 1657
1652 if (STRCMP(p_guifontwide, "*") == 0) 1658 if (STRCMP(p_guifontwide, "*") == 0)
1653 errmsg = e_cant_select_wide_font; 1659 errmsg = e_cant_select_wide_font;
1656 1662
1657 return errmsg; 1663 return errmsg;
1658 } 1664 }
1659 #endif 1665 #endif
1660 1666
1661 #if defined(FEAT_GUI_GTK) 1667 #if defined(FEAT_GUI_GTK) || defined(PROTO)
1662 static void 1668 /*
1663 did_set_guiligatures(void) 1669 * The 'guiligatures' option is changed.
1670 */
1671 char *
1672 did_set_guiligatures(optset_T *args UNUSED)
1664 { 1673 {
1665 gui_set_ligatures(); 1674 gui_set_ligatures();
1666 } 1675 return NULL;
1667 #endif 1676 }
1668 1677 #endif
1669 #ifdef FEAT_MOUSESHAPE 1678
1670 static char * 1679 #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
1671 did_set_mouseshape(void) 1680 char *
1681 did_set_mouseshape(optset_T *args UNUSED)
1672 { 1682 {
1673 char *errmsg = NULL; 1683 char *errmsg = NULL;
1674 1684
1675 errmsg = parse_shape_opt(SHAPE_MOUSE); 1685 errmsg = parse_shape_opt(SHAPE_MOUSE);
1676 update_mouseshape(-1); 1686 update_mouseshape(-1);
1680 #endif 1690 #endif
1681 1691
1682 /* 1692 /*
1683 * The 'titlestring' or the 'iconstring' option is changed. 1693 * The 'titlestring' or the 'iconstring' option is changed.
1684 */ 1694 */
1685 static void 1695 static char *
1686 did_set_titleiconstring(char_u **varp UNUSED) 1696 did_set_titleiconstring(optset_T *args UNUSED, int flagval UNUSED)
1687 { 1697 {
1688 #ifdef FEAT_STL_OPT 1698 #ifdef FEAT_STL_OPT
1689 int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
1690
1691 // NULL => statusline syntax 1699 // NULL => statusline syntax
1692 if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL) 1700 if (vim_strchr(args->os_varp, '%')
1701 && check_stl_option(args->os_varp) == NULL)
1693 stl_syntax |= flagval; 1702 stl_syntax |= flagval;
1694 else 1703 else
1695 stl_syntax &= ~flagval; 1704 stl_syntax &= ~flagval;
1696 #endif 1705 #endif
1697 did_set_title(); 1706 did_set_title();
1707
1708 return NULL;
1709 }
1710
1711 /*
1712 * The 'titlestring' option is changed.
1713 */
1714 char *
1715 did_set_titlestring(optset_T *args)
1716 {
1717 int flagval = 0;
1718
1719 #ifdef FEAT_STL_OPT
1720 flagval = STL_IN_TITLE;
1721 #endif
1722 return did_set_titleiconstring(args, flagval);
1723 }
1724
1725 /*
1726 * The 'iconstring' option is changed.
1727 */
1728 char *
1729 did_set_iconstring(optset_T *args)
1730 {
1731 int flagval = 0;
1732
1733 #ifdef FEAT_STL_OPT
1734 flagval = STL_IN_ICON;
1735 #endif
1736
1737 return did_set_titleiconstring(args, flagval);
1698 } 1738 }
1699 1739
1700 #ifdef FEAT_GUI 1740 #ifdef FEAT_GUI
1701 /* 1741 /*
1702 * The 'guioptions' option is changed. 1742 * The 'guioptions' option is changed.
1703 */ 1743 */
1704 static void 1744 char *
1705 did_set_guioptions(char_u *oldval) 1745 did_set_guioptions(optset_T *args)
1706 { 1746 {
1707 gui_init_which_components(oldval); 1747 gui_init_which_components(args->os_oldval.string);
1748 return NULL;
1708 } 1749 }
1709 #endif 1750 #endif
1710 1751
1711 #if defined(FEAT_GUI_TABLINE) 1752 #if defined(FEAT_GUI_TABLINE)
1712 static void 1753 /*
1713 did_set_guitablabel() 1754 * The 'guitablabel' option is changed.
1755 */
1756 char *
1757 did_set_guitablabel(optset_T *args UNUSED)
1714 { 1758 {
1715 redraw_tabline = TRUE; 1759 redraw_tabline = TRUE;
1716 } 1760 return NULL;
1717 #endif 1761 }
1718 1762 #endif
1719 #if defined(UNIX) || defined(VMS) 1763
1764 #if defined(UNIX) || defined(VMS) || defined(PROTO)
1720 /* 1765 /*
1721 * The 'ttymouse' option is changed. 1766 * The 'ttymouse' option is changed.
1722 */ 1767 */
1723 static char * 1768 char *
1724 did_set_ttymouse(void) 1769 did_set_ttymouse(optset_T *args UNUSED)
1725 { 1770 {
1726 char *errmsg = NULL; 1771 char *errmsg = NULL;
1727 1772
1728 // Switch the mouse off before changing the escape sequences used for 1773 // Switch the mouse off before changing the escape sequences used for
1729 // that. 1774 // that.
1740 #endif 1785 #endif
1741 1786
1742 /* 1787 /*
1743 * The 'selection' option is changed. 1788 * The 'selection' option is changed.
1744 */ 1789 */
1745 static char * 1790 char *
1746 did_set_selection(void) 1791 did_set_selection(optset_T *args UNUSED)
1747 { 1792 {
1748 if (*p_sel == NUL 1793 if (*p_sel == NUL
1749 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK) 1794 || check_opt_strings(p_sel, p_sel_values, FALSE) != OK)
1750 return e_invalid_argument; 1795 return e_invalid_argument;
1751 1796
1752 return NULL; 1797 return NULL;
1753 } 1798 }
1754 1799
1755 #ifdef FEAT_BROWSE 1800 #if defined(FEAT_BROWSE) || defined(PROTO)
1756 /* 1801 /*
1757 * The 'browsedir' option is changed. 1802 * The 'browsedir' option is changed.
1758 */ 1803 */
1759 static char * 1804 char *
1760 did_set_browsedir(void) 1805 did_set_browsedir(optset_T *args UNUSED)
1761 { 1806 {
1762 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK 1807 if (check_opt_strings(p_bsdir, p_bsdir_values, FALSE) != OK
1763 && !mch_isdir(p_bsdir)) 1808 && !mch_isdir(p_bsdir))
1764 return e_invalid_argument; 1809 return e_invalid_argument;
1765 1810
1768 #endif 1813 #endif
1769 1814
1770 /* 1815 /*
1771 * The 'keymodel' option is changed. 1816 * The 'keymodel' option is changed.
1772 */ 1817 */
1773 static char * 1818 char *
1774 did_set_keymodel(void) 1819 did_set_keymodel(optset_T *args UNUSED)
1775 { 1820 {
1776 if (check_opt_strings(p_km, p_km_values, TRUE) != OK) 1821 if (check_opt_strings(p_km, p_km_values, TRUE) != OK)
1777 return e_invalid_argument; 1822 return e_invalid_argument;
1778 1823
1779 km_stopsel = (vim_strchr(p_km, 'o') != NULL); 1824 km_stopsel = (vim_strchr(p_km, 'o') != NULL);
1782 } 1827 }
1783 1828
1784 /* 1829 /*
1785 * The 'keyprotocol' option is changed. 1830 * The 'keyprotocol' option is changed.
1786 */ 1831 */
1787 static char * 1832 char *
1788 did_set_keyprotocol(void) 1833 did_set_keyprotocol(optset_T *args UNUSED)
1789 { 1834 {
1790 if (match_keyprotocol(NULL) == KEYPROTOCOL_FAIL) 1835 if (match_keyprotocol(NULL) == KEYPROTOCOL_FAIL)
1791 return e_invalid_argument; 1836 return e_invalid_argument;
1792 1837
1793 return NULL; 1838 return NULL;
1794 } 1839 }
1795 1840
1796 /* 1841 /*
1797 * The 'mousemodel' option is changed. 1842 * The 'mousemodel' option is changed.
1798 */ 1843 */
1799 static char * 1844 char *
1800 did_set_mousemodel(void) 1845 did_set_mousemodel(optset_T *args UNUSED)
1801 { 1846 {
1802 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK) 1847 if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
1803 return e_invalid_argument; 1848 return e_invalid_argument;
1804 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002) 1849 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) && (XmVersion <= 1002)
1805 else if (*p_mousem != *oldval) 1850 else if (*p_mousem != *oldval)
1812 } 1857 }
1813 1858
1814 /* 1859 /*
1815 * The 'display' option is changed. 1860 * The 'display' option is changed.
1816 */ 1861 */
1817 static char * 1862 char *
1818 did_set_display(void) 1863 did_set_display(optset_T *args UNUSED)
1819 { 1864 {
1820 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK) 1865 if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
1821 return e_invalid_argument; 1866 return e_invalid_argument;
1822 1867
1823 (void)init_chartab(); 1868 (void)init_chartab();
1824 return NULL; 1869 return NULL;
1825 } 1870 }
1826 1871
1827 #ifdef FEAT_SPELL 1872 #if defined(FEAT_SPELL) || defined(PROTO)
1828 /* 1873 /*
1829 * The 'spellfile' option is changed. 1874 * The 'spellfile' option is changed.
1830 */ 1875 */
1831 static char * 1876 char *
1832 did_set_spellfile(char_u **varp) 1877 did_set_spellfile(optset_T *args)
1833 { 1878 {
1834 if (!valid_spellfile(*varp)) 1879 if (!valid_spellfile(args->os_varp))
1835 return e_invalid_argument; 1880 return e_invalid_argument;
1836 1881
1837 // If there is a window for this buffer in which 'spell' is set load the 1882 // If there is a window for this buffer in which 'spell' is set load the
1838 // wordlists. 1883 // wordlists.
1839 return did_set_spell_option(TRUE); 1884 return did_set_spell_option(TRUE);
1840 } 1885 }
1841 1886
1842 /* 1887 /*
1843 * The 'spell' option is changed. 1888 * The 'spell' option is changed.
1844 */ 1889 */
1845 static char * 1890 char *
1846 did_set_spell(char_u **varp) 1891 did_set_spelllang(optset_T *args)
1847 { 1892 {
1848 if (!valid_spelllang(*varp)) 1893 if (!valid_spelllang(args->os_varp))
1849 return e_invalid_argument; 1894 return e_invalid_argument;
1850 1895
1851 // If there is a window for this buffer in which 'spell' is set load the 1896 // If there is a window for this buffer in which 'spell' is set load the
1852 // wordlists. 1897 // wordlists.
1853 return did_set_spell_option(FALSE); 1898 return did_set_spell_option(FALSE);
1854 } 1899 }
1855 1900
1856 /* 1901 /*
1857 * The 'spellcapcheck' option is changed. 1902 * The 'spellcapcheck' option is changed.
1858 */ 1903 */
1859 static char * 1904 char *
1860 did_set_spellcapcheck(void) 1905 did_set_spellcapcheck(optset_T *args UNUSED)
1861 { 1906 {
1862 // compile the regexp program. 1907 // compile the regexp program.
1863 return compile_cap_prog(curwin->w_s); 1908 return compile_cap_prog(curwin->w_s);
1864 } 1909 }
1865 1910
1866 /* 1911 /*
1867 * The 'spelloptions' option is changed. 1912 * The 'spelloptions' option is changed.
1868 */ 1913 */
1869 static char * 1914 char *
1870 did_set_spelloptions(char_u **varp) 1915 did_set_spelloptions(optset_T *args)
1871 { 1916 {
1872 if (**varp != NUL && STRCMP("camel", *varp) != 0) 1917 if (*args->os_varp != NUL && STRCMP("camel", args->os_varp) != 0)
1873 return e_invalid_argument; 1918 return e_invalid_argument;
1874 1919
1875 return NULL; 1920 return NULL;
1876 } 1921 }
1877 1922
1878 /* 1923 /*
1879 * The 'spellsuggest' option is changed. 1924 * The 'spellsuggest' option is changed.
1880 */ 1925 */
1881 static char * 1926 char *
1882 did_set_spellsuggest(void) 1927 did_set_spellsuggest(optset_T *args UNUSED)
1883 { 1928 {
1884 if (spell_check_sps() != OK) 1929 if (spell_check_sps() != OK)
1885 return e_invalid_argument; 1930 return e_invalid_argument;
1886 1931
1887 return NULL; 1932 return NULL;
1888 } 1933 }
1889 1934
1890 /* 1935 /*
1891 * The 'mkspellmem' option is changed. 1936 * The 'mkspellmem' option is changed.
1892 */ 1937 */
1893 static char * 1938 char *
1894 did_set_mkspellmem(void) 1939 did_set_mkspellmem(optset_T *args UNUSED)
1895 { 1940 {
1896 if (spell_check_msm() != OK) 1941 if (spell_check_msm() != OK)
1897 return e_invalid_argument; 1942 return e_invalid_argument;
1898 1943
1899 return NULL; 1944 return NULL;
1901 #endif 1946 #endif
1902 1947
1903 /* 1948 /*
1904 * The 'buftype' option is changed. 1949 * The 'buftype' option is changed.
1905 */ 1950 */
1906 static char * 1951 char *
1907 did_set_buftype(void) 1952 did_set_buftype(optset_T *args UNUSED)
1908 { 1953 {
1909 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK) 1954 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
1910 return e_invalid_argument; 1955 return e_invalid_argument;
1911 1956
1912 if (curwin->w_status_height) 1957 if (curwin->w_status_height)
1921 } 1966 }
1922 1967
1923 #ifdef FEAT_STL_OPT 1968 #ifdef FEAT_STL_OPT
1924 /* 1969 /*
1925 * The 'statusline' or the 'tabline' or the 'rulerformat' option is changed. 1970 * The 'statusline' or the 'tabline' or the 'rulerformat' option is changed.
1971 * "rulerformat" is TRUE if the 'rulerformat' option is changed.
1926 */ 1972 */
1927 static char * 1973 static char *
1928 did_set_statusline(char_u **varp) 1974 did_set_statustabline_rulerformat(optset_T *args, int rulerformat)
1929 { 1975 {
1930 char_u *s; 1976 char_u *s;
1931 char *errmsg = NULL; 1977 char *errmsg = NULL;
1932 int wid; 1978 int wid;
1933 1979
1934 if (varp == &p_ruf) // reset ru_wid first 1980 if (rulerformat) // reset ru_wid first
1935 ru_wid = 0; 1981 ru_wid = 0;
1936 s = *varp; 1982 s = args->os_varp;
1937 if (varp == &p_ruf && *s == '%') 1983 if (rulerformat && *s == '%')
1938 { 1984 {
1939 // set ru_wid if 'ruf' starts with "%99(" 1985 // set ru_wid if 'ruf' starts with "%99("
1940 if (*++s == '-') // ignore a '-' 1986 if (*++s == '-') // ignore a '-'
1941 s++; 1987 s++;
1942 wid = getdigits(&s); 1988 wid = getdigits(&s);
1944 ru_wid = wid; 1990 ru_wid = wid;
1945 else 1991 else
1946 errmsg = check_stl_option(p_ruf); 1992 errmsg = check_stl_option(p_ruf);
1947 } 1993 }
1948 // check 'statusline' or 'tabline' only if it doesn't start with "%!" 1994 // check 'statusline' or 'tabline' only if it doesn't start with "%!"
1949 else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') 1995 else if (rulerformat || s[0] != '%' || s[1] != '!')
1950 errmsg = check_stl_option(s); 1996 errmsg = check_stl_option(s);
1951 if (varp == &p_ruf && errmsg == NULL) 1997 if (rulerformat && errmsg == NULL)
1952 comp_col(); 1998 comp_col();
1953 1999
1954 return errmsg; 2000 return errmsg;
2001 }
2002
2003 /*
2004 * The 'statusline' option is changed.
2005 */
2006 char *
2007 did_set_statusline(optset_T *args)
2008 {
2009 return did_set_statustabline_rulerformat(args, FALSE);
2010 }
2011
2012 /*
2013 * The 'tabline' option is changed.
2014 */
2015 char *
2016 did_set_tabline(optset_T *args)
2017 {
2018 return did_set_statustabline_rulerformat(args, FALSE);
2019 }
2020
2021
2022 /*
2023 * The 'rulerformat' option is changed.
2024 */
2025 char *
2026 did_set_rulerformat(optset_T *args)
2027 {
2028 return did_set_statustabline_rulerformat(args, TRUE);
1955 } 2029 }
1956 #endif 2030 #endif
1957 2031
1958 /* 2032 /*
1959 * The 'complete' option is changed. 2033 * The 'complete' option is changed.
2001 } 2075 }
2002 2076
2003 /* 2077 /*
2004 * The 'completeopt' option is changed. 2078 * The 'completeopt' option is changed.
2005 */ 2079 */
2006 static char * 2080 char *
2007 did_set_completeopt(void) 2081 did_set_completeopt(optset_T *args UNUSED)
2008 { 2082 {
2009 if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK) 2083 if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
2010 return e_invalid_argument; 2084 return e_invalid_argument;
2011 2085
2012 completeopt_was_set(); 2086 completeopt_was_set();
2013 return NULL; 2087 return NULL;
2014 } 2088 }
2015 2089
2016 #ifdef BACKSLASH_IN_FILENAME 2090 #if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
2017 /* 2091 /*
2018 * The 'completeslash' option is changed. 2092 * The 'completeslash' option is changed.
2019 */ 2093 */
2020 static char * 2094 char *
2021 did_set_completeslash(void) 2095 did_set_completeslash(optset_T *args UNUSED)
2022 { 2096 {
2023 if (check_opt_strings(p_csl, p_csl_values, FALSE) != OK 2097 if (check_opt_strings(p_csl, p_csl_values, FALSE) != OK
2024 || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK) 2098 || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK)
2025 return e_invalid_argument; 2099 return e_invalid_argument;
2026 2100
2027 return NULL; 2101 return NULL;
2028 } 2102 }
2029 #endif 2103 #endif
2030 2104
2031 #ifdef FEAT_SIGNS 2105 #if defined(FEAT_SIGNS) || defined(PROTO)
2032 /* 2106 /*
2033 * The 'signcolumn' option is changed. 2107 * The 'signcolumn' option is changed.
2034 */ 2108 */
2035 static char * 2109 char *
2036 did_set_signcolumn(char_u **varp, char_u *oldval) 2110 did_set_signcolumn(optset_T *args)
2037 { 2111 {
2038 if (check_opt_strings(*varp, p_scl_values, FALSE) != OK) 2112 if (check_opt_strings(args->os_varp, p_scl_values, FALSE) != OK)
2039 return e_invalid_argument; 2113 return e_invalid_argument;
2040 // When changing the 'signcolumn' to or from 'number', recompute the 2114 // When changing the 'signcolumn' to or from 'number', recompute the
2041 // width of the number column if 'number' or 'relativenumber' is set. 2115 // width of the number column if 'number' or 'relativenumber' is set.
2042 if (((*oldval == 'n' && *(oldval + 1) == 'u') 2116 if (((*args->os_oldval.string == 'n' && args->os_oldval.string[1] == 'u')
2043 || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u')) 2117 || (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u'))
2044 && (curwin->w_p_nu || curwin->w_p_rnu)) 2118 && (curwin->w_p_nu || curwin->w_p_rnu))
2045 curwin->w_nrwidth_line_count = 0; 2119 curwin->w_nrwidth_line_count = 0;
2046 2120
2047 return NULL; 2121 return NULL;
2048 } 2122 }
2049 #endif 2123 #endif
2050 2124
2051 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) 2125 #if (defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)) || defined(PROTO)
2052 /* 2126 /*
2053 * The 'toolbar' option is changed. 2127 * The 'toolbar' option is changed.
2054 */ 2128 */
2055 static char * 2129 char *
2056 did_set_toolbar(void) 2130 did_set_toolbar(optset_T *args UNUSED)
2057 { 2131 {
2058 if (opt_strings_flags(p_toolbar, p_toolbar_values, 2132 if (opt_strings_flags(p_toolbar, p_toolbar_values,
2059 &toolbar_flags, TRUE) != OK) 2133 &toolbar_flags, TRUE) != OK)
2060 return e_invalid_argument; 2134 return e_invalid_argument;
2061 2135
2064 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0); 2138 (TOOLBAR_TEXT | TOOLBAR_ICONS)) != 0);
2065 return NULL; 2139 return NULL;
2066 } 2140 }
2067 #endif 2141 #endif
2068 2142
2069 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) 2143 #if (defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)) || defined(PROTO)
2070 /* 2144 /*
2071 * The 'toolbariconsize' option is changed. GTK+ 2 only. 2145 * The 'toolbariconsize' option is changed. GTK+ 2 only.
2072 */ 2146 */
2073 static char * 2147 char *
2074 did_set_toolbariconsize(void) 2148 did_set_toolbariconsize(optset_T *args UNUSED)
2075 { 2149 {
2076 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK) 2150 if (opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE) != OK)
2077 return e_invalid_argument; 2151 return e_invalid_argument;
2078 2152
2079 out_flush(); 2153 out_flush();
2084 #endif 2158 #endif
2085 2159
2086 /* 2160 /*
2087 * The 'pastetoggle' option is changed. 2161 * The 'pastetoggle' option is changed.
2088 */ 2162 */
2089 static void 2163 char *
2090 did_set_pastetoggle(void) 2164 did_set_pastetoggle(optset_T *args UNUSED)
2091 { 2165 {
2092 char_u *p; 2166 char_u *p;
2093 2167
2094 // translate key codes like in a mapping 2168 // translate key codes like in a mapping
2095 if (*p_pt) 2169 if (*p_pt)
2100 { 2174 {
2101 free_string_option(p_pt); 2175 free_string_option(p_pt);
2102 p_pt = p; 2176 p_pt = p;
2103 } 2177 }
2104 } 2178 }
2179
2180 return NULL;
2105 } 2181 }
2106 2182
2107 /* 2183 /*
2108 * The 'backspace' option is changed. 2184 * The 'backspace' option is changed.
2109 */ 2185 */
2110 static char * 2186 char *
2111 did_set_backspace(void) 2187 did_set_backspace(optset_T *args UNUSED)
2112 { 2188 {
2113 if (VIM_ISDIGIT(*p_bs)) 2189 if (VIM_ISDIGIT(*p_bs))
2114 { 2190 {
2115 if (*p_bs > '3' || p_bs[1] != NUL) 2191 if (*p_bs > '3' || p_bs[1] != NUL)
2116 return e_invalid_argument; 2192 return e_invalid_argument;
2122 } 2198 }
2123 2199
2124 /* 2200 /*
2125 * The 'tagcase' option is changed. 2201 * The 'tagcase' option is changed.
2126 */ 2202 */
2127 static char * 2203 char *
2128 did_set_tagcase(int opt_flags) 2204 did_set_tagcase(optset_T *args)
2129 { 2205 {
2130 unsigned int *flags; 2206 unsigned int *flags;
2131 char_u *p; 2207 char_u *p;
2132 2208
2133 if (opt_flags & OPT_LOCAL) 2209 if (args->os_flags & OPT_LOCAL)
2134 { 2210 {
2135 p = curbuf->b_p_tc; 2211 p = curbuf->b_p_tc;
2136 flags = &curbuf->b_tc_flags; 2212 flags = &curbuf->b_tc_flags;
2137 } 2213 }
2138 else 2214 else
2139 { 2215 {
2140 p = p_tc; 2216 p = p_tc;
2141 flags = &tc_flags; 2217 flags = &tc_flags;
2142 } 2218 }
2143 2219
2144 if ((opt_flags & OPT_LOCAL) && *p == NUL) 2220 if ((args->os_flags & OPT_LOCAL) && *p == NUL)
2145 // make the local value empty: use the global value 2221 // make the local value empty: use the global value
2146 *flags = 0; 2222 *flags = 0;
2147 else if (*p == NUL 2223 else if (*p == NUL
2148 || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK) 2224 || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK)
2149 return e_invalid_argument; 2225 return e_invalid_argument;
2150 2226
2151 return NULL; 2227 return NULL;
2152 } 2228 }
2153 2229
2154 #ifdef FEAT_DIFF 2230 #if defined(FEAT_DIFF) || defined(PROTO)
2155 /* 2231 /*
2156 * The 'diffopt' option is changed. 2232 * The 'diffopt' option is changed.
2157 */ 2233 */
2158 static char * 2234 char *
2159 did_set_diffopt(void) 2235 did_set_diffopt(optset_T *args UNUSED)
2160 { 2236 {
2161 if (diffopt_changed() == FAIL) 2237 if (diffopt_changed() == FAIL)
2162 return e_invalid_argument; 2238 return e_invalid_argument;
2163 2239
2164 return NULL; 2240 return NULL;
2165 } 2241 }
2166 #endif 2242 #endif
2167 2243
2168 #ifdef FEAT_FOLDING 2244 #if defined(FEAT_FOLDING) || defined(PROTO)
2169 /* 2245 /*
2170 * The 'foldmethod' option is changed. 2246 * The 'foldmethod' option is changed.
2171 */ 2247 */
2172 static char * 2248 char *
2173 did_set_foldmethod(char_u **varp) 2249 did_set_foldmethod(optset_T *args)
2174 { 2250 {
2175 if (check_opt_strings(*varp, p_fdm_values, FALSE) != OK 2251 if (check_opt_strings(args->os_varp, p_fdm_values, FALSE) != OK
2176 || *curwin->w_p_fdm == NUL) 2252 || *curwin->w_p_fdm == NUL)
2177 return e_invalid_argument; 2253 return e_invalid_argument;
2178 2254
2179 foldUpdateAll(curwin); 2255 foldUpdateAll(curwin);
2180 if (foldmethodIsDiff(curwin)) 2256 if (foldmethodIsDiff(curwin))
2183 } 2259 }
2184 2260
2185 /* 2261 /*
2186 * The 'foldmarker' option is changed. 2262 * The 'foldmarker' option is changed.
2187 */ 2263 */
2188 static char * 2264 char *
2189 did_set_foldmarker(char_u **varp) 2265 did_set_foldmarker(optset_T *args)
2190 { 2266 {
2191 char_u *p; 2267 char_u *p;
2192 2268
2193 p = vim_strchr(*varp, ','); 2269 p = vim_strchr(args->os_varp, ',');
2194 if (p == NULL) 2270 if (p == NULL)
2195 return e_comma_required; 2271 return e_comma_required;
2196 else if (p == *varp || p[1] == NUL) 2272 else if (p == args->os_varp || p[1] == NUL)
2197 return e_invalid_argument; 2273 return e_invalid_argument;
2198 else if (foldmethodIsMarker(curwin)) 2274 else if (foldmethodIsMarker(curwin))
2199 foldUpdateAll(curwin); 2275 foldUpdateAll(curwin);
2200 2276
2201 return NULL; 2277 return NULL;
2202 } 2278 }
2203 2279
2204 /* 2280 /*
2205 * The 'commentstring' option is changed. 2281 * The 'commentstring' option is changed.
2206 */ 2282 */
2207 static char * 2283 char *
2208 did_set_commentstring(char_u **varp) 2284 did_set_commentstring(optset_T *args)
2209 { 2285 {
2210 if (**varp != NUL && strstr((char *)*varp, "%s") == NULL) 2286 if (*args->os_varp != NUL && strstr((char *)args->os_varp, "%s") == NULL)
2211 return e_commentstring_must_be_empty_or_contain_str; 2287 return e_commentstring_must_be_empty_or_contain_str;
2212 2288
2213 return NULL; 2289 return NULL;
2214 } 2290 }
2215 2291
2216 /* 2292 /*
2217 * The 'foldignore' option is changed. 2293 * The 'foldignore' option is changed.
2218 */ 2294 */
2219 static void 2295 char *
2220 did_set_foldignore(void) 2296 did_set_foldignore(optset_T *args UNUSED)
2221 { 2297 {
2222 if (foldmethodIsIndent(curwin)) 2298 if (foldmethodIsIndent(curwin))
2223 foldUpdateAll(curwin); 2299 foldUpdateAll(curwin);
2300 return NULL;
2224 } 2301 }
2225 #endif 2302 #endif
2226 2303
2227 /* 2304 /*
2228 * The 'virtualedit' option is changed. 2305 * The 'virtualedit' option is changed.
2229 */ 2306 */
2230 static char * 2307 char *
2231 did_set_virtualedit(char_u *oldval, int opt_flags) 2308 did_set_virtualedit(optset_T *args)
2232 { 2309 {
2233 char_u *ve = p_ve; 2310 char_u *ve = p_ve;
2234 unsigned int *flags = &ve_flags; 2311 unsigned int *flags = &ve_flags;
2235 2312
2236 if (opt_flags & OPT_LOCAL) 2313 if (args->os_flags & OPT_LOCAL)
2237 { 2314 {
2238 ve = curwin->w_p_ve; 2315 ve = curwin->w_p_ve;
2239 flags = &curwin->w_ve_flags; 2316 flags = &curwin->w_ve_flags;
2240 } 2317 }
2241 2318
2242 if ((opt_flags & OPT_LOCAL) && *ve == NUL) 2319 if ((args->os_flags & OPT_LOCAL) && *ve == NUL)
2243 // make the local value empty: use the global value 2320 // make the local value empty: use the global value
2244 *flags = 0; 2321 *flags = 0;
2245 else 2322 else
2246 { 2323 {
2247 if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK) 2324 if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK)
2248 return e_invalid_argument; 2325 return e_invalid_argument;
2249 else if (STRCMP(ve, oldval) != 0) 2326 else if (STRCMP(ve, args->os_oldval.string) != 0)
2250 { 2327 {
2251 // Recompute cursor position in case the new 've' setting 2328 // Recompute cursor position in case the new 've' setting
2252 // changes something. 2329 // changes something.
2253 validate_virtcol(); 2330 validate_virtcol();
2254 coladvance(curwin->w_virtcol); 2331 coladvance(curwin->w_virtcol);
2256 } 2333 }
2257 2334
2258 return NULL; 2335 return NULL;
2259 } 2336 }
2260 2337
2261 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX) 2338 #if (defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)) || defined(PROTO)
2262 /* 2339 /*
2263 * The 'cscopequickfix' option is changed. 2340 * The 'cscopequickfix' option is changed.
2264 */ 2341 */
2265 static char * 2342 char *
2266 did_set_cscopequickfix(void) 2343 did_set_cscopequickfix(optset_T *args UNUSED)
2267 { 2344 {
2268 char_u *p; 2345 char_u *p;
2269 2346
2270 if (p_csqf == NULL) 2347 if (p_csqf == NULL)
2271 return NULL; 2348 return NULL;
2289 #endif 2366 #endif
2290 2367
2291 /* 2368 /*
2292 * The 'cinoptions' option is changed. 2369 * The 'cinoptions' option is changed.
2293 */ 2370 */
2294 static void 2371 char *
2295 did_set_cinoptions(void) 2372 did_set_cinoptions(optset_T *args UNUSED)
2296 { 2373 {
2297 // TODO: recognize errors 2374 // TODO: recognize errors
2298 parse_cino(curbuf); 2375 parse_cino(curbuf);
2376
2377 return NULL;
2299 } 2378 }
2300 2379
2301 /* 2380 /*
2302 * The 'lispoptions' option is changed. 2381 * The 'lispoptions' option is changed.
2303 */ 2382 */
2304 static char * 2383 char *
2305 did_set_lispoptions(char_u **varp) 2384 did_set_lispoptions(optset_T *args)
2306 { 2385 {
2307 if (**varp != NUL && STRCMP(*varp, "expr:0") != 0 2386 if (*args->os_varp != NUL && STRCMP(args->os_varp, "expr:0") != 0
2308 && STRCMP(*varp, "expr:1") != 0) 2387 && STRCMP(args->os_varp, "expr:1") != 0)
2309 return e_invalid_argument; 2388 return e_invalid_argument;
2310 2389
2311 return NULL; 2390 return NULL;
2312 } 2391 }
2313 2392
2314 #if defined(FEAT_RENDER_OPTIONS) 2393 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO)
2315 /* 2394 /*
2316 * The 'renderoptions' option is changed. 2395 * The 'renderoptions' option is changed.
2317 */ 2396 */
2318 static char * 2397 char *
2319 did_set_renderoptions(void) 2398 did_set_renderoptions(optset_T *args UNUSED)
2320 { 2399 {
2321 if (!gui_mch_set_rendering_options(p_rop)) 2400 if (!gui_mch_set_rendering_options(p_rop))
2322 return e_invalid_argument; 2401 return e_invalid_argument;
2323 2402
2324 return NULL; 2403 return NULL;
2345 *value_checked = TRUE; 2424 *value_checked = TRUE;
2346 2425
2347 return NULL; 2426 return NULL;
2348 } 2427 }
2349 2428
2350 #ifdef FEAT_TERMINAL 2429 #if defined(FEAT_TERMINAL) || defined(PROTO)
2351 /* 2430 /*
2352 * The 'termwinkey' option is changed. 2431 * The 'termwinkey' option is changed.
2353 */ 2432 */
2354 static char * 2433 char *
2355 did_set_termwinkey(void) 2434 did_set_termwinkey(optset_T *args UNUSED)
2356 { 2435 {
2357 if (*curwin->w_p_twk != NUL 2436 if (*curwin->w_p_twk != NUL
2358 && string_to_key(curwin->w_p_twk, TRUE) == 0) 2437 && string_to_key(curwin->w_p_twk, TRUE) == 0)
2359 return e_invalid_argument; 2438 return e_invalid_argument;
2360 2439
2362 } 2441 }
2363 2442
2364 /* 2443 /*
2365 * The 'termwinsize' option is changed. 2444 * The 'termwinsize' option is changed.
2366 */ 2445 */
2367 static char * 2446 char *
2368 did_set_termwinsize(void) 2447 did_set_termwinsize(optset_T *args UNUSED)
2369 { 2448 {
2370 char_u *p; 2449 char_u *p;
2371 2450
2372 if (*curwin->w_p_tws == NUL) 2451 if (*curwin->w_p_tws == NUL)
2373 return NULL; 2452 return NULL;
2380 2459
2381 return NULL; 2460 return NULL;
2382 } 2461 }
2383 #endif 2462 #endif
2384 2463
2385 #ifdef FEAT_VARTABS 2464 #if defined(FEAT_VARTABS) || defined(PROTO)
2386 /* 2465 /*
2387 * The 'varsofttabstop' option is changed. 2466 * The 'varsofttabstop' option is changed.
2388 */ 2467 */
2389 static char * 2468 char *
2390 did_set_varsofttabstop(char_u **varp) 2469 did_set_varsofttabstop(optset_T *args)
2391 { 2470 {
2392 char_u *cp; 2471 char_u *cp;
2393 2472
2394 if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) 2473 if (!(args->os_varp[0]) || (args->os_varp[0] == '0' && !(args->os_varp[1])))
2395 { 2474 {
2396 if (curbuf->b_p_vsts_array) 2475 if (curbuf->b_p_vsts_array)
2397 { 2476 {
2398 vim_free(curbuf->b_p_vsts_array); 2477 vim_free(curbuf->b_p_vsts_array);
2399 curbuf->b_p_vsts_array = 0; 2478 curbuf->b_p_vsts_array = 0;
2400 } 2479 }
2401 } 2480 }
2402 else 2481 else
2403 { 2482 {
2404 for (cp = *varp; *cp; ++cp) 2483 for (cp = args->os_varp; *cp; ++cp)
2405 { 2484 {
2406 if (vim_isdigit(*cp)) 2485 if (vim_isdigit(*cp))
2407 continue; 2486 continue;
2408 if (*cp == ',' && cp > *varp && *(cp-1) != ',') 2487 if (*cp == ',' && cp > args->os_varp && *(cp-1) != ',')
2409 continue; 2488 continue;
2410 return e_invalid_argument; 2489 return e_invalid_argument;
2411 } 2490 }
2412 2491
2413 int *oldarray = curbuf->b_p_vsts_array; 2492 int *oldarray = curbuf->b_p_vsts_array;
2414 if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)) == OK) 2493 if (tabstop_set(args->os_varp, &(curbuf->b_p_vsts_array)) == OK)
2415 { 2494 {
2416 if (oldarray) 2495 if (oldarray)
2417 vim_free(oldarray); 2496 vim_free(oldarray);
2418 } 2497 }
2419 else 2498 else
2424 } 2503 }
2425 2504
2426 /* 2505 /*
2427 * The 'vartabstop' option is changed. 2506 * The 'vartabstop' option is changed.
2428 */ 2507 */
2429 static char * 2508 char *
2430 did_set_vartabstop(char_u **varp) 2509 did_set_vartabstop(optset_T *args)
2431 { 2510 {
2432 char_u *cp; 2511 char_u *cp;
2433 2512
2434 if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) 2513 if (!(args->os_varp[0]) || (args->os_varp[0] == '0' && !(args->os_varp[1])))
2435 { 2514 {
2436 if (curbuf->b_p_vts_array) 2515 if (curbuf->b_p_vts_array)
2437 { 2516 {
2438 vim_free(curbuf->b_p_vts_array); 2517 vim_free(curbuf->b_p_vts_array);
2439 curbuf->b_p_vts_array = NULL; 2518 curbuf->b_p_vts_array = NULL;
2440 } 2519 }
2441 } 2520 }
2442 else 2521 else
2443 { 2522 {
2444 for (cp = *varp; *cp; ++cp) 2523 for (cp = args->os_varp; *cp; ++cp)
2445 { 2524 {
2446 if (vim_isdigit(*cp)) 2525 if (vim_isdigit(*cp))
2447 continue; 2526 continue;
2448 if (*cp == ',' && cp > *varp && *(cp-1) != ',') 2527 if (*cp == ',' && cp > args->os_varp && *(cp-1) != ',')
2449 continue; 2528 continue;
2450 return e_invalid_argument; 2529 return e_invalid_argument;
2451 } 2530 }
2452 2531
2453 int *oldarray = curbuf->b_p_vts_array; 2532 int *oldarray = curbuf->b_p_vts_array;
2454 2533
2455 if (tabstop_set(*varp, &(curbuf->b_p_vts_array)) == OK) 2534 if (tabstop_set(args->os_varp, &(curbuf->b_p_vts_array)) == OK)
2456 { 2535 {
2457 vim_free(oldarray); 2536 vim_free(oldarray);
2458 # ifdef FEAT_FOLDING 2537 # ifdef FEAT_FOLDING
2459 if (foldmethodIsIndent(curwin)) 2538 if (foldmethodIsIndent(curwin))
2460 foldUpdateAll(curwin); 2539 foldUpdateAll(curwin);
2466 2545
2467 return NULL; 2546 return NULL;
2468 } 2547 }
2469 #endif 2548 #endif
2470 2549
2471 #ifdef FEAT_PROP_POPUP 2550 #if defined(FEAT_PROP_POPUP) || defined(PROTO)
2472 /* 2551 /*
2473 * The 'previewpopup' option is changed. 2552 * The 'previewpopup' option is changed.
2474 */ 2553 */
2475 static char * 2554 char *
2476 did_set_previewpopup(void) 2555 did_set_previewpopup(optset_T *args UNUSED)
2477 { 2556 {
2478 if (parse_previewpopup(NULL) == FAIL) 2557 if (parse_previewpopup(NULL) == FAIL)
2479 return e_invalid_argument; 2558 return e_invalid_argument;
2480 2559
2481 return NULL; 2560 return NULL;
2482 } 2561 }
2483 2562
2484 # ifdef FEAT_QUICKFIX 2563 # if defined(FEAT_QUICKFIX) || defined(PROTO)
2485 /* 2564 /*
2486 * The 'completepopup' option is changed. 2565 * The 'completepopup' option is changed.
2487 */ 2566 */
2488 static char * 2567 char *
2489 did_set_completepopup(void) 2568 did_set_completepopup(optset_T *args UNUSED)
2490 { 2569 {
2491 if (parse_completepopup(NULL) == FAIL) 2570 if (parse_completepopup(NULL) == FAIL)
2492 return e_invalid_argument; 2571 return e_invalid_argument;
2493 2572
2494 popup_close_info(); 2573 popup_close_info();
2627 char * 2706 char *
2628 did_set_string_option( 2707 did_set_string_option(
2629 int opt_idx, // index in options[] table 2708 int opt_idx, // index in options[] table
2630 char_u **varp, // pointer to the option variable 2709 char_u **varp, // pointer to the option variable
2631 char_u *oldval, // previous value of the option 2710 char_u *oldval, // previous value of the option
2711 char_u *value, // new value of the option
2632 char *errbuf, // buffer for errors, or NULL 2712 char *errbuf, // buffer for errors, or NULL
2633 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL 2713 int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL
2634 int *value_checked) // value was checked to be safe, no 2714 int *value_checked) // value was checked to be safe, no
2635 // need to set P_INSECURE 2715 // need to set P_INSECURE
2636 { 2716 {
2637 char *errmsg = NULL; 2717 char *errmsg = NULL;
2638 int did_chartab = FALSE; 2718 int did_chartab = FALSE;
2639 char_u **gvarp; 2719 char_u **gvarp;
2640 long_u free_oldval = (get_option_flags(opt_idx) & P_ALLOCED); 2720 long_u free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
2641 #ifdef FEAT_GUI
2642 // set when changing an option that only requires a redraw in the GUI
2643 int redraw_gui_only = FALSE;
2644 #endif
2645 int value_changed = FALSE; 2721 int value_changed = FALSE;
2646 int did_swaptcap = FALSE; 2722 int did_swaptcap = FALSE;
2723 opt_did_set_cb_T did_set_cb = get_option_did_set_cb(opt_idx);
2647 2724
2648 // Get the global option to compare with, otherwise we would have to check 2725 // Get the global option to compare with, otherwise we would have to check
2649 // two values for all local options. 2726 // two values for all local options.
2650 gvarp = (char_u **)get_option_varp_scope(opt_idx, OPT_GLOBAL); 2727 gvarp = (char_u **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
2651 2728
2657 ) && (get_option_flags(opt_idx) & P_SECURE)) 2734 ) && (get_option_flags(opt_idx) & P_SECURE))
2658 errmsg = e_not_allowed_here; 2735 errmsg = e_not_allowed_here;
2659 // Check for a "normal" directory or file name in some options. 2736 // Check for a "normal" directory or file name in some options.
2660 else if (check_illegal_path_names(opt_idx, varp)) 2737 else if (check_illegal_path_names(opt_idx, varp))
2661 errmsg = e_invalid_argument; 2738 errmsg = e_invalid_argument;
2739 else if (did_set_cb != NULL)
2740 {
2741 optset_T args;
2742
2743 args.os_varp = *varp;
2744 args.os_flags = opt_flags;
2745 args.os_oldval.string = oldval;
2746 args.os_newval.string = value;
2747 errmsg = did_set_cb(&args);
2748 }
2662 else if (varp == &T_NAME) // 'term' 2749 else if (varp == &T_NAME) // 'term'
2663 errmsg = did_set_term(&opt_idx, &free_oldval); 2750 errmsg = did_set_term(&opt_idx, &free_oldval);
2664 else if (gvarp == &p_bkc) // 'backupcopy'
2665 errmsg = did_set_backupcopy(oldval, opt_flags);
2666 else if ( varp == &p_bex // 'backupext'
2667 || varp == &p_pm) // 'patchmode'
2668 errmsg = did_set_backupext_or_patchmode();
2669 #ifdef FEAT_LINEBREAK
2670 else if (varp == &curwin->w_p_briopt) // 'breakindentopt'
2671 errmsg = did_set_breakindentopt();
2672 #endif
2673
2674 else if ( varp == &p_isi // 'isident' 2751 else if ( varp == &p_isi // 'isident'
2675 || varp == &(curbuf->b_p_isk) // 'iskeyword' 2752 || varp == &(curbuf->b_p_isk) // 'iskeyword'
2676 || varp == &p_isp // 'isprint' 2753 || varp == &p_isp // 'isprint'
2677 || varp == &p_isf) // 'isfname' 2754 || varp == &p_isf) // 'isfname'
2678 errmsg = did_set_isopt(&did_chartab); 2755 errmsg = did_set_isopt(&did_chartab);
2679 else if (varp == &p_hf) // 'helpfile'
2680 did_set_helpfile();
2681 #ifdef FEAT_SYN_HL 2756 #ifdef FEAT_SYN_HL
2682 else if ( varp == &curwin->w_p_culopt // 'cursorlineopt' 2757 else if ( varp == &curwin->w_p_culopt // 'cursorlineopt'
2683 || gvarp == &curwin->w_allbuf_opt.wo_culopt) 2758 || gvarp == &curwin->w_allbuf_opt.wo_culopt)
2684 errmsg = did_set_cursorlineopt(varp); 2759 errmsg = did_set_cursorlineopt(varp);
2685 else if (varp == &curwin->w_p_cc) // 'colorcolumn' 2760 else if (varp == &curwin->w_p_cc) // 'colorcolumn'
2686 errmsg = check_colorcolumn(curwin); 2761 errmsg = check_colorcolumn(curwin);
2687 #endif 2762 #endif
2688 #ifdef FEAT_MULTI_LANG
2689 else if (varp == &p_hlg) // 'helplang'
2690 errmsg = did_set_helplang();
2691 #endif
2692 else if (varp == &p_hl) // 'highlight'
2693 errmsg = did_set_highlight();
2694 else if (gvarp == &p_nf) // 'nrformats' 2763 else if (gvarp == &p_nf) // 'nrformats'
2695 errmsg = did_set_opt_strings(*varp, p_nf_values, TRUE); 2764 errmsg = did_set_opt_strings(*varp, p_nf_values, TRUE);
2696 #ifdef FEAT_SESSION 2765 #ifdef FEAT_SESSION
2697 else if (varp == &p_ssop) // 'sessionoptions'
2698 errmsg = did_set_sessionoptions(oldval);
2699 else if (varp == &p_vop) // 'viewoptions' 2766 else if (varp == &p_vop) // 'viewoptions'
2700 errmsg = did_set_opt_flags(p_vop, p_ssop_values, &vop_flags, TRUE); 2767 errmsg = did_set_opt_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
2701 #endif 2768 #endif
2702 else if (varp == &p_sbo) // 'scrollopt' 2769 else if (varp == &p_sbo) // 'scrollopt'
2703 errmsg = did_set_opt_strings(p_sbo, p_scbopt_values, TRUE); 2770 errmsg = did_set_opt_strings(p_sbo, p_scbopt_values, TRUE);
2704 else if ( varp == &p_ambw // 'ambiwidth'
2705 || varp == &p_emoji) // 'emoji'
2706 errmsg = did_set_ambiwidth();
2707 else if (varp == &p_bg) // 'background'
2708 errmsg = did_set_background();
2709 else if (varp == &p_wim) // 'wildmode'
2710 errmsg = did_set_wildmode();
2711 else if (varp == &p_wop) // 'wildoptions' 2771 else if (varp == &p_wop) // 'wildoptions'
2712 errmsg = did_set_opt_strings(p_wop, p_wop_values, TRUE); 2772 errmsg = did_set_opt_strings(p_wop, p_wop_values, TRUE);
2713 #ifdef FEAT_WAK
2714 else if (varp == &p_wak) // 'winaltkeys'
2715 errmsg = did_set_winaltkeys();
2716 #endif
2717 else if (varp == &p_ei) // 'eventignore'
2718 errmsg = did_set_eventignore();
2719
2720 else if ( varp == &p_enc // 'encoding' 2773 else if ( varp == &p_enc // 'encoding'
2721 || gvarp == &p_fenc // 'fileencoding' 2774 || gvarp == &p_fenc // 'fileencoding'
2722 || varp == &p_tenc // 'termencoding' 2775 || varp == &p_tenc // 'termencoding'
2723 || gvarp == &p_menc) // 'makeencoding' 2776 || gvarp == &p_menc) // 'makeencoding'
2724 errmsg = did_set_encoding(varp, gvarp, opt_flags); 2777 errmsg = did_set_encoding(varp, gvarp, opt_flags);
2725 #if defined(FEAT_POSTSCRIPT)
2726 else if (varp == &p_penc) // 'printencoding'
2727 did_set_printencoding();
2728 #endif
2729 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
2730 else if (varp == &p_imak) // 'imactivatekey'
2731 errmsg = did_set_imactivatekey();
2732 #endif
2733 #ifdef FEAT_KEYMAP 2778 #ifdef FEAT_KEYMAP
2734 else if (varp == &curbuf->b_p_keymap) // 'keymap' 2779 else if (varp == &curbuf->b_p_keymap) // 'keymap'
2735 errmsg = did_set_keymap(varp, opt_flags, value_checked); 2780 errmsg = did_set_keymap(varp, opt_flags, value_checked);
2736 #endif 2781 #endif
2737 else if (gvarp == &p_ff) // 'fileformat'
2738 errmsg = did_set_fileformat(varp, oldval, opt_flags);
2739 else if (varp == &p_ffs) // 'fileformats'
2740 errmsg = did_set_fileformats();
2741 #if defined(FEAT_CRYPT)
2742 else if (gvarp == &p_key) // 'cryptkey'
2743 did_set_cryptkey(oldval);
2744 else if (gvarp == &p_cm) // 'cryptmethod'
2745 errmsg = did_set_cryptmethod(oldval, opt_flags);
2746 #endif
2747 else if (gvarp == &p_mps) // 'matchpairs'
2748 errmsg = did_set_matchpairs(varp);
2749 else if (gvarp == &p_com) // 'comments' 2782 else if (gvarp == &p_com) // 'comments'
2750 errmsg = did_set_comments(varp, errbuf); 2783 errmsg = did_set_comments(varp, errbuf);
2751 else if ( varp == &p_lcs // global 'listchars' 2784 else if ( varp == &p_lcs // global 'listchars'
2752 || varp == &p_fcs) // global 'fillchars' 2785 || varp == &p_fcs) // global 'fillchars'
2753 errmsg = did_set_global_listfillchars(varp, opt_flags); 2786 errmsg = did_set_global_listfillchars(varp, opt_flags);
2754 else if (varp == &curwin->w_p_lcs) // local 'listchars' 2787 else if (varp == &curwin->w_p_lcs) // local 'listchars'
2755 errmsg = set_chars_option(curwin, varp, TRUE); 2788 errmsg = set_chars_option(curwin, varp, TRUE);
2756 else if (varp == &curwin->w_p_fcs) // local 'fillchars' 2789 else if (varp == &curwin->w_p_fcs) // local 'fillchars'
2757 errmsg = set_chars_option(curwin, varp, TRUE); 2790 errmsg = set_chars_option(curwin, varp, TRUE);
2758 else if (varp == &p_cedit) // 'cedit'
2759 errmsg = check_cedit();
2760 else if (varp == &p_vfile) // 'verbosefile'
2761 errmsg = did_set_verbosefile();
2762 #ifdef FEAT_VIMINFO 2791 #ifdef FEAT_VIMINFO
2763 else if (varp == &p_viminfo) // 'viminfo' 2792 else if (varp == &p_viminfo) // 'viminfo'
2764 errmsg = did_set_viminfo(errbuf); 2793 errmsg = did_set_viminfo(errbuf);
2765 #endif // FEAT_VIMINFO 2794 #endif // FEAT_VIMINFO
2766 // terminal options 2795 // terminal options
2767 else if (istermoption_idx(opt_idx) && full_screen) 2796 else if (istermoption_idx(opt_idx) && full_screen)
2768 did_set_term_option(varp, &did_swaptcap); 2797 did_set_term_option(varp, &did_swaptcap);
2769 #ifdef FEAT_LINEBREAK
2770 else if (gvarp == &p_sbr) // 'showbreak'
2771 errmsg = did_set_showbreak(varp);
2772 #endif
2773 #ifdef FEAT_GUI
2774 else if (varp == &p_guifont) // 'guifont'
2775 {
2776 errmsg = did_set_guifont(oldval);
2777 redraw_gui_only = TRUE;
2778 }
2779 # ifdef FEAT_XFONTSET
2780 else if (varp == &p_guifontset) // 'guifontset'
2781 {
2782 errmsg = did_set_guifontset();
2783 redraw_gui_only = TRUE;
2784 }
2785 # endif
2786 else if (varp == &p_guifontwide) // 'guifontwide'
2787 {
2788 errmsg = did_set_guifontwide();
2789 redraw_gui_only = TRUE;
2790 }
2791 #endif
2792 #if defined(FEAT_GUI_GTK)
2793 else if (varp == &p_guiligatures) // 'guiligatures'
2794 {
2795 did_set_guiligatures();
2796 redraw_gui_only = TRUE;
2797 }
2798 #endif
2799 #ifdef CURSOR_SHAPE 2798 #ifdef CURSOR_SHAPE
2800 else if (varp == &p_guicursor) // 'guicursor' 2799 else if (varp == &p_guicursor) // 'guicursor'
2801 errmsg = parse_shape_opt(SHAPE_CURSOR); 2800 errmsg = parse_shape_opt(SHAPE_CURSOR);
2802 #endif 2801 #endif
2803 #ifdef FEAT_MOUSESHAPE
2804 else if (varp == &p_mouseshape) // 'mouseshape'
2805 errmsg = did_set_mouseshape();
2806 #endif
2807 #ifdef FEAT_PRINTER
2808 else if (varp == &p_popt) // 'printoptions'
2809 errmsg = parse_printoptions();
2810 # if defined(FEAT_POSTSCRIPT)
2811 else if (varp == &p_pmfn) // 'printmbfont'
2812 errmsg = parse_printmbfont();
2813 # endif
2814 #endif
2815 #ifdef FEAT_LANGMAP
2816 else if (varp == &p_langmap) // 'langmap'
2817 langmap_set();
2818 #endif
2819 #ifdef FEAT_LINEBREAK
2820 else if (varp == &p_breakat) // 'breakat'
2821 fill_breakat_flags();
2822 #endif
2823 else if ( varp == &p_titlestring // 'titlestring'
2824 || varp == &p_iconstring) // 'iconstring'
2825 did_set_titleiconstring(varp);
2826 #ifdef FEAT_GUI
2827 else if (varp == &p_go) // 'guioptions'
2828 {
2829 did_set_guioptions(oldval);
2830 redraw_gui_only = TRUE;
2831 }
2832 #endif
2833 #if defined(FEAT_GUI_TABLINE)
2834 else if (varp == &p_gtl) // 'guitablabel'
2835 {
2836 did_set_guitablabel();
2837 redraw_gui_only = TRUE;
2838 }
2839 else if (varp == &p_gtt) // 'guitabtooltip'
2840 redraw_gui_only = TRUE;
2841 #endif
2842 #if defined(UNIX) || defined(VMS)
2843 else if (varp == &p_ttym) // 'ttymouse'
2844 errmsg = did_set_ttymouse();
2845 #endif
2846 else if (varp == &p_sel) // 'selection'
2847 errmsg = did_set_selection();
2848 else if (varp == &p_slm) // 'selectmode' 2802 else if (varp == &p_slm) // 'selectmode'
2849 errmsg = did_set_opt_strings(p_slm, p_slm_values, TRUE); 2803 errmsg = did_set_opt_strings(p_slm, p_slm_values, TRUE);
2850 #ifdef FEAT_BROWSE
2851 else if (varp == &p_bsdir) // 'browsedir'
2852 errmsg = did_set_browsedir();
2853 #endif
2854 else if (varp == &p_km) // 'keymodel'
2855 errmsg = did_set_keymodel();
2856 else if (varp == &p_kpc) // 'keyprotocol'
2857 errmsg = did_set_keyprotocol();
2858 else if (varp == &p_mousem) // 'mousemodel'
2859 errmsg = did_set_mousemodel();
2860 else if (varp == &p_swb) // 'switchbuf' 2804 else if (varp == &p_swb) // 'switchbuf'
2861 errmsg = did_set_opt_flags(p_swb, p_swb_values, &swb_flags, TRUE); 2805 errmsg = did_set_opt_flags(p_swb, p_swb_values, &swb_flags, TRUE);
2862 else if (varp == &p_spk) // 'splitkeep' 2806 else if (varp == &p_spk) // 'splitkeep'
2863 errmsg = did_set_opt_strings(p_spk, p_spk_values, FALSE); 2807 errmsg = did_set_opt_strings(p_spk, p_spk_values, FALSE);
2864 else if (varp == &p_debug) // 'debug' 2808 else if (varp == &p_debug) // 'debug'
2865 errmsg = did_set_opt_strings(p_debug, p_debug_values, TRUE); 2809 errmsg = did_set_opt_strings(p_debug, p_debug_values, TRUE);
2866 else if (varp == &p_dy) // 'display'
2867 errmsg = did_set_display();
2868 else if (varp == &p_ead) // 'eadirection' 2810 else if (varp == &p_ead) // 'eadirection'
2869 errmsg = did_set_opt_strings(p_ead, p_ead_values, FALSE); 2811 errmsg = did_set_opt_strings(p_ead, p_ead_values, FALSE);
2870 #ifdef FEAT_CLIPBOARD
2871 else if (varp == &p_cb) // 'clipboard'
2872 errmsg = check_clipboard_option();
2873 #endif
2874 #ifdef FEAT_SPELL
2875 else if (varp == &(curwin->w_s->b_p_spf)) // 'spellfile'
2876 errmsg = did_set_spellfile(varp);
2877 else if (varp == &(curwin->w_s->b_p_spl)) // 'spell'
2878 errmsg = did_set_spell(varp);
2879 else if (varp == &(curwin->w_s->b_p_spc)) // 'spellcapcheck'
2880 errmsg = did_set_spellcapcheck();
2881 else if (varp == &(curwin->w_s->b_p_spo)) // 'spelloptions'
2882 errmsg = did_set_spelloptions(varp);
2883 else if (varp == &p_sps) // 'spellsuggest'
2884 errmsg = did_set_spellsuggest();
2885 else if (varp == &p_msm) // 'mkspellmem'
2886 errmsg = did_set_mkspellmem();
2887 #endif
2888 else if (gvarp == &p_bh) // 'bufhidden' 2812 else if (gvarp == &p_bh) // 'bufhidden'
2889 errmsg = did_set_opt_strings(curbuf->b_p_bh, p_bufhidden_values, 2813 errmsg = did_set_opt_strings(curbuf->b_p_bh, p_bufhidden_values,
2890 FALSE); 2814 FALSE);
2891 else if (gvarp == &p_bt) // 'buftype'
2892 errmsg = did_set_buftype();
2893 #ifdef FEAT_STL_OPT
2894 else if ( gvarp == &p_stl // 'statusline'
2895 || varp == &p_tal // 'tabline'
2896 || varp == &p_ruf) // 'rulerformat'
2897 errmsg = did_set_statusline(varp);
2898 #endif
2899 else if (gvarp == &p_cpt) // 'complete' 2815 else if (gvarp == &p_cpt) // 'complete'
2900 errmsg = did_set_complete(varp, errbuf); 2816 errmsg = did_set_complete(varp, errbuf);
2901 else if (varp == &p_cot) // 'completeopt'
2902 errmsg = did_set_completeopt();
2903 #ifdef BACKSLASH_IN_FILENAME
2904 else if (gvarp == &p_csl) // 'completeslash'
2905 errmsg = did_set_completeslash();
2906 #endif
2907 #ifdef FEAT_SIGNS
2908 else if (varp == &curwin->w_p_scl) // 'signcolumn'
2909 errmsg = did_set_signcolumn(varp, oldval);
2910 #endif
2911 else if (varp == &p_sloc) // 'showcmdloc' 2817 else if (varp == &p_sloc) // 'showcmdloc'
2912 errmsg = did_set_opt_strings(p_sloc, p_sloc_values, FALSE); 2818 errmsg = did_set_opt_strings(p_sloc, p_sloc_values, FALSE);
2913 #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)
2914 else if (varp == &p_toolbar) // 'toolbar'
2915 errmsg = did_set_toolbar();
2916 #endif
2917 #if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
2918 else if (varp == &p_tbis) // 'toolbariconsize'
2919 errmsg = did_set_toolbariconsize();
2920 #endif
2921 else if (varp == &p_pt) // 'pastetoggle'
2922 did_set_pastetoggle();
2923 else if (varp == &p_bs) // 'backspace'
2924 errmsg = did_set_backspace();
2925 else if (varp == &p_bo) // 'belloff' 2819 else if (varp == &p_bo) // 'belloff'
2926 errmsg = did_set_opt_flags(p_bo, p_bo_values, &bo_flags, TRUE); 2820 errmsg = did_set_opt_flags(p_bo, p_bo_values, &bo_flags, TRUE);
2927 else if (gvarp == &p_tc) // 'tagcase'
2928 errmsg = did_set_tagcase(opt_flags);
2929 else if (varp == &p_cmp) // 'casemap' 2821 else if (varp == &p_cmp) // 'casemap'
2930 errmsg = did_set_opt_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE); 2822 errmsg = did_set_opt_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
2931 #ifdef FEAT_DIFF
2932 else if (varp == &p_dip) // 'diffopt'
2933 errmsg = did_set_diffopt();
2934 #endif
2935 #ifdef FEAT_FOLDING 2823 #ifdef FEAT_FOLDING
2936 else if (gvarp == &curwin->w_allbuf_opt.wo_fdm) // 'foldmethod'
2937 errmsg = did_set_foldmethod(varp);
2938 else if (gvarp == &curwin->w_allbuf_opt.wo_fmr) // 'foldmarker'
2939 errmsg = did_set_foldmarker(varp);
2940 else if (gvarp == &p_cms) // 'commentstring'
2941 errmsg = did_set_commentstring(varp);
2942 else if (varp == &p_fdo) // 'foldopen' 2824 else if (varp == &p_fdo) // 'foldopen'
2943 errmsg = did_set_opt_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE); 2825 errmsg = did_set_opt_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
2944 else if (varp == &p_fcl) // 'foldclose' 2826 else if (varp == &p_fcl) // 'foldclose'
2945 errmsg = did_set_opt_strings(p_fcl, p_fcl_values, TRUE); 2827 errmsg = did_set_opt_strings(p_fcl, p_fcl_values, TRUE);
2946 else if (gvarp == &curwin->w_allbuf_opt.wo_fdi) // 'foldignore'
2947 did_set_foldignore();
2948 #endif
2949 else if (gvarp == &p_ve) // 'virtualedit'
2950 errmsg = did_set_virtualedit(oldval, opt_flags);
2951 #if defined(FEAT_CSCOPE) && defined(FEAT_QUICKFIX)
2952 else if (varp == &p_csqf) // 'cscopequickfix'
2953 errmsg = did_set_cscopequickfix();
2954 #endif
2955 else if (gvarp == &p_cino) // 'cinoptions'
2956 did_set_cinoptions();
2957 else if (gvarp == &p_lop) // 'lispoptions'
2958 errmsg = did_set_lispoptions(varp);
2959 #if defined(FEAT_RENDER_OPTIONS)
2960 else if (varp == &p_rop) // 'renderoptions'
2961 errmsg = did_set_renderoptions();
2962 #endif 2828 #endif
2963 else if (gvarp == &p_ft) // 'filetype' 2829 else if (gvarp == &p_ft) // 'filetype'
2964 errmsg = did_set_filetype_or_syntax(varp, oldval, value_checked, 2830 errmsg = did_set_filetype_or_syntax(varp, oldval, value_checked,
2965 &value_changed); 2831 &value_changed);
2966 #ifdef FEAT_SYN_HL 2832 #ifdef FEAT_SYN_HL
2967 else if (gvarp == &p_syn) // 'syntax' 2833 else if (gvarp == &p_syn) // 'syntax'
2968 errmsg = did_set_filetype_or_syntax(varp, oldval, value_checked, 2834 errmsg = did_set_filetype_or_syntax(varp, oldval, value_checked,
2969 &value_changed); 2835 &value_changed);
2970 #endif 2836 #endif
2971 #ifdef FEAT_TERMINAL 2837 #ifdef FEAT_TERMINAL
2972 else if (varp == &curwin->w_p_twk) // 'termwinkey'
2973 errmsg = did_set_termwinkey();
2974 else if (varp == &curwin->w_p_tws) // 'termwinsize'
2975 errmsg = did_set_termwinsize();
2976 else if (varp == &curwin->w_p_wcr) // 'wincolor' 2838 else if (varp == &curwin->w_p_wcr) // 'wincolor'
2977 term_update_wincolor(curwin); 2839 term_update_wincolor(curwin);
2978 # if defined(MSWIN) 2840 # if defined(MSWIN)
2979 else if (varp == &p_twt) // 'termwintype' 2841 else if (varp == &p_twt) // 'termwintype'
2980 errmsg = did_set_opt_strings(p_twt, p_twt_values, FALSE); 2842 errmsg = did_set_opt_strings(p_twt, p_twt_values, FALSE);
2981 # endif
2982 #endif
2983 #ifdef FEAT_VARTABS
2984 else if (varp == &(curbuf->b_p_vsts)) // 'varsofttabstop'
2985 errmsg = did_set_varsofttabstop(varp);
2986 else if (varp == &(curbuf->b_p_vts)) // 'vartabstop'
2987 errmsg = did_set_vartabstop(varp);
2988 #endif
2989 #ifdef FEAT_PROP_POPUP
2990 else if (varp == &p_pvp) // 'previewpopup'
2991 errmsg = did_set_previewpopup();
2992 # ifdef FEAT_QUICKFIX
2993 else if (varp == &p_cpp) // 'completepopup'
2994 errmsg = did_set_completepopup();
2995 # endif 2843 # endif
2996 #endif 2844 #endif
2997 #ifdef FEAT_EVAL 2845 #ifdef FEAT_EVAL
2998 else if ( 2846 else if (
2999 # ifdef FEAT_BEVAL 2847 # ifdef FEAT_BEVAL
3018 varp == &p_pexpr || // 'printexpr' 2866 varp == &p_pexpr || // 'printexpr'
3019 # endif 2867 # endif
3020 varp == &p_ccv) // 'charconvert' 2868 varp == &p_ccv) // 'charconvert'
3021 did_set_optexpr(varp); 2869 did_set_optexpr(varp);
3022 #endif 2870 #endif
3023 #ifdef FEAT_COMPL_FUNC
3024 else if (gvarp == &p_cfu) // 'completefunc'
3025 errmsg = set_completefunc_option();
3026 else if (gvarp == &p_ofu) // 'omnifunc'
3027 errmsg = set_omnifunc_option();
3028 else if (gvarp == &p_tsrfu) // 'thesaurusfunc'
3029 errmsg = set_thesaurusfunc_option();
3030 #endif
3031 #if defined(FEAT_EVAL) && \
3032 (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL))
3033 else if (gvarp == &p_imaf) // 'imactivatefunc'
3034 errmsg = set_imactivatefunc_option();
3035 else if (gvarp == &p_imsf) // 'imstatusfunc'
3036 errmsg = set_imstatusfunc_option();
3037 #endif
3038 else if (varp == &p_opfunc) // 'operatorfunc'
3039 errmsg = set_operatorfunc_option();
3040 #ifdef FEAT_QUICKFIX
3041 else if (varp == &p_qftf) // 'quickfixtextfunc'
3042 errmsg = qf_process_qftf_option();
3043 #endif
3044 #ifdef FEAT_EVAL
3045 else if (gvarp == &p_tfu) // 'tagfunc'
3046 errmsg = set_tagfunc_option();
3047 #endif
3048 else if (varp == &p_ww) // 'whichwrap' 2871 else if (varp == &p_ww) // 'whichwrap'
3049 errmsg = did_set_option_listflag(varp, (char_u *)WW_ALL, errbuf); 2872 errmsg = did_set_option_listflag(varp, (char_u *)WW_ALL, errbuf);
3050 else if (varp == &p_shm) // 'shortmess' 2873 else if (varp == &p_shm) // 'shortmess'
3051 errmsg = did_set_option_listflag(varp, (char_u *)SHM_ALL, errbuf); 2874 errmsg = did_set_option_listflag(varp, (char_u *)SHM_ALL, errbuf);
3052 else if (varp == &(p_cpo)) // 'cpoptions' 2875 else if (varp == &(p_cpo)) // 'cpoptions'
3141 curwin->w_set_curswant = TRUE; 2964 curwin->w_set_curswant = TRUE;
3142 2965
3143 if ((opt_flags & OPT_NO_REDRAW) == 0) 2966 if ((opt_flags & OPT_NO_REDRAW) == 0)
3144 { 2967 {
3145 #ifdef FEAT_GUI 2968 #ifdef FEAT_GUI
2969 // set when changing an option that only requires a redraw in the GUI
2970 int redraw_gui_only = FALSE;
2971
2972 if (varp == &p_go // 'guioptions'
2973 || varp == &p_guifont // 'guifont'
2974 # ifdef FEAT_GUI_TABLINE
2975 || varp == &p_gtl // 'guitablabel'
2976 || varp == &p_gtt // 'guitabtooltip'
2977 # endif
2978 # ifdef FEAT_XFONTSET
2979 || varp == &p_guifontset // 'guifontset'
2980 # endif
2981 || varp == &p_guifontwide // 'guifontwide'
2982 # ifdef FEAT_GUI_GTK
2983 || varp == &p_guiligatures // 'guiligatures'
2984 # endif
2985 )
2986 redraw_gui_only = TRUE;
2987
3146 // check redraw when it's not a GUI option or the GUI is active. 2988 // check redraw when it's not a GUI option or the GUI is active.
3147 if (!redraw_gui_only || gui.in_use) 2989 if (!redraw_gui_only || gui.in_use)
3148 #endif 2990 #endif
3149 check_redraw(get_option_flags(opt_idx)); 2991 check_redraw(get_option_flags(opt_idx));
3150 } 2992 }
3224 { 3066 {
3225 return check_opt_strings(p, p_ff_values, FALSE); 3067 return check_opt_strings(p, p_ff_values, FALSE);
3226 } 3068 }
3227 3069
3228 /* 3070 /*
3229 * Save the acutal shortmess Flags and clear them 3071 * Save the actual shortmess Flags and clear them temporarily to avoid that
3230 * temporarily to avoid that file messages 3072 * file messages overwrites any output from the following commands.
3231 * overwrites any output from the following commands.
3232 * 3073 *
3233 * Caller must make sure to first call save_clear_shm_value() and then 3074 * Caller must make sure to first call save_clear_shm_value() and then
3234 * restore_shm_value() exactly the same number of times. 3075 * restore_shm_value() exactly the same number of times.
3235 */ 3076 */
3236 void 3077 void