comparison src/option.c @ 15725:a3e2e7948ee4 v8.1.0870

patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10 commit https://github.com/vim/vim/commit/aa5df7e3127dff6b7336df0903f5c569a40eb174 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 3 14:53:10 2019 +0100 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10 Problem: Vim doesn't use the new ConPTY support in Windows 10. Solution: Use ConPTY support, if available. (Nobuhiro Takasaki, closes https://github.com/vim/vim/issues/3794)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 Feb 2019 15:00:08 +0100
parents ad8b2c109b22
children c017195b121b
comparison
equal deleted inserted replaced
15724:c75264abac54 15725:a3e2e7948ee4
251 #endif 251 #endif
252 #ifdef FEAT_TERMINAL 252 #ifdef FEAT_TERMINAL
253 # define PV_TWK OPT_WIN(WV_TWK) 253 # define PV_TWK OPT_WIN(WV_TWK)
254 # define PV_TWS OPT_WIN(WV_TWS) 254 # define PV_TWS OPT_WIN(WV_TWS)
255 # define PV_TWSL OPT_BUF(BV_TWSL) 255 # define PV_TWSL OPT_BUF(BV_TWSL)
256 # define PV_TMOD OPT_WIN(WV_TMOD)
256 #endif 257 #endif
257 #ifdef FEAT_SIGNS 258 #ifdef FEAT_SIGNS
258 # define PV_SCL OPT_WIN(WV_SCL) 259 # define PV_SCL OPT_WIN(WV_SCL)
259 #endif 260 #endif
260 261
2696 (char_u *)&p_tgc, PV_NONE, 2697 (char_u *)&p_tgc, PV_NONE,
2697 {(char_u *)FALSE, (char_u *)FALSE} 2698 {(char_u *)FALSE, (char_u *)FALSE}
2698 #else 2699 #else
2699 (char_u*)NULL, PV_NONE, 2700 (char_u*)NULL, PV_NONE,
2700 {(char_u *)FALSE, (char_u *)FALSE} 2701 {(char_u *)FALSE, (char_u *)FALSE}
2702 #endif
2703 SCTX_INIT},
2704 {"termmode", "tmod", P_STRING|P_ALLOCED|P_VI_DEF,
2705 #ifdef FEAT_TERMINAL
2706 (char_u *)VAR_WIN, PV_TMOD,
2707 {(char_u *)"", (char_u *)NULL}
2708 #else
2709 (char_u *)NULL, PV_NONE,
2710 {(char_u *)NULL, (char_u *)0L}
2701 #endif 2711 #endif
2702 SCTX_INIT}, 2712 SCTX_INIT},
2703 {"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, 2713 {"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
2704 #ifdef FEAT_TERMINAL 2714 #ifdef FEAT_TERMINAL
2705 (char_u *)VAR_WIN, PV_TWK, 2715 (char_u *)VAR_WIN, PV_TWK,
3206 static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL}; 3216 static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "noinsert", "noselect", NULL};
3207 #endif 3217 #endif
3208 #ifdef FEAT_SIGNS 3218 #ifdef FEAT_SIGNS
3209 static char *(p_scl_values[]) = {"yes", "no", "auto", NULL}; 3219 static char *(p_scl_values[]) = {"yes", "no", "auto", NULL};
3210 #endif 3220 #endif
3221 #ifdef FEAT_TERMINAL
3222 static char *(p_tmod_values[]) = {"winpty", "conpty", "", NULL};
3223 #endif
3211 3224
3212 static void set_options_default(int opt_flags); 3225 static void set_options_default(int opt_flags);
3213 static void set_string_default_esc(char *name, char_u *val, int escape); 3226 static void set_string_default_esc(char *name, char_u *val, int escape);
3214 static char_u *term_bg_default(void); 3227 static char_u *term_bg_default(void);
3215 static void did_set_option(int opt_idx, int opt_flags, int new_value, int value_checked); 3228 static void did_set_option(int opt_idx, int opt_flags, int new_value, int value_checked);
3659 * GetConsoleCP() set 'termencoding'. */ 3672 * GetConsoleCP() set 'termencoding'. */
3660 if (GetACP() != GetConsoleCP()) 3673 if (GetACP() != GetConsoleCP())
3661 { 3674 {
3662 char buf[50]; 3675 char buf[50];
3663 3676
3664 sprintf(buf, "cp%ld", (long)GetConsoleCP()); 3677 /* Win32 console: In ConPTY, GetConsoleCP() returns zero.
3678 * Use an alternative value. */
3679 if (GetConsoleCP() == 0)
3680 sprintf(buf, "cp%ld", (long)GetACP());
3681 else
3682 sprintf(buf, "cp%ld", (long)GetConsoleCP());
3665 p_tenc = vim_strsave((char_u *)buf); 3683 p_tenc = vim_strsave((char_u *)buf);
3666 if (p_tenc != NULL) 3684 if (p_tenc != NULL)
3667 { 3685 {
3668 opt_idx = findoption((char_u *)"termencoding"); 3686 opt_idx = findoption((char_u *)"termencoding");
3669 if (opt_idx >= 0) 3687 if (opt_idx >= 0)
7466 } 7484 }
7467 } 7485 }
7468 #endif 7486 #endif
7469 7487
7470 #ifdef FEAT_TERMINAL 7488 #ifdef FEAT_TERMINAL
7471 /* 'termwinkey' */ 7489 // 'termwinkey'
7472 else if (varp == &curwin->w_p_twk) 7490 else if (varp == &curwin->w_p_twk)
7473 { 7491 {
7474 if (*curwin->w_p_twk != NUL 7492 if (*curwin->w_p_twk != NUL
7475 && string_to_key(curwin->w_p_twk, TRUE) == 0) 7493 && string_to_key(curwin->w_p_twk, TRUE) == 0)
7476 errmsg = e_invarg; 7494 errmsg = e_invarg;
7477 } 7495 }
7478 /* 'termwinsize' */ 7496 // 'termwinsize'
7479 else if (varp == &curwin->w_p_tws) 7497 else if (varp == &curwin->w_p_tws)
7480 { 7498 {
7481 if (*curwin->w_p_tws != NUL) 7499 if (*curwin->w_p_tws != NUL)
7482 { 7500 {
7483 p = skipdigits(curwin->w_p_tws); 7501 p = skipdigits(curwin->w_p_tws);
7484 if (p == curwin->w_p_tws 7502 if (p == curwin->w_p_tws
7485 || (*p != 'x' && *p != '*') 7503 || (*p != 'x' && *p != '*')
7486 || *skipdigits(p + 1) != NUL) 7504 || *skipdigits(p + 1) != NUL)
7487 errmsg = e_invarg; 7505 errmsg = e_invarg;
7488 } 7506 }
7507 }
7508 // 'termmode'
7509 else if (varp == &curwin->w_p_tmod)
7510 {
7511 if (check_opt_strings(*varp, p_tmod_values, FALSE) != OK)
7512 errmsg = e_invarg;
7489 } 7513 }
7490 #endif 7514 #endif
7491 7515
7492 #ifdef FEAT_VARTABS 7516 #ifdef FEAT_VARTABS
7493 /* 'varsofttabstop' */ 7517 /* 'varsofttabstop' */
8836 # ifdef FEAT_VTP 8860 # ifdef FEAT_VTP
8837 /* Do not turn on 'tgc' when 24-bit colors are not supported. */ 8861 /* Do not turn on 'tgc' when 24-bit colors are not supported. */
8838 if (!has_vtp_working()) 8862 if (!has_vtp_working())
8839 { 8863 {
8840 p_tgc = 0; 8864 p_tgc = 0;
8841 return (char_u*)N_("E954: 24-bit colors are not supported on this environment"); 8865 return N_("E954: 24-bit colors are not supported on this environment");
8842 } 8866 }
8843 if (is_term_win32()) 8867 if (is_term_win32())
8844 swap_tcap(); 8868 swap_tcap();
8845 # endif 8869 # endif
8846 # ifdef FEAT_GUI 8870 # ifdef FEAT_GUI
10926 #endif 10950 #endif
10927 #ifdef FEAT_TERMINAL 10951 #ifdef FEAT_TERMINAL
10928 case PV_TWK: return (char_u *)&(curwin->w_p_twk); 10952 case PV_TWK: return (char_u *)&(curwin->w_p_twk);
10929 case PV_TWS: return (char_u *)&(curwin->w_p_tws); 10953 case PV_TWS: return (char_u *)&(curwin->w_p_tws);
10930 case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl); 10954 case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl);
10955 case PV_TMOD: return (char_u *)&(curwin->w_p_tmod);
10931 #endif 10956 #endif
10932 10957
10933 case PV_AI: return (char_u *)&(curbuf->b_p_ai); 10958 case PV_AI: return (char_u *)&(curbuf->b_p_ai);
10934 case PV_BIN: return (char_u *)&(curbuf->b_p_bin); 10959 case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
10935 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb); 10960 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
11126 to->wo_cole = from->wo_cole; 11151 to->wo_cole = from->wo_cole;
11127 #endif 11152 #endif
11128 #ifdef FEAT_TERMINAL 11153 #ifdef FEAT_TERMINAL
11129 to->wo_twk = vim_strsave(from->wo_twk); 11154 to->wo_twk = vim_strsave(from->wo_twk);
11130 to->wo_tws = vim_strsave(from->wo_tws); 11155 to->wo_tws = vim_strsave(from->wo_tws);
11156 to->wo_tmod = vim_strsave(from->wo_tmod);
11131 #endif 11157 #endif
11132 #ifdef FEAT_FOLDING 11158 #ifdef FEAT_FOLDING
11133 to->wo_fdc = from->wo_fdc; 11159 to->wo_fdc = from->wo_fdc;
11134 to->wo_fdc_save = from->wo_fdc_save; 11160 to->wo_fdc_save = from->wo_fdc_save;
11135 to->wo_fen = from->wo_fen; 11161 to->wo_fen = from->wo_fen;
11196 check_string_option(&wop->wo_cocu); 11222 check_string_option(&wop->wo_cocu);
11197 #endif 11223 #endif
11198 #ifdef FEAT_TERMINAL 11224 #ifdef FEAT_TERMINAL
11199 check_string_option(&wop->wo_twk); 11225 check_string_option(&wop->wo_twk);
11200 check_string_option(&wop->wo_tws); 11226 check_string_option(&wop->wo_tws);
11227 check_string_option(&wop->wo_tmod);
11201 #endif 11228 #endif
11202 #ifdef FEAT_LINEBREAK 11229 #ifdef FEAT_LINEBREAK
11203 check_string_option(&wop->wo_briopt); 11230 check_string_option(&wop->wo_briopt);
11204 #endif 11231 #endif
11205 } 11232 }
11239 clear_string_option(&wop->wo_cocu); 11266 clear_string_option(&wop->wo_cocu);
11240 #endif 11267 #endif
11241 #ifdef FEAT_TERMINAL 11268 #ifdef FEAT_TERMINAL
11242 clear_string_option(&wop->wo_twk); 11269 clear_string_option(&wop->wo_twk);
11243 clear_string_option(&wop->wo_tws); 11270 clear_string_option(&wop->wo_tws);
11271 clear_string_option(&wop->wo_tmod);
11244 #endif 11272 #endif
11245 } 11273 }
11246 11274
11247 /* 11275 /*
11248 * Copy global option values to local options for one buffer. 11276 * Copy global option values to local options for one buffer.