mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.0806: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 2.
This commit is contained in:
224
src/option.c
224
src/option.c
@@ -66,9 +66,7 @@
|
||||
#endif
|
||||
#define PV_BIN OPT_BUF(BV_BIN)
|
||||
#define PV_BL OPT_BUF(BV_BL)
|
||||
#ifdef FEAT_MBYTE
|
||||
# define PV_BOMB OPT_BUF(BV_BOMB)
|
||||
#endif
|
||||
#define PV_BOMB OPT_BUF(BV_BOMB)
|
||||
#define PV_CI OPT_BUF(BV_CI)
|
||||
#ifdef FEAT_CINDENT
|
||||
# define PV_CIN OPT_BUF(BV_CIN)
|
||||
@@ -101,9 +99,7 @@
|
||||
#define PV_FIXEOL OPT_BUF(BV_FIXEOL)
|
||||
#define PV_EP OPT_BOTH(OPT_BUF(BV_EP))
|
||||
#define PV_ET OPT_BUF(BV_ET)
|
||||
#ifdef FEAT_MBYTE
|
||||
# define PV_FENC OPT_BUF(BV_FENC)
|
||||
#endif
|
||||
#define PV_FENC OPT_BUF(BV_FENC)
|
||||
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
|
||||
# define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR))
|
||||
#endif
|
||||
@@ -137,9 +133,7 @@
|
||||
# define PV_LISP OPT_BUF(BV_LISP)
|
||||
# define PV_LW OPT_BOTH(OPT_BUF(BV_LW))
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
# define PV_MENC OPT_BOTH(OPT_BUF(BV_MENC))
|
||||
#endif
|
||||
#define PV_MENC OPT_BOTH(OPT_BUF(BV_MENC))
|
||||
#define PV_MA OPT_BUF(BV_MA)
|
||||
#define PV_ML OPT_BUF(BV_ML)
|
||||
#define PV_MOD OPT_BUF(BV_MOD)
|
||||
@@ -281,9 +275,7 @@ typedef enum
|
||||
*/
|
||||
static int p_ai;
|
||||
static int p_bin;
|
||||
#ifdef FEAT_MBYTE
|
||||
static int p_bomb;
|
||||
#endif
|
||||
static char_u *p_bh;
|
||||
static char_u *p_bt;
|
||||
static int p_bl;
|
||||
@@ -312,9 +304,7 @@ static char_u *p_ofu;
|
||||
static int p_eol;
|
||||
static int p_fixeol;
|
||||
static int p_et;
|
||||
#ifdef FEAT_MBYTE
|
||||
static char_u *p_fenc;
|
||||
#endif
|
||||
static char_u *p_ff;
|
||||
static char_u *p_fo;
|
||||
static char_u *p_flp;
|
||||
@@ -554,13 +544,8 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR,
|
||||
#if defined(FEAT_MBYTE)
|
||||
(char_u *)&p_ambw, PV_NONE,
|
||||
{(char_u *)"single", (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"autochdir", "acd", P_BOOL|P_VI_DEF,
|
||||
#ifdef FEAT_AUTOCHDIR
|
||||
@@ -680,11 +665,7 @@ static struct vimoption options[] =
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
|
||||
{"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_bomb, PV_BOMB,
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
|
||||
#ifdef FEAT_LINEBREAK
|
||||
@@ -736,13 +717,8 @@ static struct vimoption options[] =
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
SCTX_INIT},
|
||||
{"casemap", "cmp", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_cmp, PV_NONE,
|
||||
{(char_u *)"internal,keepascii", (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
|
||||
#ifdef FEAT_SEARCHPATH
|
||||
@@ -763,7 +739,7 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE,
|
||||
#if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
|
||||
#if defined(FEAT_EVAL)
|
||||
(char_u *)&p_ccv, PV_NONE,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
#else
|
||||
@@ -1016,11 +992,7 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_deco, PV_NONE,
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME,
|
||||
#ifdef FEAT_INS_EXPAND
|
||||
@@ -1077,22 +1049,12 @@ static struct vimoption options[] =
|
||||
(char_u *)&p_ed, PV_NONE,
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"emoji", "emo", P_BOOL|P_VI_DEF|P_RCLR,
|
||||
#if defined(FEAT_MBYTE)
|
||||
(char_u *)&p_emoji, PV_NONE,
|
||||
{(char_u *)TRUE, (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR|P_NO_ML,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_enc, PV_NONE,
|
||||
{(char_u *)ENC_DFLT, (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
|
||||
(char_u *)&p_eol, PV_EOL,
|
||||
@@ -1138,22 +1100,12 @@ static struct vimoption options[] =
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF
|
||||
|P_NO_MKRC,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_fenc, PV_FENC,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"fileencodings","fencs", P_STRING|P_VI_DEF|P_ONECOMMA,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_fencs, PV_NONE,
|
||||
{(char_u *)"ucs-bom", (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC
|
||||
|P_CURSWANT,
|
||||
@@ -1416,7 +1368,7 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP,
|
||||
#if defined(FEAT_GUI) && defined(FEAT_MBYTE)
|
||||
#if defined(FEAT_GUI)
|
||||
(char_u *)&p_guifontwide, PV_NONE,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
#else
|
||||
@@ -1533,7 +1485,7 @@ static struct vimoption options[] =
|
||||
(char_u *)&p_ic, PV_NONE,
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE,
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
|
||||
#if defined(FEAT_EVAL)
|
||||
(char_u *)&p_imaf, PV_NONE,
|
||||
{(char_u *)"", (char_u *)NULL}
|
||||
# else
|
||||
@@ -1549,18 +1501,10 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
{(char_u *)"", (char_u *)0L} SCTX_INIT},
|
||||
{"imcmdline", "imc", P_BOOL|P_VI_DEF,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_imcmdline, PV_NONE,
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"imdisable", "imd", P_BOOL|P_VI_DEF,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_imdisable, PV_NONE,
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
#ifdef __sgi
|
||||
{(char_u *)TRUE, (char_u *)0L}
|
||||
#else
|
||||
@@ -1576,7 +1520,7 @@ static struct vimoption options[] =
|
||||
{(char_u *)B_IMODE_USE_INSERT, (char_u *)0L}
|
||||
SCTX_INIT},
|
||||
{"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE,
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
|
||||
#if defined(FEAT_EVAL)
|
||||
(char_u *)&p_imsf, PV_NONE,
|
||||
{(char_u *)"", (char_u *)NULL}
|
||||
#else
|
||||
@@ -1872,13 +1816,8 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"makeencoding","menc", P_STRING|P_VI_DEF,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_menc, PV_MENC,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
|
||||
#ifdef FEAT_QUICKFIX
|
||||
@@ -1901,11 +1840,7 @@ static struct vimoption options[] =
|
||||
(char_u *)&p_mat, PV_NONE,
|
||||
{(char_u *)5L, (char_u *)0L} SCTX_INIT},
|
||||
{"maxcombine", "mco", P_NUM|P_VI_DEF|P_CURSWANT,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_mco, PV_NONE,
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
{(char_u *)2, (char_u *)0L} SCTX_INIT},
|
||||
{"maxfuncdepth", "mfd", P_NUM|P_VI_DEF,
|
||||
#ifdef FEAT_EVAL
|
||||
@@ -2197,7 +2132,7 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"printmbcharset", "pmbcs", P_STRING|P_VI_DEF,
|
||||
#if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
||||
#if defined(FEAT_POSTSCRIPT)
|
||||
(char_u *)&p_pmcs, PV_NONE,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
#else
|
||||
@@ -2206,7 +2141,7 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"printmbfont", "pmbfn", P_STRING|P_VI_DEF,
|
||||
#if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
|
||||
#if defined(FEAT_POSTSCRIPT)
|
||||
(char_u *)&p_pmfn, PV_NONE,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
#else
|
||||
@@ -2748,13 +2683,8 @@ static struct vimoption options[] =
|
||||
#endif
|
||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||
{"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR,
|
||||
#ifdef FEAT_MBYTE
|
||||
(char_u *)&p_tenc, PV_NONE,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L}
|
||||
#endif
|
||||
SCTX_INIT},
|
||||
{"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
|
||||
#ifdef FEAT_TERMGUICOLORS
|
||||
@@ -3238,9 +3168,7 @@ static struct vimoption options[] =
|
||||
|
||||
#define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
static char *(p_ambw_values[]) = {"single", "double", NULL};
|
||||
#endif
|
||||
static char *(p_bg_values[]) = {"light", "dark", NULL};
|
||||
static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", NULL};
|
||||
static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
|
||||
@@ -3643,7 +3571,6 @@ set_init_1(int clean_arg)
|
||||
|
||||
didset_options2();
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
# if defined(WIN3264) && defined(FEAT_GETTEXT)
|
||||
/*
|
||||
* If $LANG isn't set, try to get a good value for it. This makes the
|
||||
@@ -3727,7 +3654,7 @@ set_init_1(int clean_arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
# if defined(WIN3264) && !defined(FEAT_GUI)
|
||||
#if defined(WIN3264) && !defined(FEAT_GUI)
|
||||
/* Win32 console: When GetACP() returns a different value from
|
||||
* GetConsoleCP() set 'termencoding'. */
|
||||
if (GetACP() != GetConsoleCP())
|
||||
@@ -3750,11 +3677,11 @@ set_init_1(int clean_arg)
|
||||
else
|
||||
p_tenc = empty_option;
|
||||
}
|
||||
# endif
|
||||
# if defined(WIN3264) && defined(FEAT_MBYTE)
|
||||
#endif
|
||||
#if defined(WIN3264)
|
||||
/* $HOME may have characters in active code page. */
|
||||
init_homedir();
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3762,7 +3689,6 @@ set_init_1(int clean_arg)
|
||||
p_enc = save_enc;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
/* Set the default for 'helplang'. */
|
||||
@@ -3859,19 +3785,13 @@ set_options_default(
|
||||
|
||||
for (i = 0; !istermoption(&options[i]); i++)
|
||||
if (!(options[i].flags & P_NODEFAULT)
|
||||
#if defined(FEAT_MBYTE) || defined(FEAT_CRYPT)
|
||||
&& (opt_flags == 0
|
||||
|| (TRUE
|
||||
# if defined(FEAT_MBYTE)
|
||||
&& options[i].var != (char_u *)&p_enc
|
||||
# endif
|
||||
|| (options[i].var != (char_u *)&p_enc
|
||||
# if defined(FEAT_CRYPT)
|
||||
&& options[i].var != (char_u *)&p_cm
|
||||
&& options[i].var != (char_u *)&p_key
|
||||
# endif
|
||||
))
|
||||
#endif
|
||||
)
|
||||
)))
|
||||
set_option_default(i, opt_flags, p_cp);
|
||||
|
||||
/* The 'scroll' option must be computed for all windows. */
|
||||
@@ -5018,7 +4938,6 @@ do_set(
|
||||
#endif
|
||||
)
|
||||
++arg; /* remove backslash */
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte
|
||||
&& (i = (*mb_ptr2len)(arg)) > 1)
|
||||
{
|
||||
@@ -5028,7 +4947,6 @@ do_set(
|
||||
s += i;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*s++ = *arg++;
|
||||
}
|
||||
*s = NUL;
|
||||
@@ -5596,9 +5514,7 @@ didset_options(void)
|
||||
/* initialize the table for 'iskeyword' et.al. */
|
||||
(void)init_chartab();
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
(void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
|
||||
#endif
|
||||
(void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
|
||||
(void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE);
|
||||
#ifdef FEAT_SESSION
|
||||
@@ -5689,9 +5605,7 @@ check_buf_options(buf_T *buf)
|
||||
{
|
||||
check_string_option(&buf->b_p_bh);
|
||||
check_string_option(&buf->b_p_bt);
|
||||
#ifdef FEAT_MBYTE
|
||||
check_string_option(&buf->b_p_fenc);
|
||||
#endif
|
||||
check_string_option(&buf->b_p_ff);
|
||||
#ifdef FEAT_FIND_ID
|
||||
check_string_option(&buf->b_p_def);
|
||||
@@ -5780,9 +5694,7 @@ check_buf_options(buf_T *buf)
|
||||
check_string_option(&buf->b_p_lw);
|
||||
#endif
|
||||
check_string_option(&buf->b_p_bkc);
|
||||
#ifdef FEAT_MBYTE
|
||||
check_string_option(&buf->b_p_menc);
|
||||
#endif
|
||||
#ifdef FEAT_VARTABS
|
||||
check_string_option(&buf->b_p_vsts);
|
||||
check_string_option(&buf->b_p_vts);
|
||||
@@ -6318,7 +6230,6 @@ did_set_string_option(
|
||||
}
|
||||
|
||||
/* 'ambiwidth' */
|
||||
#ifdef FEAT_MBYTE
|
||||
else if (varp == &p_ambw || varp == &p_emoji)
|
||||
{
|
||||
if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
|
||||
@@ -6328,7 +6239,6 @@ did_set_string_option(
|
||||
else if (set_chars_option(&p_fcs) != NULL)
|
||||
errmsg = _("E835: Conflicts with value of 'fillchars'");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 'background' */
|
||||
else if (varp == &p_bg)
|
||||
@@ -6404,7 +6314,6 @@ did_set_string_option(
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
/* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */
|
||||
else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc
|
||||
|| gvarp == &p_menc)
|
||||
@@ -6419,10 +6328,10 @@ did_set_string_option(
|
||||
errmsg = e_invarg;
|
||||
else
|
||||
{
|
||||
# ifdef FEAT_TITLE
|
||||
#ifdef FEAT_TITLE
|
||||
/* May show a "+" in the title now. */
|
||||
redraw_titles();
|
||||
# endif
|
||||
#endif
|
||||
/* Add 'fileencoding' to the swap file. */
|
||||
ml_setflags(curbuf);
|
||||
}
|
||||
@@ -6439,29 +6348,29 @@ did_set_string_option(
|
||||
if (varp == &p_enc)
|
||||
{
|
||||
errmsg = mb_init();
|
||||
# ifdef FEAT_TITLE
|
||||
#ifdef FEAT_TITLE
|
||||
redraw_titles();
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(FEAT_GUI_GTK)
|
||||
#if defined(FEAT_GUI_GTK)
|
||||
if (errmsg == NULL && varp == &p_tenc && gui.in_use)
|
||||
{
|
||||
/* GTK+ 2 uses only a single encoding, and that is UTF-8. */
|
||||
if (STRCMP(p_tenc, "utf-8") != 0)
|
||||
errmsg = N_("E617: Cannot be changed in the GTK+ 2 GUI");
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (errmsg == NULL)
|
||||
{
|
||||
# ifdef FEAT_KEYMAP
|
||||
#ifdef FEAT_KEYMAP
|
||||
/* When 'keymap' is used and 'encoding' changes, reload the keymap
|
||||
* (with another encoding). */
|
||||
if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
|
||||
(void)keymap_init();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* When 'termencoding' is not empty and 'encoding' changes or when
|
||||
* 'termencoding' changes, need to setup for keyboard input and
|
||||
@@ -6477,14 +6386,13 @@ did_set_string_option(
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(WIN3264) && defined(FEAT_MBYTE)
|
||||
#if defined(WIN3264)
|
||||
/* $HOME may have characters in active code page. */
|
||||
if (varp == &p_enc)
|
||||
init_homedir();
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_POSTSCRIPT)
|
||||
else if (varp == &p_penc)
|
||||
@@ -6684,7 +6592,6 @@ did_set_string_option(
|
||||
/* 'matchpairs' */
|
||||
else if (gvarp == &p_mps)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
{
|
||||
for (p = *varp; *p != NUL; ++p)
|
||||
@@ -6711,7 +6618,6 @@ did_set_string_option(
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Check for "x:y,x:y" */
|
||||
for (p = *varp; *p != NUL; p += 4)
|
||||
@@ -6971,7 +6877,6 @@ did_set_string_option(
|
||||
redraw_gui_only = TRUE;
|
||||
}
|
||||
# endif
|
||||
# ifdef FEAT_MBYTE
|
||||
else if (varp == &p_guifontwide)
|
||||
{
|
||||
if (STRCMP(p_guifontwide, "*") == 0)
|
||||
@@ -6980,7 +6885,6 @@ did_set_string_option(
|
||||
errmsg = N_("E534: Invalid wide font");
|
||||
redraw_gui_only = TRUE;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CURSOR_SHAPE
|
||||
@@ -7001,7 +6905,7 @@ did_set_string_option(
|
||||
#ifdef FEAT_PRINTER
|
||||
else if (varp == &p_popt)
|
||||
errmsg = parse_printoptions();
|
||||
# if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
|
||||
# if defined(FEAT_POSTSCRIPT)
|
||||
else if (varp == &p_pmfn)
|
||||
errmsg = parse_printmbfont();
|
||||
# endif
|
||||
@@ -7395,14 +7299,12 @@ did_set_string_option(
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
/* 'casemap' */
|
||||
else if (varp == &p_cmp)
|
||||
{
|
||||
if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK)
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_DIFF
|
||||
/* 'diffopt' */
|
||||
@@ -8022,33 +7924,21 @@ set_chars_option(char_u **varp)
|
||||
{
|
||||
c1 = c2 = c3 = 0;
|
||||
s = p + len + 1;
|
||||
#ifdef FEAT_MBYTE
|
||||
c1 = mb_ptr2char_adv(&s);
|
||||
if (mb_char2cells(c1) > 1)
|
||||
continue;
|
||||
#else
|
||||
c1 = *s++;
|
||||
#endif
|
||||
if (tab[i].cp == &lcs_tab2)
|
||||
{
|
||||
if (*s == NUL)
|
||||
continue;
|
||||
#ifdef FEAT_MBYTE
|
||||
c2 = mb_ptr2char_adv(&s);
|
||||
if (mb_char2cells(c2) > 1)
|
||||
continue;
|
||||
#else
|
||||
c2 = *s++;
|
||||
#endif
|
||||
if (!(*s == ',' || *s == NUL))
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
c3 = mb_ptr2char_adv(&s);
|
||||
if (mb_char2cells(c3) > 1)
|
||||
continue;
|
||||
#else
|
||||
c3 = *s++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8506,13 +8396,11 @@ set_bool_option(
|
||||
{
|
||||
redraw_titles();
|
||||
}
|
||||
# ifdef FEAT_MBYTE
|
||||
/* when 'bomb' is changed, redraw the window title and tab page text */
|
||||
else if ((int *)varp == &curbuf->b_p_bomb)
|
||||
{
|
||||
redraw_titles();
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* when 'bin' is set also set some other options */
|
||||
@@ -8891,10 +8779,8 @@ set_bool_option(
|
||||
#endif
|
||||
}
|
||||
|
||||
# ifdef FEAT_MBYTE
|
||||
/* set 'delcombine' */
|
||||
p_deco = TRUE;
|
||||
# endif
|
||||
|
||||
# ifdef FEAT_KEYMAP
|
||||
/* Force-set the necessary keymap for arabic */
|
||||
@@ -9210,7 +9096,6 @@ set_num_option(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
/* 'maxcombine' */
|
||||
else if (pp == &p_mco)
|
||||
{
|
||||
@@ -9220,7 +9105,6 @@ set_num_option(
|
||||
p_mco = 0;
|
||||
screenclear(); /* will re-allocate the screen */
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (pp == &curbuf->b_p_iminsert)
|
||||
{
|
||||
@@ -10078,7 +9962,6 @@ get_highlight_default(void)
|
||||
return (char_u *)NULL;
|
||||
}
|
||||
|
||||
#if defined(FEAT_MBYTE) || defined(PROTO)
|
||||
char_u *
|
||||
get_encoding_default(void)
|
||||
{
|
||||
@@ -10089,7 +9972,6 @@ get_encoding_default(void)
|
||||
return options[i].def_val[VI_DEFAULT];
|
||||
return (char_u *)NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
|
||||
@@ -10794,11 +10676,9 @@ unset_global_local_option(char_u *name, void *from)
|
||||
clear_string_option(&buf->b_p_lw);
|
||||
break;
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
case PV_MENC:
|
||||
clear_string_option(&buf->b_p_menc);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -10853,9 +10733,7 @@ get_varp_scope(struct vimoption *p, int opt_flags)
|
||||
case PV_LW: return (char_u *)&(curbuf->b_p_lw);
|
||||
#endif
|
||||
case PV_BKC: return (char_u *)&(curbuf->b_p_bkc);
|
||||
#ifdef FEAT_MBYTE
|
||||
case PV_MENC: return (char_u *)&(curbuf->b_p_menc);
|
||||
#endif
|
||||
}
|
||||
return NULL; /* "cannot happen" */
|
||||
}
|
||||
@@ -10931,10 +10809,8 @@ get_varp(struct vimoption *p)
|
||||
case PV_LW: return *curbuf->b_p_lw != NUL
|
||||
? (char_u *)&(curbuf->b_p_lw) : p->var;
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
case PV_MENC: return *curbuf->b_p_menc != NUL
|
||||
? (char_u *)&(curbuf->b_p_menc) : p->var;
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_ARABIC
|
||||
case PV_ARAB: return (char_u *)&(curwin->w_p_arab);
|
||||
@@ -11000,9 +10876,7 @@ get_varp(struct vimoption *p)
|
||||
|
||||
case PV_AI: return (char_u *)&(curbuf->b_p_ai);
|
||||
case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
|
||||
#ifdef FEAT_MBYTE
|
||||
case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
|
||||
#endif
|
||||
case PV_BH: return (char_u *)&(curbuf->b_p_bh);
|
||||
case PV_BT: return (char_u *)&(curbuf->b_p_bt);
|
||||
case PV_BL: return (char_u *)&(curbuf->b_p_bl);
|
||||
@@ -11031,9 +10905,7 @@ get_varp(struct vimoption *p)
|
||||
case PV_EOL: return (char_u *)&(curbuf->b_p_eol);
|
||||
case PV_FIXEOL: return (char_u *)&(curbuf->b_p_fixeol);
|
||||
case PV_ET: return (char_u *)&(curbuf->b_p_et);
|
||||
#ifdef FEAT_MBYTE
|
||||
case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
|
||||
#endif
|
||||
case PV_FF: return (char_u *)&(curbuf->b_p_ff);
|
||||
case PV_FT: return (char_u *)&(curbuf->b_p_ft);
|
||||
case PV_FO: return (char_u *)&(curbuf->b_p_fo);
|
||||
@@ -11378,9 +11250,7 @@ buf_copy_options(buf_T *buf, int flags)
|
||||
free_buf_options(buf, TRUE);
|
||||
buf->b_p_ro = FALSE; /* don't copy readonly */
|
||||
buf->b_p_tx = p_tx;
|
||||
#ifdef FEAT_MBYTE
|
||||
buf->b_p_fenc = vim_strsave(p_fenc);
|
||||
#endif
|
||||
switch (*p_ffs)
|
||||
{
|
||||
case 'm':
|
||||
@@ -11410,9 +11280,7 @@ buf_copy_options(buf_T *buf, int flags)
|
||||
buf->b_p_wm_nopaste = p_wm_nopaste;
|
||||
buf->b_p_wm_nobin = p_wm_nobin;
|
||||
buf->b_p_bin = p_bin;
|
||||
#ifdef FEAT_MBYTE
|
||||
buf->b_p_bomb = p_bomb;
|
||||
#endif
|
||||
buf->b_p_fixeol = p_fixeol;
|
||||
buf->b_p_et = p_et;
|
||||
buf->b_p_et_nobin = p_et_nobin;
|
||||
@@ -11549,9 +11417,7 @@ buf_copy_options(buf_T *buf, int flags)
|
||||
#ifdef FEAT_LISP
|
||||
buf->b_p_lw = empty_option;
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
buf->b_p_menc = empty_option;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Don't copy the options set by ex_help(), use the saved values,
|
||||
@@ -12137,13 +12003,10 @@ wc_use_keyname(char_u *varp, long *wcp)
|
||||
*
|
||||
* langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
|
||||
* commands.
|
||||
* When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
|
||||
* langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
|
||||
* 256.
|
||||
*/
|
||||
# if defined(FEAT_MBYTE) || defined(PROTO)
|
||||
/*
|
||||
* With multi-byte support use growarray for 'langmap' chars >= 256
|
||||
* langmap_mapga.ga_data is a sorted table of langmap_entry_T. This does the
|
||||
* same as langmap_mapchar[] for characters >= 256.
|
||||
*
|
||||
* Use growarray for 'langmap' chars >= 256
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
@@ -12217,7 +12080,6 @@ langmap_adjust_mb(int c)
|
||||
}
|
||||
return c; /* no entry found, return "c" unmodified */
|
||||
}
|
||||
# endif
|
||||
|
||||
static void
|
||||
langmap_init(void)
|
||||
@@ -12226,9 +12088,7 @@ langmap_init(void)
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
langmap_mapchar[i] = i; /* we init with a one-to-one map */
|
||||
# ifdef FEAT_MBYTE
|
||||
ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -12242,9 +12102,7 @@ langmap_set(void)
|
||||
char_u *p2;
|
||||
int from, to;
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
ga_clear(&langmap_mapga); /* clear the previous map first */
|
||||
#endif
|
||||
langmap_init(); /* back to one-to-one map */
|
||||
|
||||
for (p = p_langmap; p[0] != NUL; )
|
||||
@@ -12268,11 +12126,7 @@ langmap_set(void)
|
||||
}
|
||||
if (p[0] == '\\' && p[1] != NUL)
|
||||
++p;
|
||||
#ifdef FEAT_MBYTE
|
||||
from = (*mb_ptr2char)(p);
|
||||
#else
|
||||
from = p[0];
|
||||
#endif
|
||||
to = NUL;
|
||||
if (p2 == NULL)
|
||||
{
|
||||
@@ -12281,11 +12135,7 @@ langmap_set(void)
|
||||
{
|
||||
if (p[0] == '\\')
|
||||
++p;
|
||||
#ifdef FEAT_MBYTE
|
||||
to = (*mb_ptr2char)(p);
|
||||
#else
|
||||
to = p[0];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -12294,11 +12144,7 @@ langmap_set(void)
|
||||
{
|
||||
if (p2[0] == '\\')
|
||||
++p2;
|
||||
#ifdef FEAT_MBYTE
|
||||
to = (*mb_ptr2char)(p2);
|
||||
#else
|
||||
to = p2[0];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (to == NUL)
|
||||
@@ -12308,11 +12154,9 @@ langmap_set(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
if (from >= 256)
|
||||
langmap_set_entry(from, to);
|
||||
else
|
||||
#endif
|
||||
langmap_mapchar[from & 255] = to;
|
||||
|
||||
/* Advance to next pair */
|
||||
@@ -12813,7 +12657,6 @@ save_file_ff(buf_T *buf)
|
||||
{
|
||||
buf->b_start_ffc = *buf->b_p_ff;
|
||||
buf->b_start_eol = buf->b_p_eol;
|
||||
#ifdef FEAT_MBYTE
|
||||
buf->b_start_bomb = buf->b_p_bomb;
|
||||
|
||||
/* Only use free/alloc when necessary, they take time. */
|
||||
@@ -12823,7 +12666,6 @@ save_file_ff(buf_T *buf)
|
||||
vim_free(buf->b_start_fenc);
|
||||
buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -12850,15 +12692,11 @@ file_ff_differs(buf_T *buf, int ignore_empty)
|
||||
return TRUE;
|
||||
if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)
|
||||
return TRUE;
|
||||
#ifdef FEAT_MBYTE
|
||||
if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
|
||||
return TRUE;
|
||||
if (buf->b_start_fenc == NULL)
|
||||
return (*buf->b_p_fenc != NUL);
|
||||
return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -13244,7 +13082,6 @@ find_mps_values(
|
||||
ptr = curbuf->b_p_mps;
|
||||
while (*ptr != NUL)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
{
|
||||
char_u *prev;
|
||||
@@ -13284,7 +13121,6 @@ find_mps_values(
|
||||
ptr += mb_ptr2len(ptr);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (*ptr == *initc)
|
||||
{
|
||||
|
Reference in New Issue
Block a user