]> granicus.if.org Git - vim/commitdiff
patch 8.1.0909: MS-Windows: using ConPTY even though it is not stable v8.1.0909
authorBram Moolenaar <Bram@vim.org>
Wed, 13 Feb 2019 18:23:10 +0000 (19:23 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 13 Feb 2019 18:23:10 +0000 (19:23 +0100)
Problem:    MS-Windows: using ConPTY even though it is not stable.
Solution:   When ConPTY version is unstable, prefer using winpty. (Ken Takata,
            closes #3949)

runtime/doc/options.txt
src/os_win32.c
src/proto/os_win32.pro
src/terminal.c
src/version.c

index 413342087ef15fb1755ce039398756a1593963db..6b2dde82576ed9d0b7abf68d0b45827e04e59998 100644 (file)
@@ -8112,12 +8112,14 @@ A jump table for the options with a short description can be found at |Q_op|.
        window.
 
        Possible values are:
-           ""          use ConPTY if possible, winpty otherwise
+           ""          use ConPTY if it is stable, winpty otherwise
            "winpty"    use winpty, fail if not supported
            "conpty"    use |ConPTY|, fail if not supported
 
-       |ConPTY| support depends on the platform (Windows 10 October 2018
-       edition).  winpty support needs to be installed.  If neither is
+       |ConPTY| support depends on the platform.  Windows 10 October 2018
+       Update is the first version that supports ConPTY, however it is still
+       considered unstable.  ConPTY might become stable in the next release
+       of Windows 10.  winpty support needs to be installed.  If neither is
        supported then you cannot open a terminal window.
 
                                                *'terse'* *'noterse'*
index 10ca41881e085b596a575cf9e229ae5ce0f0d05a..0680346af06ba3cefdd2cf23511377cbbed796d7 100644 (file)
@@ -187,6 +187,8 @@ static int win32_setattrs(char_u *name, int attrs);
 static int win32_set_archive(char_u *name);
 
 static int vtp_working = 0;
+static int conpty_working = 0;
+static int conpty_stable = 0;
 static void vtp_flag_init();
 
 #ifndef FEAT_GUI_W32
@@ -7638,9 +7640,10 @@ mch_setenv(char *var, char *value, int x)
 
 /*
  * Support for pseudo-console (ConPTY) was added in windows 10
- * version 1809 (October 2018 update).
+ * version 1809 (October 2018 update).  However, that version is unstable.
  */
-#define CONPTY_FIRST_SUPPORT_BUILD MAKE_VER(10, 0, 17763)
+#define CONPTY_FIRST_SUPPORT_BUILD  MAKE_VER(10, 0, 17763)
+#define CONPTY_STABLE_BUILD        MAKE_VER(10, 0, 32767)  // T.B.D.
 
     static void
 vtp_flag_init(void)
@@ -7659,10 +7662,10 @@ vtp_flag_init(void)
        vtp_working = 0;
 #endif
 
-#ifdef FEAT_GUI_W32
     if (ver >= CONPTY_FIRST_SUPPORT_BUILD)
-       vtp_working = 1;
-#endif
+       conpty_working = 1;
+    if (ver >= CONPTY_STABLE_BUILD)
+       conpty_stable = 1;
 
 }
 
@@ -7878,3 +7881,15 @@ has_vtp_working(void)
 {
     return vtp_working;
 }
+
+    int
+has_conpty_working(void)
+{
+    return conpty_working;
+}
+
+    int
+is_conpty_stable(void)
+{
+    return conpty_stable;
+}
index 7f45c5cf161a09ef8b2420dd7f366e2c22d40be4..6157e011fdc2d42fea4882ed2d0d37b29ee79c69 100644 (file)
@@ -70,7 +70,9 @@ void set_alist_count(void);
 void fix_arg_enc(void);
 int mch_setenv(char *var, char *value, int x);
 void control_console_color_rgb(void);
-int has_vtp_working(void);
 int use_vtp(void);
 int is_term_win32(void);
+int has_vtp_working(void);
+int has_conpty_working(void);
+int is_conpty_stable(void);
 /* vim: set ft=c : */
index 2544f8567abb3704037d823373b16b0abe79e4be..3be26985867ef47b8b86609479483ec437d37a7b 100644 (file)
@@ -5521,7 +5521,7 @@ dyn_conpty_init(int verbose)
     if (handled)
        return result;
 
-    if (!has_vtp_working())
+    if (!has_conpty_working())
     {
        handled = TRUE;
        result = FAIL;
@@ -6139,7 +6139,7 @@ term_and_job_init(
 
     if (tty_type == NUL)
     {
-       if (has_conpty)
+       if (has_conpty && (is_conpty_stable() || !has_winpty))
            use_conpty = TRUE;
        else if (has_winpty)
            use_winpty = TRUE;
index a6d7addc6928ba18fb716de61f4e4ecb64398716..bc4ae279bd47969946f1d9cb1622a49ee7bcdbda 100644 (file)
@@ -783,6 +783,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    909,
 /**/
     908,
 /**/