diff options
Diffstat (limited to 'src/option.c')
-rw-r--r-- | src/option.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/option.c b/src/option.c index 6d2bab1e0..77d1024ec 100644 --- a/src/option.c +++ b/src/option.c @@ -253,6 +253,7 @@ # define PV_TWK OPT_WIN(WV_TWK) # define PV_TWS OPT_WIN(WV_TWS) # define PV_TWSL OPT_BUF(BV_TWSL) +# define PV_TMOD OPT_WIN(WV_TMOD) #endif #ifdef FEAT_SIGNS # define PV_SCL OPT_WIN(WV_SCL) @@ -2700,6 +2701,15 @@ static struct vimoption options[] = {(char_u *)FALSE, (char_u *)FALSE} #endif SCTX_INIT}, + {"termmode", "tmod", P_STRING|P_ALLOCED|P_VI_DEF, +#ifdef FEAT_TERMINAL + (char_u *)VAR_WIN, PV_TMOD, + {(char_u *)"", (char_u *)NULL} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCTX_INIT}, {"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, #ifdef FEAT_TERMINAL (char_u *)VAR_WIN, PV_TWK, @@ -3208,6 +3218,9 @@ static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noins #ifdef FEAT_SIGNS static char *(p_scl_values[]) = {"yes", "no", "auto", NULL}; #endif +#ifdef FEAT_TERMINAL +static char *(p_tmod_values[]) = {"winpty", "conpty", "", NULL}; +#endif static void set_options_default(int opt_flags); static void set_string_default_esc(char *name, char_u *val, int escape); @@ -3661,7 +3674,12 @@ set_init_1(int clean_arg) { char buf[50]; - sprintf(buf, "cp%ld", (long)GetConsoleCP()); + /* Win32 console: In ConPTY, GetConsoleCP() returns zero. + * Use an alternative value. */ + if (GetConsoleCP() == 0) + sprintf(buf, "cp%ld", (long)GetACP()); + else + sprintf(buf, "cp%ld", (long)GetConsoleCP()); p_tenc = vim_strsave((char_u *)buf); if (p_tenc != NULL) { @@ -7468,14 +7486,14 @@ did_set_string_option( #endif #ifdef FEAT_TERMINAL - /* 'termwinkey' */ + // 'termwinkey' else if (varp == &curwin->w_p_twk) { if (*curwin->w_p_twk != NUL && string_to_key(curwin->w_p_twk, TRUE) == 0) errmsg = e_invarg; } - /* 'termwinsize' */ + // 'termwinsize' else if (varp == &curwin->w_p_tws) { if (*curwin->w_p_tws != NUL) @@ -7487,6 +7505,12 @@ did_set_string_option( errmsg = e_invarg; } } + // 'termmode' + else if (varp == &curwin->w_p_tmod) + { + if (check_opt_strings(*varp, p_tmod_values, FALSE) != OK) + errmsg = e_invarg; + } #endif #ifdef FEAT_VARTABS @@ -8838,7 +8862,7 @@ set_bool_option( if (!has_vtp_working()) { p_tgc = 0; - return (char_u*)N_("E954: 24-bit colors are not supported on this environment"); + return N_("E954: 24-bit colors are not supported on this environment"); } if (is_term_win32()) swap_tcap(); @@ -10928,6 +10952,7 @@ get_varp(struct vimoption *p) case PV_TWK: return (char_u *)&(curwin->w_p_twk); case PV_TWS: return (char_u *)&(curwin->w_p_tws); case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl); + case PV_TMOD: return (char_u *)&(curwin->w_p_tmod); #endif case PV_AI: return (char_u *)&(curbuf->b_p_ai); @@ -11128,6 +11153,7 @@ copy_winopt(winopt_T *from, winopt_T *to) #ifdef FEAT_TERMINAL to->wo_twk = vim_strsave(from->wo_twk); to->wo_tws = vim_strsave(from->wo_tws); + to->wo_tmod = vim_strsave(from->wo_tmod); #endif #ifdef FEAT_FOLDING to->wo_fdc = from->wo_fdc; @@ -11198,6 +11224,7 @@ check_winopt(winopt_T *wop UNUSED) #ifdef FEAT_TERMINAL check_string_option(&wop->wo_twk); check_string_option(&wop->wo_tws); + check_string_option(&wop->wo_tmod); #endif #ifdef FEAT_LINEBREAK check_string_option(&wop->wo_briopt); @@ -11241,6 +11268,7 @@ clear_winopt(winopt_T *wop UNUSED) #ifdef FEAT_TERMINAL clear_string_option(&wop->wo_twk); clear_string_option(&wop->wo_tws); + clear_string_option(&wop->wo_tmod); #endif } |