summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-09-25 15:28:38 +0200
committerBram Moolenaar <Bram@vim.org>2015-09-25 15:28:38 +0200
commitb0262f239e77480f81fa3345491b7b6d52a17f6d (patch)
tree5278bd864aa9b3f3ddab321ac5d77b04a5111f2f /src
parent3fe076f0feb91460266fdf7f9133a59c49a53c4e (diff)
patch 7.4.876v7.4.876
Problem: Windows7: when using vim.exe with msys or msys2, conhost.exe (console window provider on Windows7) will freeze or crash. Solution: Make original screen buffer active, before executing external program. And when the program is finished, revert to vim's one. (Taro Muraoka)
Diffstat (limited to 'src')
-rw-r--r--src/os_win32.c31
-rw-r--r--src/version.c2
2 files changed, 31 insertions, 2 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index 7695e938c3..6981d2f31c 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -234,6 +234,7 @@ static int suppress_winsize = 1; /* don't fiddle with console */
static char_u *exe_path = NULL;
+static BOOL is_win7 = FALSE;
static BOOL win8_or_later = FALSE;
/*
@@ -680,6 +681,9 @@ PlatformId(void)
g_PlatformId = ovi.dwPlatformId;
+ if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 1))
+ is_win7 = TRUE;
+
if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion >= 2)
|| ovi.dwMajorVersion > 6)
win8_or_later = TRUE;
@@ -4581,11 +4585,12 @@ mch_system(char *cmd, int options)
else
return mch_system_classic(cmd, options);
}
+
#else
# ifdef FEAT_MBYTE
static int
-mch_system(char *cmd, int options)
+mch_system1(char *cmd, int options)
{
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
@@ -4600,9 +4605,31 @@ mch_system(char *cmd, int options)
return system(cmd);
}
# else
-# define mch_system(c, o) system(c)
+# define mch_system1(c, o) system(c)
# endif
+ static int
+mch_system(char *cmd, int options)
+{
+ int ret;
+
+ /*
+ * Restore non-termcap screen buffer before execute external program, and
+ * revert it after. Because msys and msys2's programs will cause freeze
+ * or crash conhost.exe (Windows's console window provider) and vim.exe,
+ * if active screen buffer is vim's one on Windows7.
+ */
+ if (is_win7 && g_fTermcapMode)
+ SetConsoleActiveScreenBuffer(g_cbNonTermcap.handle);
+
+ ret = mch_system1(cmd, options);
+
+ if (is_win7 && g_fTermcapMode)
+ SetConsoleActiveScreenBuffer(g_cbTermcap.handle);
+
+ return ret;
+}
+
#endif
/*
diff --git a/src/version.c b/src/version.c
index 1347ac8813..b24af2326c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 876,
+/**/
875,
/**/
874,