comparison src/option.c @ 15597:536dd2bc5ac9 v8.1.0806

patch 8.1.0806: too many #ifdefs commit https://github.com/vim/vim/commit/fc3abf47fbe1e426f2b676c316c81ee9ff607075 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 24 15:54:21 2019 +0100 patch 8.1.0806: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 2.
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Jan 2019 16:00:08 +0100
parents d89c5b339c2a
children 90f01701ecad
comparison
equal deleted inserted replaced
15596:d614c94f60fd 15597:536dd2bc5ac9
64 # define PV_GP OPT_BOTH(OPT_BUF(BV_GP)) 64 # define PV_GP OPT_BOTH(OPT_BUF(BV_GP))
65 # define PV_MP OPT_BOTH(OPT_BUF(BV_MP)) 65 # define PV_MP OPT_BOTH(OPT_BUF(BV_MP))
66 #endif 66 #endif
67 #define PV_BIN OPT_BUF(BV_BIN) 67 #define PV_BIN OPT_BUF(BV_BIN)
68 #define PV_BL OPT_BUF(BV_BL) 68 #define PV_BL OPT_BUF(BV_BL)
69 #ifdef FEAT_MBYTE 69 #define PV_BOMB OPT_BUF(BV_BOMB)
70 # define PV_BOMB OPT_BUF(BV_BOMB)
71 #endif
72 #define PV_CI OPT_BUF(BV_CI) 70 #define PV_CI OPT_BUF(BV_CI)
73 #ifdef FEAT_CINDENT 71 #ifdef FEAT_CINDENT
74 # define PV_CIN OPT_BUF(BV_CIN) 72 # define PV_CIN OPT_BUF(BV_CIN)
75 # define PV_CINK OPT_BUF(BV_CINK) 73 # define PV_CINK OPT_BUF(BV_CINK)
76 # define PV_CINO OPT_BUF(BV_CINO) 74 # define PV_CINO OPT_BUF(BV_CINO)
99 #endif 97 #endif
100 #define PV_EOL OPT_BUF(BV_EOL) 98 #define PV_EOL OPT_BUF(BV_EOL)
101 #define PV_FIXEOL OPT_BUF(BV_FIXEOL) 99 #define PV_FIXEOL OPT_BUF(BV_FIXEOL)
102 #define PV_EP OPT_BOTH(OPT_BUF(BV_EP)) 100 #define PV_EP OPT_BOTH(OPT_BUF(BV_EP))
103 #define PV_ET OPT_BUF(BV_ET) 101 #define PV_ET OPT_BUF(BV_ET)
104 #ifdef FEAT_MBYTE 102 #define PV_FENC OPT_BUF(BV_FENC)
105 # define PV_FENC OPT_BUF(BV_FENC)
106 #endif
107 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) 103 #if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
108 # define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR)) 104 # define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR))
109 #endif 105 #endif
110 #define PV_FP OPT_BOTH(OPT_BUF(BV_FP)) 106 #define PV_FP OPT_BOTH(OPT_BUF(BV_FP))
111 #ifdef FEAT_EVAL 107 #ifdef FEAT_EVAL
135 #define PV_KP OPT_BOTH(OPT_BUF(BV_KP)) 131 #define PV_KP OPT_BOTH(OPT_BUF(BV_KP))
136 #ifdef FEAT_LISP 132 #ifdef FEAT_LISP
137 # define PV_LISP OPT_BUF(BV_LISP) 133 # define PV_LISP OPT_BUF(BV_LISP)
138 # define PV_LW OPT_BOTH(OPT_BUF(BV_LW)) 134 # define PV_LW OPT_BOTH(OPT_BUF(BV_LW))
139 #endif 135 #endif
140 #ifdef FEAT_MBYTE 136 #define PV_MENC OPT_BOTH(OPT_BUF(BV_MENC))
141 # define PV_MENC OPT_BOTH(OPT_BUF(BV_MENC))
142 #endif
143 #define PV_MA OPT_BUF(BV_MA) 137 #define PV_MA OPT_BUF(BV_MA)
144 #define PV_ML OPT_BUF(BV_ML) 138 #define PV_ML OPT_BUF(BV_ML)
145 #define PV_MOD OPT_BUF(BV_MOD) 139 #define PV_MOD OPT_BUF(BV_MOD)
146 #define PV_MPS OPT_BUF(BV_MPS) 140 #define PV_MPS OPT_BUF(BV_MPS)
147 #define PV_NF OPT_BUF(BV_NF) 141 #define PV_NF OPT_BUF(BV_NF)
279 * These are the global values for options which are also local to a buffer. 273 * These are the global values for options which are also local to a buffer.
280 * Only to be used in option.c! 274 * Only to be used in option.c!
281 */ 275 */
282 static int p_ai; 276 static int p_ai;
283 static int p_bin; 277 static int p_bin;
284 #ifdef FEAT_MBYTE
285 static int p_bomb; 278 static int p_bomb;
286 #endif
287 static char_u *p_bh; 279 static char_u *p_bh;
288 static char_u *p_bt; 280 static char_u *p_bt;
289 static int p_bl; 281 static int p_bl;
290 static int p_ci; 282 static int p_ci;
291 #ifdef FEAT_CINDENT 283 #ifdef FEAT_CINDENT
310 static char_u *p_ofu; 302 static char_u *p_ofu;
311 #endif 303 #endif
312 static int p_eol; 304 static int p_eol;
313 static int p_fixeol; 305 static int p_fixeol;
314 static int p_et; 306 static int p_et;
315 #ifdef FEAT_MBYTE
316 static char_u *p_fenc; 307 static char_u *p_fenc;
317 #endif
318 static char_u *p_ff; 308 static char_u *p_ff;
319 static char_u *p_fo; 309 static char_u *p_fo;
320 static char_u *p_flp; 310 static char_u *p_flp;
321 static char_u *p_ft; 311 static char_u *p_ft;
322 static long p_iminsert; 312 static long p_iminsert;
552 #else 542 #else
553 (char_u *)NULL, PV_NONE, 543 (char_u *)NULL, PV_NONE,
554 #endif 544 #endif
555 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 545 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
556 {"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR, 546 {"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR,
557 #if defined(FEAT_MBYTE)
558 (char_u *)&p_ambw, PV_NONE, 547 (char_u *)&p_ambw, PV_NONE,
559 {(char_u *)"single", (char_u *)0L} 548 {(char_u *)"single", (char_u *)0L}
560 #else
561 (char_u *)NULL, PV_NONE,
562 {(char_u *)0L, (char_u *)0L}
563 #endif
564 SCTX_INIT}, 549 SCTX_INIT},
565 {"autochdir", "acd", P_BOOL|P_VI_DEF, 550 {"autochdir", "acd", P_BOOL|P_VI_DEF,
566 #ifdef FEAT_AUTOCHDIR 551 #ifdef FEAT_AUTOCHDIR
567 (char_u *)&p_acd, PV_NONE, 552 (char_u *)&p_acd, PV_NONE,
568 {(char_u *)FALSE, (char_u *)0L} 553 {(char_u *)FALSE, (char_u *)0L}
678 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 663 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
679 {"bioskey", "biosk",P_BOOL|P_VI_DEF, 664 {"bioskey", "biosk",P_BOOL|P_VI_DEF,
680 (char_u *)NULL, PV_NONE, 665 (char_u *)NULL, PV_NONE,
681 {(char_u *)TRUE, (char_u *)0L} SCTX_INIT}, 666 {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
682 {"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT, 667 {"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
683 #ifdef FEAT_MBYTE
684 (char_u *)&p_bomb, PV_BOMB, 668 (char_u *)&p_bomb, PV_BOMB,
685 #else
686 (char_u *)NULL, PV_NONE,
687 #endif
688 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 669 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
689 {"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST, 670 {"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
690 #ifdef FEAT_LINEBREAK 671 #ifdef FEAT_LINEBREAK
691 (char_u *)&p_breakat, PV_NONE, 672 (char_u *)&p_breakat, PV_NONE,
692 {(char_u *)" \t!@*-+;:,./?", (char_u *)0L} 673 {(char_u *)" \t!@*-+;:,./?", (char_u *)0L}
734 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, 715 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB,
735 (char_u *)&p_bt, PV_BT, 716 (char_u *)&p_bt, PV_BT,
736 {(char_u *)"", (char_u *)0L} 717 {(char_u *)"", (char_u *)0L}
737 SCTX_INIT}, 718 SCTX_INIT},
738 {"casemap", "cmp", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, 719 {"casemap", "cmp", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
739 #ifdef FEAT_MBYTE
740 (char_u *)&p_cmp, PV_NONE, 720 (char_u *)&p_cmp, PV_NONE,
741 {(char_u *)"internal,keepascii", (char_u *)0L} 721 {(char_u *)"internal,keepascii", (char_u *)0L}
742 #else
743 (char_u *)NULL, PV_NONE,
744 {(char_u *)0L, (char_u *)0L}
745 #endif
746 SCTX_INIT}, 722 SCTX_INIT},
747 {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP, 723 {"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
748 #ifdef FEAT_SEARCHPATH 724 #ifdef FEAT_SEARCHPATH
749 (char_u *)&p_cdpath, PV_NONE, 725 (char_u *)&p_cdpath, PV_NONE,
750 {(char_u *)",,", (char_u *)0L} 726 {(char_u *)",,", (char_u *)0L}
761 (char_u *)NULL, PV_NONE, 737 (char_u *)NULL, PV_NONE,
762 {(char_u *)0L, (char_u *)0L} 738 {(char_u *)0L, (char_u *)0L}
763 #endif 739 #endif
764 SCTX_INIT}, 740 SCTX_INIT},
765 {"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE, 741 {"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE,
766 #if defined(FEAT_MBYTE) && defined(FEAT_EVAL) 742 #if defined(FEAT_EVAL)
767 (char_u *)&p_ccv, PV_NONE, 743 (char_u *)&p_ccv, PV_NONE,
768 {(char_u *)"", (char_u *)0L} 744 {(char_u *)"", (char_u *)0L}
769 #else 745 #else
770 (char_u *)NULL, PV_NONE, 746 (char_u *)NULL, PV_NONE,
771 {(char_u *)0L, (char_u *)0L} 747 {(char_u *)0L, (char_u *)0L}
1014 (char_u *)NULL, PV_NONE, 990 (char_u *)NULL, PV_NONE,
1015 {(char_u *)NULL, (char_u *)0L} 991 {(char_u *)NULL, (char_u *)0L}
1016 #endif 992 #endif
1017 SCTX_INIT}, 993 SCTX_INIT},
1018 {"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM, 994 {"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM,
1019 #ifdef FEAT_MBYTE
1020 (char_u *)&p_deco, PV_NONE, 995 (char_u *)&p_deco, PV_NONE,
1021 #else
1022 (char_u *)NULL, PV_NONE,
1023 #endif
1024 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 996 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
1025 {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, 997 {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME,
1026 #ifdef FEAT_INS_EXPAND 998 #ifdef FEAT_INS_EXPAND
1027 (char_u *)&p_dict, PV_DICT, 999 (char_u *)&p_dict, PV_DICT,
1028 #else 1000 #else
1075 SCTX_INIT}, 1047 SCTX_INIT},
1076 {"edcompatible","ed", P_BOOL|P_VI_DEF, 1048 {"edcompatible","ed", P_BOOL|P_VI_DEF,
1077 (char_u *)&p_ed, PV_NONE, 1049 (char_u *)&p_ed, PV_NONE,
1078 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 1050 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
1079 {"emoji", "emo", P_BOOL|P_VI_DEF|P_RCLR, 1051 {"emoji", "emo", P_BOOL|P_VI_DEF|P_RCLR,
1080 #if defined(FEAT_MBYTE)
1081 (char_u *)&p_emoji, PV_NONE, 1052 (char_u *)&p_emoji, PV_NONE,
1082 {(char_u *)TRUE, (char_u *)0L} 1053 {(char_u *)TRUE, (char_u *)0L}
1083 #else
1084 (char_u *)NULL, PV_NONE,
1085 {(char_u *)0L, (char_u *)0L}
1086 #endif
1087 SCTX_INIT}, 1054 SCTX_INIT},
1088 {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR|P_NO_ML, 1055 {"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR|P_NO_ML,
1089 #ifdef FEAT_MBYTE
1090 (char_u *)&p_enc, PV_NONE, 1056 (char_u *)&p_enc, PV_NONE,
1091 {(char_u *)ENC_DFLT, (char_u *)0L} 1057 {(char_u *)ENC_DFLT, (char_u *)0L}
1092 #else
1093 (char_u *)NULL, PV_NONE,
1094 {(char_u *)0L, (char_u *)0L}
1095 #endif
1096 SCTX_INIT}, 1058 SCTX_INIT},
1097 {"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT, 1059 {"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
1098 (char_u *)&p_eol, PV_EOL, 1060 (char_u *)&p_eol, PV_EOL,
1099 {(char_u *)TRUE, (char_u *)0L} SCTX_INIT}, 1061 {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
1100 {"equalalways", "ea", P_BOOL|P_VI_DEF|P_RALL, 1062 {"equalalways", "ea", P_BOOL|P_VI_DEF|P_RALL,
1136 {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE, 1098 {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE,
1137 (char_u *)&p_exrc, PV_NONE, 1099 (char_u *)&p_exrc, PV_NONE,
1138 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 1100 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
1139 {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF 1101 {"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF
1140 |P_NO_MKRC, 1102 |P_NO_MKRC,
1141 #ifdef FEAT_MBYTE
1142 (char_u *)&p_fenc, PV_FENC, 1103 (char_u *)&p_fenc, PV_FENC,
1143 {(char_u *)"", (char_u *)0L} 1104 {(char_u *)"", (char_u *)0L}
1144 #else
1145 (char_u *)NULL, PV_NONE,
1146 {(char_u *)0L, (char_u *)0L}
1147 #endif
1148 SCTX_INIT}, 1105 SCTX_INIT},
1149 {"fileencodings","fencs", P_STRING|P_VI_DEF|P_ONECOMMA, 1106 {"fileencodings","fencs", P_STRING|P_VI_DEF|P_ONECOMMA,
1150 #ifdef FEAT_MBYTE
1151 (char_u *)&p_fencs, PV_NONE, 1107 (char_u *)&p_fencs, PV_NONE,
1152 {(char_u *)"ucs-bom", (char_u *)0L} 1108 {(char_u *)"ucs-bom", (char_u *)0L}
1153 #else
1154 (char_u *)NULL, PV_NONE,
1155 {(char_u *)0L, (char_u *)0L}
1156 #endif
1157 SCTX_INIT}, 1109 SCTX_INIT},
1158 {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC 1110 {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC
1159 |P_CURSWANT, 1111 |P_CURSWANT,
1160 (char_u *)&p_ff, PV_FF, 1112 (char_u *)&p_ff, PV_FF,
1161 {(char_u *)DFLT_FF, (char_u *)0L} SCTX_INIT}, 1113 {(char_u *)DFLT_FF, (char_u *)0L} SCTX_INIT},
1414 (char_u *)NULL, PV_NONE, 1366 (char_u *)NULL, PV_NONE,
1415 {(char_u *)NULL, (char_u *)0L} 1367 {(char_u *)NULL, (char_u *)0L}
1416 #endif 1368 #endif
1417 SCTX_INIT}, 1369 SCTX_INIT},
1418 {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP, 1370 {"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP,
1419 #if defined(FEAT_GUI) && defined(FEAT_MBYTE) 1371 #if defined(FEAT_GUI)
1420 (char_u *)&p_guifontwide, PV_NONE, 1372 (char_u *)&p_guifontwide, PV_NONE,
1421 {(char_u *)"", (char_u *)0L} 1373 {(char_u *)"", (char_u *)0L}
1422 #else 1374 #else
1423 (char_u *)NULL, PV_NONE, 1375 (char_u *)NULL, PV_NONE,
1424 {(char_u *)NULL, (char_u *)0L} 1376 {(char_u *)NULL, (char_u *)0L}
1531 {(char_u *)"", (char_u *)0L} SCTX_INIT}, 1483 {(char_u *)"", (char_u *)0L} SCTX_INIT},
1532 {"ignorecase", "ic", P_BOOL|P_VI_DEF, 1484 {"ignorecase", "ic", P_BOOL|P_VI_DEF,
1533 (char_u *)&p_ic, PV_NONE, 1485 (char_u *)&p_ic, PV_NONE,
1534 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 1486 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
1535 {"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE, 1487 {"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE,
1536 #if defined(FEAT_EVAL) && defined(FEAT_MBYTE) 1488 #if defined(FEAT_EVAL)
1537 (char_u *)&p_imaf, PV_NONE, 1489 (char_u *)&p_imaf, PV_NONE,
1538 {(char_u *)"", (char_u *)NULL} 1490 {(char_u *)"", (char_u *)NULL}
1539 # else 1491 # else
1540 (char_u *)NULL, PV_NONE, 1492 (char_u *)NULL, PV_NONE,
1541 {(char_u *)NULL, (char_u *)0L} 1493 {(char_u *)NULL, (char_u *)0L}
1547 #else 1499 #else
1548 (char_u *)NULL, PV_NONE, 1500 (char_u *)NULL, PV_NONE,
1549 #endif 1501 #endif
1550 {(char_u *)"", (char_u *)0L} SCTX_INIT}, 1502 {(char_u *)"", (char_u *)0L} SCTX_INIT},
1551 {"imcmdline", "imc", P_BOOL|P_VI_DEF, 1503 {"imcmdline", "imc", P_BOOL|P_VI_DEF,
1552 #ifdef FEAT_MBYTE
1553 (char_u *)&p_imcmdline, PV_NONE, 1504 (char_u *)&p_imcmdline, PV_NONE,
1554 #else
1555 (char_u *)NULL, PV_NONE,
1556 #endif
1557 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 1505 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
1558 {"imdisable", "imd", P_BOOL|P_VI_DEF, 1506 {"imdisable", "imd", P_BOOL|P_VI_DEF,
1559 #ifdef FEAT_MBYTE
1560 (char_u *)&p_imdisable, PV_NONE, 1507 (char_u *)&p_imdisable, PV_NONE,
1561 #else
1562 (char_u *)NULL, PV_NONE,
1563 #endif
1564 #ifdef __sgi 1508 #ifdef __sgi
1565 {(char_u *)TRUE, (char_u *)0L} 1509 {(char_u *)TRUE, (char_u *)0L}
1566 #else 1510 #else
1567 {(char_u *)FALSE, (char_u *)0L} 1511 {(char_u *)FALSE, (char_u *)0L}
1568 #endif 1512 #endif
1574 {"imsearch", "ims", P_NUM|P_VI_DEF, 1518 {"imsearch", "ims", P_NUM|P_VI_DEF,
1575 (char_u *)&p_imsearch, PV_IMS, 1519 (char_u *)&p_imsearch, PV_IMS,
1576 {(char_u *)B_IMODE_USE_INSERT, (char_u *)0L} 1520 {(char_u *)B_IMODE_USE_INSERT, (char_u *)0L}
1577 SCTX_INIT}, 1521 SCTX_INIT},
1578 {"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE, 1522 {"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE,
1579 #if defined(FEAT_EVAL) && defined(FEAT_MBYTE) 1523 #if defined(FEAT_EVAL)
1580 (char_u *)&p_imsf, PV_NONE, 1524 (char_u *)&p_imsf, PV_NONE,
1581 {(char_u *)"", (char_u *)NULL} 1525 {(char_u *)"", (char_u *)NULL}
1582 #else 1526 #else
1583 (char_u *)NULL, PV_NONE, 1527 (char_u *)NULL, PV_NONE,
1584 {(char_u *)NULL, (char_u *)0L} 1528 {(char_u *)NULL, (char_u *)0L}
1870 (char_u *)NULL, PV_NONE, 1814 (char_u *)NULL, PV_NONE,
1871 {(char_u *)NULL, (char_u *)0L} 1815 {(char_u *)NULL, (char_u *)0L}
1872 #endif 1816 #endif
1873 SCTX_INIT}, 1817 SCTX_INIT},
1874 {"makeencoding","menc", P_STRING|P_VI_DEF, 1818 {"makeencoding","menc", P_STRING|P_VI_DEF,
1875 #ifdef FEAT_MBYTE
1876 (char_u *)&p_menc, PV_MENC, 1819 (char_u *)&p_menc, PV_MENC,
1877 {(char_u *)"", (char_u *)0L} 1820 {(char_u *)"", (char_u *)0L}
1878 #else
1879 (char_u *)NULL, PV_NONE,
1880 {(char_u *)0L, (char_u *)0L}
1881 #endif
1882 SCTX_INIT}, 1821 SCTX_INIT},
1883 {"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, 1822 {"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
1884 #ifdef FEAT_QUICKFIX 1823 #ifdef FEAT_QUICKFIX
1885 (char_u *)&p_mp, PV_MP, 1824 (char_u *)&p_mp, PV_MP,
1886 # ifdef VMS 1825 # ifdef VMS
1899 SCTX_INIT}, 1838 SCTX_INIT},
1900 {"matchtime", "mat", P_NUM|P_VI_DEF, 1839 {"matchtime", "mat", P_NUM|P_VI_DEF,
1901 (char_u *)&p_mat, PV_NONE, 1840 (char_u *)&p_mat, PV_NONE,
1902 {(char_u *)5L, (char_u *)0L} SCTX_INIT}, 1841 {(char_u *)5L, (char_u *)0L} SCTX_INIT},
1903 {"maxcombine", "mco", P_NUM|P_VI_DEF|P_CURSWANT, 1842 {"maxcombine", "mco", P_NUM|P_VI_DEF|P_CURSWANT,
1904 #ifdef FEAT_MBYTE
1905 (char_u *)&p_mco, PV_NONE, 1843 (char_u *)&p_mco, PV_NONE,
1906 #else
1907 (char_u *)NULL, PV_NONE,
1908 #endif
1909 {(char_u *)2, (char_u *)0L} SCTX_INIT}, 1844 {(char_u *)2, (char_u *)0L} SCTX_INIT},
1910 {"maxfuncdepth", "mfd", P_NUM|P_VI_DEF, 1845 {"maxfuncdepth", "mfd", P_NUM|P_VI_DEF,
1911 #ifdef FEAT_EVAL 1846 #ifdef FEAT_EVAL
1912 (char_u *)&p_mfd, PV_NONE, 1847 (char_u *)&p_mfd, PV_NONE,
1913 #else 1848 #else
2195 (char_u *)NULL, PV_NONE, 2130 (char_u *)NULL, PV_NONE,
2196 {(char_u *)NULL, (char_u *)0L} 2131 {(char_u *)NULL, (char_u *)0L}
2197 #endif 2132 #endif
2198 SCTX_INIT}, 2133 SCTX_INIT},
2199 {"printmbcharset", "pmbcs", P_STRING|P_VI_DEF, 2134 {"printmbcharset", "pmbcs", P_STRING|P_VI_DEF,
2200 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE) 2135 #if defined(FEAT_POSTSCRIPT)
2201 (char_u *)&p_pmcs, PV_NONE, 2136 (char_u *)&p_pmcs, PV_NONE,
2202 {(char_u *)"", (char_u *)0L} 2137 {(char_u *)"", (char_u *)0L}
2203 #else 2138 #else
2204 (char_u *)NULL, PV_NONE, 2139 (char_u *)NULL, PV_NONE,
2205 {(char_u *)NULL, (char_u *)0L} 2140 {(char_u *)NULL, (char_u *)0L}
2206 #endif 2141 #endif
2207 SCTX_INIT}, 2142 SCTX_INIT},
2208 {"printmbfont", "pmbfn", P_STRING|P_VI_DEF, 2143 {"printmbfont", "pmbfn", P_STRING|P_VI_DEF,
2209 #if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE) 2144 #if defined(FEAT_POSTSCRIPT)
2210 (char_u *)&p_pmfn, PV_NONE, 2145 (char_u *)&p_pmfn, PV_NONE,
2211 {(char_u *)"", (char_u *)0L} 2146 {(char_u *)"", (char_u *)0L}
2212 #else 2147 #else
2213 (char_u *)NULL, PV_NONE, 2148 (char_u *)NULL, PV_NONE,
2214 {(char_u *)NULL, (char_u *)0L} 2149 {(char_u *)NULL, (char_u *)0L}
2746 #else 2681 #else
2747 (char_u *)NULL, PV_NONE, 2682 (char_u *)NULL, PV_NONE,
2748 #endif 2683 #endif
2749 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, 2684 {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
2750 {"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR, 2685 {"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR,
2751 #ifdef FEAT_MBYTE
2752 (char_u *)&p_tenc, PV_NONE, 2686 (char_u *)&p_tenc, PV_NONE,
2753 {(char_u *)"", (char_u *)0L} 2687 {(char_u *)"", (char_u *)0L}
2754 #else
2755 (char_u *)NULL, PV_NONE,
2756 {(char_u *)0L, (char_u *)0L}
2757 #endif
2758 SCTX_INIT}, 2688 SCTX_INIT},
2759 {"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, 2689 {"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
2760 #ifdef FEAT_TERMGUICOLORS 2690 #ifdef FEAT_TERMGUICOLORS
2761 (char_u *)&p_tgc, PV_NONE, 2691 (char_u *)&p_tgc, PV_NONE,
2762 {(char_u *)FALSE, (char_u *)FALSE} 2692 {(char_u *)FALSE, (char_u *)FALSE}
3236 {NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL} SCTX_INIT} 3166 {NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL} SCTX_INIT}
3237 }; 3167 };
3238 3168
3239 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption)) 3169 #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
3240 3170
3241 #ifdef FEAT_MBYTE
3242 static char *(p_ambw_values[]) = {"single", "double", NULL}; 3171 static char *(p_ambw_values[]) = {"single", "double", NULL};
3243 #endif
3244 static char *(p_bg_values[]) = {"light", "dark", NULL}; 3172 static char *(p_bg_values[]) = {"light", "dark", NULL};
3245 static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", NULL}; 3173 static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", NULL};
3246 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL}; 3174 static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
3247 #ifdef FEAT_CRYPT 3175 #ifdef FEAT_CRYPT
3248 static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2", NULL}; 3176 static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2", NULL};
3641 set_option_value((char_u *)"tbidi", 1L, NULL, 0); 3569 set_option_value((char_u *)"tbidi", 1L, NULL, 0);
3642 #endif 3570 #endif
3643 3571
3644 didset_options2(); 3572 didset_options2();
3645 3573
3646 #ifdef FEAT_MBYTE
3647 # if defined(WIN3264) && defined(FEAT_GETTEXT) 3574 # if defined(WIN3264) && defined(FEAT_GETTEXT)
3648 /* 3575 /*
3649 * If $LANG isn't set, try to get a good value for it. This makes the 3576 * If $LANG isn't set, try to get a good value for it. This makes the
3650 * right language be used automatically. Don't do this for English. 3577 * right language be used automatically. Don't do this for English.
3651 */ 3578 */
3725 options[opt_idx].def_val[VIM_DEFAULT] = ISK_LATIN1; 3652 options[opt_idx].def_val[VIM_DEFAULT] = ISK_LATIN1;
3726 (void)init_chartab(); 3653 (void)init_chartab();
3727 } 3654 }
3728 #endif 3655 #endif
3729 3656
3730 # if defined(WIN3264) && !defined(FEAT_GUI) 3657 #if defined(WIN3264) && !defined(FEAT_GUI)
3731 /* Win32 console: When GetACP() returns a different value from 3658 /* Win32 console: When GetACP() returns a different value from
3732 * GetConsoleCP() set 'termencoding'. */ 3659 * GetConsoleCP() set 'termencoding'. */
3733 if (GetACP() != GetConsoleCP()) 3660 if (GetACP() != GetConsoleCP())
3734 { 3661 {
3735 char buf[50]; 3662 char buf[50];
3748 convert_setup(&output_conv, p_enc, p_tenc); 3675 convert_setup(&output_conv, p_enc, p_tenc);
3749 } 3676 }
3750 else 3677 else
3751 p_tenc = empty_option; 3678 p_tenc = empty_option;
3752 } 3679 }
3753 # endif 3680 #endif
3754 # if defined(WIN3264) && defined(FEAT_MBYTE) 3681 #if defined(WIN3264)
3755 /* $HOME may have characters in active code page. */ 3682 /* $HOME may have characters in active code page. */
3756 init_homedir(); 3683 init_homedir();
3757 # endif 3684 #endif
3758 } 3685 }
3759 else 3686 else
3760 { 3687 {
3761 vim_free(p_enc); 3688 vim_free(p_enc);
3762 p_enc = save_enc; 3689 p_enc = save_enc;
3763 } 3690 }
3764 } 3691 }
3765 #endif
3766 3692
3767 #ifdef FEAT_MULTI_LANG 3693 #ifdef FEAT_MULTI_LANG
3768 /* Set the default for 'helplang'. */ 3694 /* Set the default for 'helplang'. */
3769 set_helplang_default(get_mess_lang()); 3695 set_helplang_default(get_mess_lang());
3770 #endif 3696 #endif
3857 win_T *wp; 3783 win_T *wp;
3858 tabpage_T *tp; 3784 tabpage_T *tp;
3859 3785
3860 for (i = 0; !istermoption(&options[i]); i++) 3786 for (i = 0; !istermoption(&options[i]); i++)
3861 if (!(options[i].flags & P_NODEFAULT) 3787 if (!(options[i].flags & P_NODEFAULT)
3862 #if defined(FEAT_MBYTE) || defined(FEAT_CRYPT)
3863 && (opt_flags == 0 3788 && (opt_flags == 0
3864 || (TRUE 3789 || (options[i].var != (char_u *)&p_enc
3865 # if defined(FEAT_MBYTE)
3866 && options[i].var != (char_u *)&p_enc
3867 # endif
3868 # if defined(FEAT_CRYPT) 3790 # if defined(FEAT_CRYPT)
3869 && options[i].var != (char_u *)&p_cm 3791 && options[i].var != (char_u *)&p_cm
3870 && options[i].var != (char_u *)&p_key 3792 && options[i].var != (char_u *)&p_key
3871 # endif 3793 # endif
3872 )) 3794 )))
3873 #endif
3874 )
3875 set_option_default(i, opt_flags, p_cp); 3795 set_option_default(i, opt_flags, p_cp);
3876 3796
3877 /* The 'scroll' option must be computed for all windows. */ 3797 /* The 'scroll' option must be computed for all windows. */
3878 FOR_ALL_TAB_WINDOWS(tp, wp) 3798 FOR_ALL_TAB_WINDOWS(tp, wp)
3879 win_comp_scroll(wp); 3799 win_comp_scroll(wp);
5016 || (s == newval 4936 || (s == newval
5017 && arg[2] != '\\'))) 4937 && arg[2] != '\\')))
5018 #endif 4938 #endif
5019 ) 4939 )
5020 ++arg; /* remove backslash */ 4940 ++arg; /* remove backslash */
5021 #ifdef FEAT_MBYTE
5022 if (has_mbyte 4941 if (has_mbyte
5023 && (i = (*mb_ptr2len)(arg)) > 1) 4942 && (i = (*mb_ptr2len)(arg)) > 1)
5024 { 4943 {
5025 /* copy multibyte char */ 4944 /* copy multibyte char */
5026 mch_memmove(s, arg, (size_t)i); 4945 mch_memmove(s, arg, (size_t)i);
5027 arg += i; 4946 arg += i;
5028 s += i; 4947 s += i;
5029 } 4948 }
5030 else 4949 else
5031 #endif
5032 *s++ = *arg++; 4950 *s++ = *arg++;
5033 } 4951 }
5034 *s = NUL; 4952 *s = NUL;
5035 4953
5036 /* 4954 /*
5594 didset_options(void) 5512 didset_options(void)
5595 { 5513 {
5596 /* initialize the table for 'iskeyword' et.al. */ 5514 /* initialize the table for 'iskeyword' et.al. */
5597 (void)init_chartab(); 5515 (void)init_chartab();
5598 5516
5599 #ifdef FEAT_MBYTE
5600 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE); 5517 (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
5601 #endif
5602 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE); 5518 (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
5603 (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE); 5519 (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE);
5604 #ifdef FEAT_SESSION 5520 #ifdef FEAT_SESSION
5605 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE); 5521 (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE);
5606 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE); 5522 (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE);
5687 void 5603 void
5688 check_buf_options(buf_T *buf) 5604 check_buf_options(buf_T *buf)
5689 { 5605 {
5690 check_string_option(&buf->b_p_bh); 5606 check_string_option(&buf->b_p_bh);
5691 check_string_option(&buf->b_p_bt); 5607 check_string_option(&buf->b_p_bt);
5692 #ifdef FEAT_MBYTE
5693 check_string_option(&buf->b_p_fenc); 5608 check_string_option(&buf->b_p_fenc);
5694 #endif
5695 check_string_option(&buf->b_p_ff); 5609 check_string_option(&buf->b_p_ff);
5696 #ifdef FEAT_FIND_ID 5610 #ifdef FEAT_FIND_ID
5697 check_string_option(&buf->b_p_def); 5611 check_string_option(&buf->b_p_def);
5698 check_string_option(&buf->b_p_inc); 5612 check_string_option(&buf->b_p_inc);
5699 # ifdef FEAT_EVAL 5613 # ifdef FEAT_EVAL
5778 #endif 5692 #endif
5779 #ifdef FEAT_LISP 5693 #ifdef FEAT_LISP
5780 check_string_option(&buf->b_p_lw); 5694 check_string_option(&buf->b_p_lw);
5781 #endif 5695 #endif
5782 check_string_option(&buf->b_p_bkc); 5696 check_string_option(&buf->b_p_bkc);
5783 #ifdef FEAT_MBYTE
5784 check_string_option(&buf->b_p_menc); 5697 check_string_option(&buf->b_p_menc);
5785 #endif
5786 #ifdef FEAT_VARTABS 5698 #ifdef FEAT_VARTABS
5787 check_string_option(&buf->b_p_vsts); 5699 check_string_option(&buf->b_p_vsts);
5788 check_string_option(&buf->b_p_vts); 5700 check_string_option(&buf->b_p_vts);
5789 #endif 5701 #endif
5790 } 5702 }
6316 if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK) 6228 if (check_opt_strings(p_sbo, p_scbopt_values, TRUE) != OK)
6317 errmsg = e_invarg; 6229 errmsg = e_invarg;
6318 } 6230 }
6319 6231
6320 /* 'ambiwidth' */ 6232 /* 'ambiwidth' */
6321 #ifdef FEAT_MBYTE
6322 else if (varp == &p_ambw || varp == &p_emoji) 6233 else if (varp == &p_ambw || varp == &p_emoji)
6323 { 6234 {
6324 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK) 6235 if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
6325 errmsg = e_invarg; 6236 errmsg = e_invarg;
6326 else if (set_chars_option(&p_lcs) != NULL) 6237 else if (set_chars_option(&p_lcs) != NULL)
6327 errmsg = _("E834: Conflicts with value of 'listchars'"); 6238 errmsg = _("E834: Conflicts with value of 'listchars'");
6328 else if (set_chars_option(&p_fcs) != NULL) 6239 else if (set_chars_option(&p_fcs) != NULL)
6329 errmsg = _("E835: Conflicts with value of 'fillchars'"); 6240 errmsg = _("E835: Conflicts with value of 'fillchars'");
6330 } 6241 }
6331 #endif
6332 6242
6333 /* 'background' */ 6243 /* 'background' */
6334 else if (varp == &p_bg) 6244 else if (varp == &p_bg)
6335 { 6245 {
6336 if (check_opt_strings(p_bg, p_bg_values, FALSE) == OK) 6246 if (check_opt_strings(p_bg, p_bg_values, FALSE) == OK)
6402 { 6312 {
6403 if (check_ei() == FAIL) 6313 if (check_ei() == FAIL)
6404 errmsg = e_invarg; 6314 errmsg = e_invarg;
6405 } 6315 }
6406 6316
6407 #ifdef FEAT_MBYTE
6408 /* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */ 6317 /* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */
6409 else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc 6318 else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc
6410 || gvarp == &p_menc) 6319 || gvarp == &p_menc)
6411 { 6320 {
6412 if (gvarp == &p_fenc) 6321 if (gvarp == &p_fenc)
6417 /* No comma allowed in 'fileencoding'; catches confusing it 6326 /* No comma allowed in 'fileencoding'; catches confusing it
6418 * with 'fileencodings'. */ 6327 * with 'fileencodings'. */
6419 errmsg = e_invarg; 6328 errmsg = e_invarg;
6420 else 6329 else
6421 { 6330 {
6422 # ifdef FEAT_TITLE 6331 #ifdef FEAT_TITLE
6423 /* May show a "+" in the title now. */ 6332 /* May show a "+" in the title now. */
6424 redraw_titles(); 6333 redraw_titles();
6425 # endif 6334 #endif
6426 /* Add 'fileencoding' to the swap file. */ 6335 /* Add 'fileencoding' to the swap file. */
6427 ml_setflags(curbuf); 6336 ml_setflags(curbuf);
6428 } 6337 }
6429 } 6338 }
6430 if (errmsg == NULL) 6339 if (errmsg == NULL)
6437 *varp = p; 6346 *varp = p;
6438 } 6347 }
6439 if (varp == &p_enc) 6348 if (varp == &p_enc)
6440 { 6349 {
6441 errmsg = mb_init(); 6350 errmsg = mb_init();
6442 # ifdef FEAT_TITLE 6351 #ifdef FEAT_TITLE
6443 redraw_titles(); 6352 redraw_titles();
6444 # endif 6353 #endif
6445 } 6354 }
6446 } 6355 }
6447 6356
6448 # if defined(FEAT_GUI_GTK) 6357 #if defined(FEAT_GUI_GTK)
6449 if (errmsg == NULL && varp == &p_tenc && gui.in_use) 6358 if (errmsg == NULL && varp == &p_tenc && gui.in_use)
6450 { 6359 {
6451 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */ 6360 /* GTK+ 2 uses only a single encoding, and that is UTF-8. */
6452 if (STRCMP(p_tenc, "utf-8") != 0) 6361 if (STRCMP(p_tenc, "utf-8") != 0)
6453 errmsg = N_("E617: Cannot be changed in the GTK+ 2 GUI"); 6362 errmsg = N_("E617: Cannot be changed in the GTK+ 2 GUI");
6454 } 6363 }
6455 # endif 6364 #endif
6456 6365
6457 if (errmsg == NULL) 6366 if (errmsg == NULL)
6458 { 6367 {
6459 # ifdef FEAT_KEYMAP 6368 #ifdef FEAT_KEYMAP
6460 /* When 'keymap' is used and 'encoding' changes, reload the keymap 6369 /* When 'keymap' is used and 'encoding' changes, reload the keymap
6461 * (with another encoding). */ 6370 * (with another encoding). */
6462 if (varp == &p_enc && *curbuf->b_p_keymap != NUL) 6371 if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
6463 (void)keymap_init(); 6372 (void)keymap_init();
6464 # endif 6373 #endif
6465 6374
6466 /* When 'termencoding' is not empty and 'encoding' changes or when 6375 /* When 'termencoding' is not empty and 'encoding' changes or when
6467 * 'termencoding' changes, need to setup for keyboard input and 6376 * 'termencoding' changes, need to setup for keyboard input and
6468 * display output conversion. */ 6377 * display output conversion. */
6469 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc)) 6378 if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
6475 p_tenc, p_enc); 6384 p_tenc, p_enc);
6476 errmsg = e_invarg; 6385 errmsg = e_invarg;
6477 } 6386 }
6478 } 6387 }
6479 6388
6480 # if defined(WIN3264) && defined(FEAT_MBYTE) 6389 #if defined(WIN3264)
6481 /* $HOME may have characters in active code page. */ 6390 /* $HOME may have characters in active code page. */
6482 if (varp == &p_enc) 6391 if (varp == &p_enc)
6483 init_homedir(); 6392 init_homedir();
6484 # endif 6393 #endif
6485 } 6394 }
6486 } 6395 }
6487 #endif
6488 6396
6489 #if defined(FEAT_POSTSCRIPT) 6397 #if defined(FEAT_POSTSCRIPT)
6490 else if (varp == &p_penc) 6398 else if (varp == &p_penc)
6491 { 6399 {
6492 /* Canonize printencoding if VIM standard one */ 6400 /* Canonize printencoding if VIM standard one */
6682 #endif 6590 #endif
6683 6591
6684 /* 'matchpairs' */ 6592 /* 'matchpairs' */
6685 else if (gvarp == &p_mps) 6593 else if (gvarp == &p_mps)
6686 { 6594 {
6687 #ifdef FEAT_MBYTE
6688 if (has_mbyte) 6595 if (has_mbyte)
6689 { 6596 {
6690 for (p = *varp; *p != NUL; ++p) 6597 for (p = *varp; *p != NUL; ++p)
6691 { 6598 {
6692 int x2 = -1; 6599 int x2 = -1;
6709 if (*p == NUL) 6616 if (*p == NUL)
6710 break; 6617 break;
6711 } 6618 }
6712 } 6619 }
6713 else 6620 else
6714 #endif
6715 { 6621 {
6716 /* Check for "x:y,x:y" */ 6622 /* Check for "x:y,x:y" */
6717 for (p = *varp; *p != NUL; p += 4) 6623 for (p = *varp; *p != NUL; p += 4)
6718 { 6624 {
6719 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ',')) 6625 if (p[1] != ':' || p[2] == NUL || (p[3] != NUL && p[3] != ','))
6969 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK) 6875 else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
6970 errmsg = N_("E598: Invalid fontset"); 6876 errmsg = N_("E598: Invalid fontset");
6971 redraw_gui_only = TRUE; 6877 redraw_gui_only = TRUE;
6972 } 6878 }
6973 # endif 6879 # endif
6974 # ifdef FEAT_MBYTE
6975 else if (varp == &p_guifontwide) 6880 else if (varp == &p_guifontwide)
6976 { 6881 {
6977 if (STRCMP(p_guifontwide, "*") == 0) 6882 if (STRCMP(p_guifontwide, "*") == 0)
6978 errmsg = N_("E533: can't select wide font"); 6883 errmsg = N_("E533: can't select wide font");
6979 else if (gui_get_wide_font() == FAIL) 6884 else if (gui_get_wide_font() == FAIL)
6980 errmsg = N_("E534: Invalid wide font"); 6885 errmsg = N_("E534: Invalid wide font");
6981 redraw_gui_only = TRUE; 6886 redraw_gui_only = TRUE;
6982 } 6887 }
6983 # endif
6984 #endif 6888 #endif
6985 6889
6986 #ifdef CURSOR_SHAPE 6890 #ifdef CURSOR_SHAPE
6987 /* 'guicursor' */ 6891 /* 'guicursor' */
6988 else if (varp == &p_guicursor) 6892 else if (varp == &p_guicursor)
6999 #endif 6903 #endif
7000 6904
7001 #ifdef FEAT_PRINTER 6905 #ifdef FEAT_PRINTER
7002 else if (varp == &p_popt) 6906 else if (varp == &p_popt)
7003 errmsg = parse_printoptions(); 6907 errmsg = parse_printoptions();
7004 # if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT) 6908 # if defined(FEAT_POSTSCRIPT)
7005 else if (varp == &p_pmfn) 6909 else if (varp == &p_pmfn)
7006 errmsg = parse_printmbfont(); 6910 errmsg = parse_printmbfont();
7007 # endif 6911 # endif
7008 #endif 6912 #endif
7009 6913
7393 else if (*p == NUL 7297 else if (*p == NUL
7394 || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK) 7298 || opt_strings_flags(p, p_tc_values, flags, FALSE) != OK)
7395 errmsg = e_invarg; 7299 errmsg = e_invarg;
7396 } 7300 }
7397 7301
7398 #ifdef FEAT_MBYTE
7399 /* 'casemap' */ 7302 /* 'casemap' */
7400 else if (varp == &p_cmp) 7303 else if (varp == &p_cmp)
7401 { 7304 {
7402 if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK) 7305 if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK)
7403 errmsg = e_invarg; 7306 errmsg = e_invarg;
7404 } 7307 }
7405 #endif
7406 7308
7407 #ifdef FEAT_DIFF 7309 #ifdef FEAT_DIFF
7408 /* 'diffopt' */ 7310 /* 'diffopt' */
7409 else if (varp == &p_dip) 7311 else if (varp == &p_dip)
7410 { 7312 {
8020 && p[len] == ':' 7922 && p[len] == ':'
8021 && p[len + 1] != NUL) 7923 && p[len + 1] != NUL)
8022 { 7924 {
8023 c1 = c2 = c3 = 0; 7925 c1 = c2 = c3 = 0;
8024 s = p + len + 1; 7926 s = p + len + 1;
8025 #ifdef FEAT_MBYTE
8026 c1 = mb_ptr2char_adv(&s); 7927 c1 = mb_ptr2char_adv(&s);
8027 if (mb_char2cells(c1) > 1) 7928 if (mb_char2cells(c1) > 1)
8028 continue; 7929 continue;
8029 #else
8030 c1 = *s++;
8031 #endif
8032 if (tab[i].cp == &lcs_tab2) 7930 if (tab[i].cp == &lcs_tab2)
8033 { 7931 {
8034 if (*s == NUL) 7932 if (*s == NUL)
8035 continue; 7933 continue;
8036 #ifdef FEAT_MBYTE
8037 c2 = mb_ptr2char_adv(&s); 7934 c2 = mb_ptr2char_adv(&s);
8038 if (mb_char2cells(c2) > 1) 7935 if (mb_char2cells(c2) > 1)
8039 continue; 7936 continue;
8040 #else
8041 c2 = *s++;
8042 #endif
8043 if (!(*s == ',' || *s == NUL)) 7937 if (!(*s == ',' || *s == NUL))
8044 { 7938 {
8045 #ifdef FEAT_MBYTE
8046 c3 = mb_ptr2char_adv(&s); 7939 c3 = mb_ptr2char_adv(&s);
8047 if (mb_char2cells(c3) > 1) 7940 if (mb_char2cells(c3) > 1)
8048 continue; 7941 continue;
8049 #else
8050 c3 = *s++;
8051 #endif
8052 } 7942 }
8053 } 7943 }
8054 7944
8055 if (*s == ',' || *s == NUL) 7945 if (*s == ',' || *s == NUL)
8056 { 7946 {
8504 /* when 'fixeol' is changed, redraw the window title */ 8394 /* when 'fixeol' is changed, redraw the window title */
8505 else if ((int *)varp == &curbuf->b_p_fixeol) 8395 else if ((int *)varp == &curbuf->b_p_fixeol)
8506 { 8396 {
8507 redraw_titles(); 8397 redraw_titles();
8508 } 8398 }
8509 # ifdef FEAT_MBYTE
8510 /* when 'bomb' is changed, redraw the window title and tab page text */ 8399 /* when 'bomb' is changed, redraw the window title and tab page text */
8511 else if ((int *)varp == &curbuf->b_p_bomb) 8400 else if ((int *)varp == &curbuf->b_p_bomb)
8512 { 8401 {
8513 redraw_titles(); 8402 redraw_titles();
8514 } 8403 }
8515 # endif
8516 #endif 8404 #endif
8517 8405
8518 /* when 'bin' is set also set some other options */ 8406 /* when 'bin' is set also set some other options */
8519 else if ((int *)varp == &curbuf->b_p_bin) 8407 else if ((int *)varp == &curbuf->b_p_bin)
8520 { 8408 {
8889 #ifdef FEAT_EVAL 8777 #ifdef FEAT_EVAL
8890 set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1); 8778 set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1);
8891 #endif 8779 #endif
8892 } 8780 }
8893 8781
8894 # ifdef FEAT_MBYTE
8895 /* set 'delcombine' */ 8782 /* set 'delcombine' */
8896 p_deco = TRUE; 8783 p_deco = TRUE;
8897 # endif
8898 8784
8899 # ifdef FEAT_KEYMAP 8785 # ifdef FEAT_KEYMAP
8900 /* Force-set the necessary keymap for arabic */ 8786 /* Force-set the necessary keymap for arabic */
8901 set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic", 8787 set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic",
8902 OPT_LOCAL); 8788 OPT_LOCAL);
9208 parse_cino(curbuf); 9094 parse_cino(curbuf);
9209 # endif 9095 # endif
9210 } 9096 }
9211 #endif 9097 #endif
9212 9098
9213 #ifdef FEAT_MBYTE
9214 /* 'maxcombine' */ 9099 /* 'maxcombine' */
9215 else if (pp == &p_mco) 9100 else if (pp == &p_mco)
9216 { 9101 {
9217 if (p_mco > MAX_MCO) 9102 if (p_mco > MAX_MCO)
9218 p_mco = MAX_MCO; 9103 p_mco = MAX_MCO;
9219 else if (p_mco < 0) 9104 else if (p_mco < 0)
9220 p_mco = 0; 9105 p_mco = 0;
9221 screenclear(); /* will re-allocate the screen */ 9106 screenclear(); /* will re-allocate the screen */
9222 } 9107 }
9223 #endif
9224 9108
9225 else if (pp == &curbuf->b_p_iminsert) 9109 else if (pp == &curbuf->b_p_iminsert)
9226 { 9110 {
9227 if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST) 9111 if (curbuf->b_p_iminsert < 0 || curbuf->b_p_iminsert > B_IMODE_LAST)
9228 { 9112 {
10076 if (i >= 0) 9960 if (i >= 0)
10077 return options[i].def_val[VI_DEFAULT]; 9961 return options[i].def_val[VI_DEFAULT];
10078 return (char_u *)NULL; 9962 return (char_u *)NULL;
10079 } 9963 }
10080 9964
10081 #if defined(FEAT_MBYTE) || defined(PROTO)
10082 char_u * 9965 char_u *
10083 get_encoding_default(void) 9966 get_encoding_default(void)
10084 { 9967 {
10085 int i; 9968 int i;
10086 9969
10087 i = findoption((char_u *)"enc"); 9970 i = findoption((char_u *)"enc");
10088 if (i >= 0) 9971 if (i >= 0)
10089 return options[i].def_val[VI_DEFAULT]; 9972 return options[i].def_val[VI_DEFAULT];
10090 return (char_u *)NULL; 9973 return (char_u *)NULL;
10091 } 9974 }
10092 #endif
10093 9975
10094 /* 9976 /*
10095 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number. 9977 * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
10096 * When "has_lt" is true there is a '<' before "*arg_arg". 9978 * When "has_lt" is true there is a '<' before "*arg_arg".
10097 * Returns 0 when the key is not recognized. 9979 * Returns 0 when the key is not recognized.
10792 #ifdef FEAT_LISP 10674 #ifdef FEAT_LISP
10793 case PV_LW: 10675 case PV_LW:
10794 clear_string_option(&buf->b_p_lw); 10676 clear_string_option(&buf->b_p_lw);
10795 break; 10677 break;
10796 #endif 10678 #endif
10797 #ifdef FEAT_MBYTE
10798 case PV_MENC: 10679 case PV_MENC:
10799 clear_string_option(&buf->b_p_menc); 10680 clear_string_option(&buf->b_p_menc);
10800 break; 10681 break;
10801 #endif
10802 } 10682 }
10803 } 10683 }
10804 #endif 10684 #endif
10805 10685
10806 /* 10686 /*
10851 case PV_UL: return (char_u *)&(curbuf->b_p_ul); 10731 case PV_UL: return (char_u *)&(curbuf->b_p_ul);
10852 #ifdef FEAT_LISP 10732 #ifdef FEAT_LISP
10853 case PV_LW: return (char_u *)&(curbuf->b_p_lw); 10733 case PV_LW: return (char_u *)&(curbuf->b_p_lw);
10854 #endif 10734 #endif
10855 case PV_BKC: return (char_u *)&(curbuf->b_p_bkc); 10735 case PV_BKC: return (char_u *)&(curbuf->b_p_bkc);
10856 #ifdef FEAT_MBYTE
10857 case PV_MENC: return (char_u *)&(curbuf->b_p_menc); 10736 case PV_MENC: return (char_u *)&(curbuf->b_p_menc);
10858 #endif
10859 } 10737 }
10860 return NULL; /* "cannot happen" */ 10738 return NULL; /* "cannot happen" */
10861 } 10739 }
10862 return get_varp(p); 10740 return get_varp(p);
10863 } 10741 }
10929 ? (char_u *)&(curbuf->b_p_ul) : p->var; 10807 ? (char_u *)&(curbuf->b_p_ul) : p->var;
10930 #ifdef FEAT_LISP 10808 #ifdef FEAT_LISP
10931 case PV_LW: return *curbuf->b_p_lw != NUL 10809 case PV_LW: return *curbuf->b_p_lw != NUL
10932 ? (char_u *)&(curbuf->b_p_lw) : p->var; 10810 ? (char_u *)&(curbuf->b_p_lw) : p->var;
10933 #endif 10811 #endif
10934 #ifdef FEAT_MBYTE
10935 case PV_MENC: return *curbuf->b_p_menc != NUL 10812 case PV_MENC: return *curbuf->b_p_menc != NUL
10936 ? (char_u *)&(curbuf->b_p_menc) : p->var; 10813 ? (char_u *)&(curbuf->b_p_menc) : p->var;
10937 #endif
10938 10814
10939 #ifdef FEAT_ARABIC 10815 #ifdef FEAT_ARABIC
10940 case PV_ARAB: return (char_u *)&(curwin->w_p_arab); 10816 case PV_ARAB: return (char_u *)&(curwin->w_p_arab);
10941 #endif 10817 #endif
10942 case PV_LIST: return (char_u *)&(curwin->w_p_list); 10818 case PV_LIST: return (char_u *)&(curwin->w_p_list);
10998 case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl); 10874 case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl);
10999 #endif 10875 #endif
11000 10876
11001 case PV_AI: return (char_u *)&(curbuf->b_p_ai); 10877 case PV_AI: return (char_u *)&(curbuf->b_p_ai);
11002 case PV_BIN: return (char_u *)&(curbuf->b_p_bin); 10878 case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
11003 #ifdef FEAT_MBYTE
11004 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb); 10879 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
11005 #endif
11006 case PV_BH: return (char_u *)&(curbuf->b_p_bh); 10880 case PV_BH: return (char_u *)&(curbuf->b_p_bh);
11007 case PV_BT: return (char_u *)&(curbuf->b_p_bt); 10881 case PV_BT: return (char_u *)&(curbuf->b_p_bt);
11008 case PV_BL: return (char_u *)&(curbuf->b_p_bl); 10882 case PV_BL: return (char_u *)&(curbuf->b_p_bl);
11009 case PV_CI: return (char_u *)&(curbuf->b_p_ci); 10883 case PV_CI: return (char_u *)&(curbuf->b_p_ci);
11010 #ifdef FEAT_CINDENT 10884 #ifdef FEAT_CINDENT
11029 case PV_OFU: return (char_u *)&(curbuf->b_p_ofu); 10903 case PV_OFU: return (char_u *)&(curbuf->b_p_ofu);
11030 #endif 10904 #endif
11031 case PV_EOL: return (char_u *)&(curbuf->b_p_eol); 10905 case PV_EOL: return (char_u *)&(curbuf->b_p_eol);
11032 case PV_FIXEOL: return (char_u *)&(curbuf->b_p_fixeol); 10906 case PV_FIXEOL: return (char_u *)&(curbuf->b_p_fixeol);
11033 case PV_ET: return (char_u *)&(curbuf->b_p_et); 10907 case PV_ET: return (char_u *)&(curbuf->b_p_et);
11034 #ifdef FEAT_MBYTE
11035 case PV_FENC: return (char_u *)&(curbuf->b_p_fenc); 10908 case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
11036 #endif
11037 case PV_FF: return (char_u *)&(curbuf->b_p_ff); 10909 case PV_FF: return (char_u *)&(curbuf->b_p_ff);
11038 case PV_FT: return (char_u *)&(curbuf->b_p_ft); 10910 case PV_FT: return (char_u *)&(curbuf->b_p_ft);
11039 case PV_FO: return (char_u *)&(curbuf->b_p_fo); 10911 case PV_FO: return (char_u *)&(curbuf->b_p_fo);
11040 case PV_FLP: return (char_u *)&(curbuf->b_p_flp); 10912 case PV_FLP: return (char_u *)&(curbuf->b_p_flp);
11041 case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert); 10913 case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert);
11376 if (!buf->b_p_initialized) 11248 if (!buf->b_p_initialized)
11377 { 11249 {
11378 free_buf_options(buf, TRUE); 11250 free_buf_options(buf, TRUE);
11379 buf->b_p_ro = FALSE; /* don't copy readonly */ 11251 buf->b_p_ro = FALSE; /* don't copy readonly */
11380 buf->b_p_tx = p_tx; 11252 buf->b_p_tx = p_tx;
11381 #ifdef FEAT_MBYTE
11382 buf->b_p_fenc = vim_strsave(p_fenc); 11253 buf->b_p_fenc = vim_strsave(p_fenc);
11383 #endif
11384 switch (*p_ffs) 11254 switch (*p_ffs)
11385 { 11255 {
11386 case 'm': 11256 case 'm':
11387 buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break; 11257 buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break;
11388 case 'd': 11258 case 'd':
11408 buf->b_p_tw_nobin = p_tw_nobin; 11278 buf->b_p_tw_nobin = p_tw_nobin;
11409 buf->b_p_wm = p_wm; 11279 buf->b_p_wm = p_wm;
11410 buf->b_p_wm_nopaste = p_wm_nopaste; 11280 buf->b_p_wm_nopaste = p_wm_nopaste;
11411 buf->b_p_wm_nobin = p_wm_nobin; 11281 buf->b_p_wm_nobin = p_wm_nobin;
11412 buf->b_p_bin = p_bin; 11282 buf->b_p_bin = p_bin;
11413 #ifdef FEAT_MBYTE
11414 buf->b_p_bomb = p_bomb; 11283 buf->b_p_bomb = p_bomb;
11415 #endif
11416 buf->b_p_fixeol = p_fixeol; 11284 buf->b_p_fixeol = p_fixeol;
11417 buf->b_p_et = p_et; 11285 buf->b_p_et = p_et;
11418 buf->b_p_et_nobin = p_et_nobin; 11286 buf->b_p_et_nobin = p_et_nobin;
11419 buf->b_p_et_nopaste = p_et_nopaste; 11287 buf->b_p_et_nopaste = p_et_nopaste;
11420 buf->b_p_ml = p_ml; 11288 buf->b_p_ml = p_ml;
11547 buf->b_p_udf = p_udf; 11415 buf->b_p_udf = p_udf;
11548 #endif 11416 #endif
11549 #ifdef FEAT_LISP 11417 #ifdef FEAT_LISP
11550 buf->b_p_lw = empty_option; 11418 buf->b_p_lw = empty_option;
11551 #endif 11419 #endif
11552 #ifdef FEAT_MBYTE
11553 buf->b_p_menc = empty_option; 11420 buf->b_p_menc = empty_option;
11554 #endif
11555 11421
11556 /* 11422 /*
11557 * Don't copy the options set by ex_help(), use the saved values, 11423 * Don't copy the options set by ex_help(), use the saved values,
11558 * when going from a help buffer to a non-help buffer. 11424 * when going from a help buffer to a non-help buffer.
11559 * Don't touch these at all when BCO_NOHELP is used and going from 11425 * Don't touch these at all when BCO_NOHELP is used and going from
12135 * Vim command character. This avoids having to switch the keyboard back to 12001 * Vim command character. This avoids having to switch the keyboard back to
12136 * ASCII mode when leaving Insert mode. 12002 * ASCII mode when leaving Insert mode.
12137 * 12003 *
12138 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim 12004 * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
12139 * commands. 12005 * commands.
12140 * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of 12006 * langmap_mapga.ga_data is a sorted table of langmap_entry_T. This does the
12141 * langmap_entry_T. This does the same as langmap_mapchar[] for characters >= 12007 * same as langmap_mapchar[] for characters >= 256.
12142 * 256. 12008 *
12143 */ 12009 * Use growarray for 'langmap' chars >= 256
12144 # if defined(FEAT_MBYTE) || defined(PROTO)
12145 /*
12146 * With multi-byte support use growarray for 'langmap' chars >= 256
12147 */ 12010 */
12148 typedef struct 12011 typedef struct
12149 { 12012 {
12150 int from; 12013 int from;
12151 int to; 12014 int to;
12215 else 12078 else
12216 b = i; 12079 b = i;
12217 } 12080 }
12218 return c; /* no entry found, return "c" unmodified */ 12081 return c; /* no entry found, return "c" unmodified */
12219 } 12082 }
12220 # endif
12221 12083
12222 static void 12084 static void
12223 langmap_init(void) 12085 langmap_init(void)
12224 { 12086 {
12225 int i; 12087 int i;
12226 12088
12227 for (i = 0; i < 256; i++) 12089 for (i = 0; i < 256; i++)
12228 langmap_mapchar[i] = i; /* we init with a one-to-one map */ 12090 langmap_mapchar[i] = i; /* we init with a one-to-one map */
12229 # ifdef FEAT_MBYTE
12230 ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8); 12091 ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
12231 # endif
12232 } 12092 }
12233 12093
12234 /* 12094 /*
12235 * Called when langmap option is set; the language map can be 12095 * Called when langmap option is set; the language map can be
12236 * changed at any time! 12096 * changed at any time!
12240 { 12100 {
12241 char_u *p; 12101 char_u *p;
12242 char_u *p2; 12102 char_u *p2;
12243 int from, to; 12103 int from, to;
12244 12104
12245 #ifdef FEAT_MBYTE
12246 ga_clear(&langmap_mapga); /* clear the previous map first */ 12105 ga_clear(&langmap_mapga); /* clear the previous map first */
12247 #endif
12248 langmap_init(); /* back to one-to-one map */ 12106 langmap_init(); /* back to one-to-one map */
12249 12107
12250 for (p = p_langmap; p[0] != NUL; ) 12108 for (p = p_langmap; p[0] != NUL; )
12251 { 12109 {
12252 for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';'; 12110 for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';';
12266 ++p; 12124 ++p;
12267 break; 12125 break;
12268 } 12126 }
12269 if (p[0] == '\\' && p[1] != NUL) 12127 if (p[0] == '\\' && p[1] != NUL)
12270 ++p; 12128 ++p;
12271 #ifdef FEAT_MBYTE
12272 from = (*mb_ptr2char)(p); 12129 from = (*mb_ptr2char)(p);
12273 #else
12274 from = p[0];
12275 #endif
12276 to = NUL; 12130 to = NUL;
12277 if (p2 == NULL) 12131 if (p2 == NULL)
12278 { 12132 {
12279 MB_PTR_ADV(p); 12133 MB_PTR_ADV(p);
12280 if (p[0] != ',') 12134 if (p[0] != ',')
12281 { 12135 {
12282 if (p[0] == '\\') 12136 if (p[0] == '\\')
12283 ++p; 12137 ++p;
12284 #ifdef FEAT_MBYTE
12285 to = (*mb_ptr2char)(p); 12138 to = (*mb_ptr2char)(p);
12286 #else
12287 to = p[0];
12288 #endif
12289 } 12139 }
12290 } 12140 }
12291 else 12141 else
12292 { 12142 {
12293 if (p2[0] != ',') 12143 if (p2[0] != ',')
12294 { 12144 {
12295 if (p2[0] == '\\') 12145 if (p2[0] == '\\')
12296 ++p2; 12146 ++p2;
12297 #ifdef FEAT_MBYTE
12298 to = (*mb_ptr2char)(p2); 12147 to = (*mb_ptr2char)(p2);
12299 #else
12300 to = p2[0];
12301 #endif
12302 } 12148 }
12303 } 12149 }
12304 if (to == NUL) 12150 if (to == NUL)
12305 { 12151 {
12306 semsg(_("E357: 'langmap': Matching character missing for %s"), 12152 semsg(_("E357: 'langmap': Matching character missing for %s"),
12307 transchar(from)); 12153 transchar(from));
12308 return; 12154 return;
12309 } 12155 }
12310 12156
12311 #ifdef FEAT_MBYTE
12312 if (from >= 256) 12157 if (from >= 256)
12313 langmap_set_entry(from, to); 12158 langmap_set_entry(from, to);
12314 else 12159 else
12315 #endif
12316 langmap_mapchar[from & 255] = to; 12160 langmap_mapchar[from & 255] = to;
12317 12161
12318 /* Advance to next pair */ 12162 /* Advance to next pair */
12319 MB_PTR_ADV(p); 12163 MB_PTR_ADV(p);
12320 if (p2 != NULL) 12164 if (p2 != NULL)
12811 void 12655 void
12812 save_file_ff(buf_T *buf) 12656 save_file_ff(buf_T *buf)
12813 { 12657 {
12814 buf->b_start_ffc = *buf->b_p_ff; 12658 buf->b_start_ffc = *buf->b_p_ff;
12815 buf->b_start_eol = buf->b_p_eol; 12659 buf->b_start_eol = buf->b_p_eol;
12816 #ifdef FEAT_MBYTE
12817 buf->b_start_bomb = buf->b_p_bomb; 12660 buf->b_start_bomb = buf->b_p_bomb;
12818 12661
12819 /* Only use free/alloc when necessary, they take time. */ 12662 /* Only use free/alloc when necessary, they take time. */
12820 if (buf->b_start_fenc == NULL 12663 if (buf->b_start_fenc == NULL
12821 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) 12664 || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
12822 { 12665 {
12823 vim_free(buf->b_start_fenc); 12666 vim_free(buf->b_start_fenc);
12824 buf->b_start_fenc = vim_strsave(buf->b_p_fenc); 12667 buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
12825 } 12668 }
12826 #endif
12827 } 12669 }
12828 12670
12829 /* 12671 /*
12830 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value 12672 * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
12831 * from when editing started (save_file_ff() called). 12673 * from when editing started (save_file_ff() called).
12848 return FALSE; 12690 return FALSE;
12849 if (buf->b_start_ffc != *buf->b_p_ff) 12691 if (buf->b_start_ffc != *buf->b_p_ff)
12850 return TRUE; 12692 return TRUE;
12851 if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol) 12693 if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)
12852 return TRUE; 12694 return TRUE;
12853 #ifdef FEAT_MBYTE
12854 if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb) 12695 if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
12855 return TRUE; 12696 return TRUE;
12856 if (buf->b_start_fenc == NULL) 12697 if (buf->b_start_fenc == NULL)
12857 return (*buf->b_p_fenc != NUL); 12698 return (*buf->b_p_fenc != NUL);
12858 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0); 12699 return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
12859 #else
12860 return FALSE;
12861 #endif
12862 } 12700 }
12863 12701
12864 /* 12702 /*
12865 * return OK if "p" is a valid fileformat name, FAIL otherwise. 12703 * return OK if "p" is a valid fileformat name, FAIL otherwise.
12866 */ 12704 */
13242 char_u *ptr; 13080 char_u *ptr;
13243 13081
13244 ptr = curbuf->b_p_mps; 13082 ptr = curbuf->b_p_mps;
13245 while (*ptr != NUL) 13083 while (*ptr != NUL)
13246 { 13084 {
13247 #ifdef FEAT_MBYTE
13248 if (has_mbyte) 13085 if (has_mbyte)
13249 { 13086 {
13250 char_u *prev; 13087 char_u *prev;
13251 13088
13252 if (mb_ptr2char(ptr) == *initc) 13089 if (mb_ptr2char(ptr) == *initc)
13282 return; 13119 return;
13283 } 13120 }
13284 ptr += mb_ptr2len(ptr); 13121 ptr += mb_ptr2len(ptr);
13285 } 13122 }
13286 else 13123 else
13287 #endif
13288 { 13124 {
13289 if (*ptr == *initc) 13125 if (*ptr == *initc)
13290 { 13126 {
13291 if (switchit) 13127 if (switchit)
13292 { 13128 {