1
0
forked from aniani/vim

patch 8.0.0420: text garbled when the system encoding differs from 'encoding'

Problem:    When running :make the output may be in the system encoding,
            different from 'encoding'.
Solution:   Add the 'makeencoding' option. (Ken Takata)
This commit is contained in:
Bram Moolenaar
2017-03-05 17:43:31 +01:00
parent 214641f77d
commit 2c7292dc5b
16 changed files with 328 additions and 16 deletions

View File

@@ -139,6 +139,9 @@
# 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_MA OPT_BUF(BV_MA)
#define PV_ML OPT_BUF(BV_ML)
#define PV_MOD OPT_BUF(BV_MOD)
@@ -1898,6 +1901,15 @@ static struct vimoption options[] =
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_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
SCRIPTID_INIT},
{"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
@@ -5686,6 +5698,9 @@ 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
}
/*
@@ -6289,8 +6304,9 @@ did_set_string_option(
#endif
#ifdef FEAT_MBYTE
/* 'encoding' and 'fileencoding' */
else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc)
/* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */
else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc
|| gvarp == &p_menc)
{
if (gvarp == &p_fenc)
{
@@ -10424,6 +10440,11 @@ unset_global_local_option(char_u *name, void *from)
case PV_LW:
clear_string_option(&buf->b_p_lw);
break;
#endif
#ifdef FEAT_MBYTE
case PV_MENC:
clear_string_option(&buf->b_p_menc);
break;
#endif
}
}
@@ -10478,6 +10499,9 @@ 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" */
}
@@ -10553,6 +10577,10 @@ 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);
@@ -11154,6 +11182,9 @@ 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,