|
Karsten Hopp |
4c88de |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
4c88de |
Subject: Patch 7.4.902
|
|
Karsten Hopp |
4c88de |
Fcc: outbox
|
|
Karsten Hopp |
4c88de |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
4c88de |
Mime-Version: 1.0
|
|
Karsten Hopp |
4c88de |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
4c88de |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
4c88de |
------------
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
Patch 7.4.902
|
|
Karsten Hopp |
4c88de |
Problem: Problems with using the MS-Windows console.
|
|
Karsten Hopp |
4c88de |
Solution: Revert patches 7.4.851, 7.4.876 and 7.4.886 until we find a better
|
|
Karsten Hopp |
4c88de |
solution. (suggested by Ken Takata)
|
|
Karsten Hopp |
4c88de |
Files: src/os_win32.c
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
*** ../vim-7.4.901/src/os_win32.c 2015-09-29 14:01:08.059935930 +0200
|
|
Karsten Hopp |
4c88de |
--- src/os_win32.c 2015-10-30 16:43:34.543013902 +0100
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 234,240 ****
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
static char_u *exe_path = NULL;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
- static BOOL is_win7 = FALSE;
|
|
Karsten Hopp |
4c88de |
static BOOL win8_or_later = FALSE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/*
|
|
Karsten Hopp |
4c88de |
--- 234,239 ----
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 681,689 ****
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
g_PlatformId = ovi.dwPlatformId;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
- if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion == 1))
|
|
Karsten Hopp |
4c88de |
- is_win7 = TRUE;
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion >= 2)
|
|
Karsten Hopp |
4c88de |
|| ovi.dwMajorVersion > 6)
|
|
Karsten Hopp |
4c88de |
win8_or_later = TRUE;
|
|
Karsten Hopp |
4c88de |
--- 680,685 ----
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 2173,2179 ****
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
BOOL IsValid;
|
|
Karsten Hopp |
4c88de |
CONSOLE_SCREEN_BUFFER_INFO Info;
|
|
Karsten Hopp |
4c88de |
! HANDLE handle;
|
|
Karsten Hopp |
4c88de |
} ConsoleBuffer;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/*
|
|
Karsten Hopp |
4c88de |
--- 2169,2176 ----
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
BOOL IsValid;
|
|
Karsten Hopp |
4c88de |
CONSOLE_SCREEN_BUFFER_INFO Info;
|
|
Karsten Hopp |
4c88de |
! PCHAR_INFO Buffer;
|
|
Karsten Hopp |
4c88de |
! COORD BufferSize;
|
|
Karsten Hopp |
4c88de |
} ConsoleBuffer;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/*
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 2190,2270 ****
|
|
Karsten Hopp |
4c88de |
SaveConsoleBuffer(
|
|
Karsten Hopp |
4c88de |
ConsoleBuffer *cb)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
if (cb == NULL)
|
|
Karsten Hopp |
4c88de |
return FALSE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
! if (!GetConsoleScreenBufferInfo(cb->handle, &cb->Info))
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
cb->IsValid = FALSE;
|
|
Karsten Hopp |
4c88de |
return FALSE;
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
cb->IsValid = TRUE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
- return TRUE;
|
|
Karsten Hopp |
4c88de |
- }
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
- /*
|
|
Karsten Hopp |
4c88de |
- * CopyOldConsoleBuffer()
|
|
Karsten Hopp |
4c88de |
- * Description:
|
|
Karsten Hopp |
4c88de |
- * Copies the old console buffer contents to the current console buffer.
|
|
Karsten Hopp |
4c88de |
- * This is used when 'restorescreen' is off.
|
|
Karsten Hopp |
4c88de |
- * Returns:
|
|
Karsten Hopp |
4c88de |
- * TRUE on success
|
|
Karsten Hopp |
4c88de |
- */
|
|
Karsten Hopp |
4c88de |
- static BOOL
|
|
Karsten Hopp |
4c88de |
- CopyOldConsoleBuffer(
|
|
Karsten Hopp |
4c88de |
- ConsoleBuffer *cb,
|
|
Karsten Hopp |
4c88de |
- HANDLE hConOld)
|
|
Karsten Hopp |
4c88de |
- {
|
|
Karsten Hopp |
4c88de |
- COORD BufferCoord;
|
|
Karsten Hopp |
4c88de |
- COORD BufferSize;
|
|
Karsten Hopp |
4c88de |
- PCHAR_INFO Buffer;
|
|
Karsten Hopp |
4c88de |
- DWORD NumCells;
|
|
Karsten Hopp |
4c88de |
- SMALL_RECT ReadRegion;
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
/*
|
|
Karsten Hopp |
4c88de |
! * Before copying the buffer contents, clear the current buffer, and
|
|
Karsten Hopp |
4c88de |
! * restore the window information. Doing this now prevents old buffer
|
|
Karsten Hopp |
4c88de |
! * contents from "flashing" onto the screen.
|
|
Karsten Hopp |
4c88de |
*/
|
|
Karsten Hopp |
4c88de |
! ClearConsoleBuffer(cb->Info.wAttributes);
|
|
Karsten Hopp |
4c88de |
!
|
|
Karsten Hopp |
4c88de |
! /* We only need to copy the window area, not whole buffer. */
|
|
Karsten Hopp |
4c88de |
! BufferSize.X = cb->Info.srWindow.Right - cb->Info.srWindow.Left + 1;
|
|
Karsten Hopp |
4c88de |
! BufferSize.Y = cb->Info.srWindow.Bottom - cb->Info.srWindow.Top + 1;
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Left = 0;
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Right = BufferSize.X - 1;
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Top = 0;
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Bottom = BufferSize.Y - 1;
|
|
Karsten Hopp |
4c88de |
!
|
|
Karsten Hopp |
4c88de |
! NumCells = BufferSize.X * BufferSize.Y;
|
|
Karsten Hopp |
4c88de |
! Buffer = (PCHAR_INFO)alloc(NumCells * sizeof(CHAR_INFO));
|
|
Karsten Hopp |
4c88de |
! if (Buffer == NULL)
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
BufferCoord.X = 0;
|
|
Karsten Hopp |
4c88de |
! BufferCoord.Y = 0;
|
|
Karsten Hopp |
4c88de |
!
|
|
Karsten Hopp |
4c88de |
! if (!ReadConsoleOutputW(hConOld, /* output handle */
|
|
Karsten Hopp |
4c88de |
! Buffer, /* our buffer */
|
|
Karsten Hopp |
4c88de |
! BufferSize, /* dimensions of our buffer */
|
|
Karsten Hopp |
4c88de |
! BufferCoord, /* offset in our buffer */
|
|
Karsten Hopp |
4c88de |
! &ReadRegion)) /* region to save */
|
|
Karsten Hopp |
4c88de |
! {
|
|
Karsten Hopp |
4c88de |
! vim_free(Buffer);
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
! }
|
|
Karsten Hopp |
4c88de |
! if (!WriteConsoleOutputW(g_hConOut, /* output handle */
|
|
Karsten Hopp |
4c88de |
! Buffer, /* our buffer */
|
|
Karsten Hopp |
4c88de |
! BufferSize, /* dimensions of our buffer */
|
|
Karsten Hopp |
4c88de |
! BufferCoord, /* offset in our buffer */
|
|
Karsten Hopp |
4c88de |
! &ReadRegion)) /* region to restore */
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
! vim_free(Buffer);
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
- vim_free(Buffer);
|
|
Karsten Hopp |
4c88de |
- SetConsoleWindowInfo(g_hConOut, TRUE, &ReadRegion);
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
return TRUE;
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
--- 2187,2263 ----
|
|
Karsten Hopp |
4c88de |
SaveConsoleBuffer(
|
|
Karsten Hopp |
4c88de |
ConsoleBuffer *cb)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
+ DWORD NumCells;
|
|
Karsten Hopp |
4c88de |
+ COORD BufferCoord;
|
|
Karsten Hopp |
4c88de |
+ SMALL_RECT ReadRegion;
|
|
Karsten Hopp |
4c88de |
+ WORD Y, Y_incr;
|
|
Karsten Hopp |
4c88de |
+
|
|
Karsten Hopp |
4c88de |
if (cb == NULL)
|
|
Karsten Hopp |
4c88de |
return FALSE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
! if (!GetConsoleScreenBufferInfo(g_hConOut, &cb->Info))
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
cb->IsValid = FALSE;
|
|
Karsten Hopp |
4c88de |
return FALSE;
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
cb->IsValid = TRUE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/*
|
|
Karsten Hopp |
4c88de |
! * Allocate a buffer large enough to hold the entire console screen
|
|
Karsten Hopp |
4c88de |
! * buffer. If this ConsoleBuffer structure has already been initialized
|
|
Karsten Hopp |
4c88de |
! * with a buffer of the correct size, then just use that one.
|
|
Karsten Hopp |
4c88de |
*/
|
|
Karsten Hopp |
4c88de |
! if (!cb->IsValid || cb->Buffer == NULL ||
|
|
Karsten Hopp |
4c88de |
! cb->BufferSize.X != cb->Info.dwSize.X ||
|
|
Karsten Hopp |
4c88de |
! cb->BufferSize.Y != cb->Info.dwSize.Y)
|
|
Karsten Hopp |
4c88de |
! {
|
|
Karsten Hopp |
4c88de |
! cb->BufferSize.X = cb->Info.dwSize.X;
|
|
Karsten Hopp |
4c88de |
! cb->BufferSize.Y = cb->Info.dwSize.Y;
|
|
Karsten Hopp |
4c88de |
! NumCells = cb->BufferSize.X * cb->BufferSize.Y;
|
|
Karsten Hopp |
4c88de |
! vim_free(cb->Buffer);
|
|
Karsten Hopp |
4c88de |
! cb->Buffer = (PCHAR_INFO)alloc(NumCells * sizeof(CHAR_INFO));
|
|
Karsten Hopp |
4c88de |
! if (cb->Buffer == NULL)
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
! }
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
+ /*
|
|
Karsten Hopp |
4c88de |
+ * We will now copy the console screen buffer into our buffer.
|
|
Karsten Hopp |
4c88de |
+ * ReadConsoleOutput() seems to be limited as far as how much you
|
|
Karsten Hopp |
4c88de |
+ * can read at a time. Empirically, this number seems to be about
|
|
Karsten Hopp |
4c88de |
+ * 12000 cells (rows * columns). Start at position (0, 0) and copy
|
|
Karsten Hopp |
4c88de |
+ * in chunks until it is all copied. The chunks will all have the
|
|
Karsten Hopp |
4c88de |
+ * same horizontal characteristics, so initialize them now. The
|
|
Karsten Hopp |
4c88de |
+ * height of each chunk will be (12000 / width).
|
|
Karsten Hopp |
4c88de |
+ */
|
|
Karsten Hopp |
4c88de |
BufferCoord.X = 0;
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Left = 0;
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Right = cb->Info.dwSize.X - 1;
|
|
Karsten Hopp |
4c88de |
! Y_incr = 12000 / cb->Info.dwSize.X;
|
|
Karsten Hopp |
4c88de |
! for (Y = 0; Y < cb->BufferSize.Y; Y += Y_incr)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
! /*
|
|
Karsten Hopp |
4c88de |
! * Read into position (0, Y) in our buffer.
|
|
Karsten Hopp |
4c88de |
! */
|
|
Karsten Hopp |
4c88de |
! BufferCoord.Y = Y;
|
|
Karsten Hopp |
4c88de |
! /*
|
|
Karsten Hopp |
4c88de |
! * Read the region whose top left corner is (0, Y) and whose bottom
|
|
Karsten Hopp |
4c88de |
! * right corner is (width - 1, Y + Y_incr - 1). This should define
|
|
Karsten Hopp |
4c88de |
! * a region of size width by Y_incr. Don't worry if this region is
|
|
Karsten Hopp |
4c88de |
! * too large for the remaining buffer; it will be cropped.
|
|
Karsten Hopp |
4c88de |
! */
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Top = Y;
|
|
Karsten Hopp |
4c88de |
! ReadRegion.Bottom = Y + Y_incr - 1;
|
|
Karsten Hopp |
4c88de |
! if (!ReadConsoleOutput(g_hConOut, /* output handle */
|
|
Karsten Hopp |
4c88de |
! cb->Buffer, /* our buffer */
|
|
Karsten Hopp |
4c88de |
! cb->BufferSize, /* dimensions of our buffer */
|
|
Karsten Hopp |
4c88de |
! BufferCoord, /* offset in our buffer */
|
|
Karsten Hopp |
4c88de |
! &ReadRegion)) /* region to save */
|
|
Karsten Hopp |
4c88de |
! {
|
|
Karsten Hopp |
4c88de |
! vim_free(cb->Buffer);
|
|
Karsten Hopp |
4c88de |
! cb->Buffer = NULL;
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
! }
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
return TRUE;
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 2283,2302 ****
|
|
Karsten Hopp |
4c88de |
ConsoleBuffer *cb,
|
|
Karsten Hopp |
4c88de |
BOOL RestoreScreen)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
! HANDLE hConOld;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
if (cb == NULL || !cb->IsValid)
|
|
Karsten Hopp |
4c88de |
return FALSE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
! hConOld = g_hConOut;
|
|
Karsten Hopp |
4c88de |
! g_hConOut = cb->handle;
|
|
Karsten Hopp |
4c88de |
! if (!RestoreScreen && exiting)
|
|
Karsten Hopp |
4c88de |
! CopyOldConsoleBuffer(cb, hConOld);
|
|
Karsten Hopp |
4c88de |
! SetConsoleActiveScreenBuffer(g_hConOut);
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
return TRUE;
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
static ConsoleBuffer g_cbNonTermcap = { 0 };
|
|
Karsten Hopp |
4c88de |
static ConsoleBuffer g_cbTermcap = { 0 };
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
--- 2276,2342 ----
|
|
Karsten Hopp |
4c88de |
ConsoleBuffer *cb,
|
|
Karsten Hopp |
4c88de |
BOOL RestoreScreen)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
! COORD BufferCoord;
|
|
Karsten Hopp |
4c88de |
! SMALL_RECT WriteRegion;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
if (cb == NULL || !cb->IsValid)
|
|
Karsten Hopp |
4c88de |
return FALSE;
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
! /*
|
|
Karsten Hopp |
4c88de |
! * Before restoring the buffer contents, clear the current buffer, and
|
|
Karsten Hopp |
4c88de |
! * restore the cursor position and window information. Doing this now
|
|
Karsten Hopp |
4c88de |
! * prevents old buffer contents from "flashing" onto the screen.
|
|
Karsten Hopp |
4c88de |
! */
|
|
Karsten Hopp |
4c88de |
! if (RestoreScreen)
|
|
Karsten Hopp |
4c88de |
! ClearConsoleBuffer(cb->Info.wAttributes);
|
|
Karsten Hopp |
4c88de |
!
|
|
Karsten Hopp |
4c88de |
! FitConsoleWindow(cb->Info.dwSize, TRUE);
|
|
Karsten Hopp |
4c88de |
! if (!SetConsoleScreenBufferSize(g_hConOut, cb->Info.dwSize))
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
! if (!SetConsoleTextAttribute(g_hConOut, cb->Info.wAttributes))
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
!
|
|
Karsten Hopp |
4c88de |
! if (!RestoreScreen)
|
|
Karsten Hopp |
4c88de |
! {
|
|
Karsten Hopp |
4c88de |
! /*
|
|
Karsten Hopp |
4c88de |
! * No need to restore the screen buffer contents, so we're done.
|
|
Karsten Hopp |
4c88de |
! */
|
|
Karsten Hopp |
4c88de |
! return TRUE;
|
|
Karsten Hopp |
4c88de |
! }
|
|
Karsten Hopp |
4c88de |
!
|
|
Karsten Hopp |
4c88de |
! if (!SetConsoleCursorPosition(g_hConOut, cb->Info.dwCursorPosition))
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
! if (!SetConsoleWindowInfo(g_hConOut, TRUE, &cb->Info.srWindow))
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
!
|
|
Karsten Hopp |
4c88de |
! /*
|
|
Karsten Hopp |
4c88de |
! * Restore the screen buffer contents.
|
|
Karsten Hopp |
4c88de |
! */
|
|
Karsten Hopp |
4c88de |
! if (cb->Buffer != NULL)
|
|
Karsten Hopp |
4c88de |
! {
|
|
Karsten Hopp |
4c88de |
! BufferCoord.X = 0;
|
|
Karsten Hopp |
4c88de |
! BufferCoord.Y = 0;
|
|
Karsten Hopp |
4c88de |
! WriteRegion.Left = 0;
|
|
Karsten Hopp |
4c88de |
! WriteRegion.Top = 0;
|
|
Karsten Hopp |
4c88de |
! WriteRegion.Right = cb->Info.dwSize.X - 1;
|
|
Karsten Hopp |
4c88de |
! WriteRegion.Bottom = cb->Info.dwSize.Y - 1;
|
|
Karsten Hopp |
4c88de |
! if (!WriteConsoleOutput(g_hConOut, /* output handle */
|
|
Karsten Hopp |
4c88de |
! cb->Buffer, /* our buffer */
|
|
Karsten Hopp |
4c88de |
! cb->BufferSize, /* dimensions of our buffer */
|
|
Karsten Hopp |
4c88de |
! BufferCoord, /* offset in our buffer */
|
|
Karsten Hopp |
4c88de |
! &WriteRegion)) /* region to restore */
|
|
Karsten Hopp |
4c88de |
! {
|
|
Karsten Hopp |
4c88de |
! return FALSE;
|
|
Karsten Hopp |
4c88de |
! }
|
|
Karsten Hopp |
4c88de |
! }
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
return TRUE;
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
+ #define FEAT_RESTORE_ORIG_SCREEN
|
|
Karsten Hopp |
4c88de |
+ #ifdef FEAT_RESTORE_ORIG_SCREEN
|
|
Karsten Hopp |
4c88de |
+ static ConsoleBuffer g_cbOrig = { 0 };
|
|
Karsten Hopp |
4c88de |
+ #endif
|
|
Karsten Hopp |
4c88de |
static ConsoleBuffer g_cbNonTermcap = { 0 };
|
|
Karsten Hopp |
4c88de |
static ConsoleBuffer g_cbTermcap = { 0 };
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 2435,2440 ****
|
|
Karsten Hopp |
4c88de |
--- 2475,2483 ----
|
|
Karsten Hopp |
4c88de |
void
|
|
Karsten Hopp |
4c88de |
mch_init(void)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
+ #ifndef FEAT_RESTORE_ORIG_SCREEN
|
|
Karsten Hopp |
4c88de |
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
|
|
Karsten Hopp |
4c88de |
+ #endif
|
|
Karsten Hopp |
4c88de |
#ifndef __MINGW32__
|
|
Karsten Hopp |
4c88de |
extern int _fmode;
|
|
Karsten Hopp |
4c88de |
#endif
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 2455,2468 ****
|
|
Karsten Hopp |
4c88de |
else
|
|
Karsten Hopp |
4c88de |
create_conin();
|
|
Karsten Hopp |
4c88de |
g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
Karsten Hopp |
4c88de |
- g_cbNonTermcap.handle = g_hConOut;
|
|
Karsten Hopp |
4c88de |
- g_cbTermcap.handle = CreateConsoleScreenBuffer(
|
|
Karsten Hopp |
4c88de |
- GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|
Karsten Hopp |
4c88de |
- NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/* Get current text attributes */
|
|
Karsten Hopp |
4c88de |
! SaveConsoleBuffer(&g_cbNonTermcap);
|
|
Karsten Hopp |
4c88de |
! g_attrCurrent = g_attrDefault = g_cbNonTermcap.Info.wAttributes;
|
|
Karsten Hopp |
4c88de |
if (cterm_normal_fg_color == 0)
|
|
Karsten Hopp |
4c88de |
cterm_normal_fg_color = (g_attrCurrent & 0xf) + 1;
|
|
Karsten Hopp |
4c88de |
if (cterm_normal_bg_color == 0)
|
|
Karsten Hopp |
4c88de |
--- 2498,2513 ----
|
|
Karsten Hopp |
4c88de |
else
|
|
Karsten Hopp |
4c88de |
create_conin();
|
|
Karsten Hopp |
4c88de |
g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
+ #ifdef FEAT_RESTORE_ORIG_SCREEN
|
|
Karsten Hopp |
4c88de |
+ /* Save the initial console buffer for later restoration */
|
|
Karsten Hopp |
4c88de |
+ SaveConsoleBuffer(&g_cbOrig);
|
|
Karsten Hopp |
4c88de |
+ g_attrCurrent = g_attrDefault = g_cbOrig.Info.wAttributes;
|
|
Karsten Hopp |
4c88de |
+ #else
|
|
Karsten Hopp |
4c88de |
/* Get current text attributes */
|
|
Karsten Hopp |
4c88de |
! GetConsoleScreenBufferInfo(g_hConOut, &csbi);
|
|
Karsten Hopp |
4c88de |
! g_attrCurrent = g_attrDefault = csbi.wAttributes;
|
|
Karsten Hopp |
4c88de |
! #endif
|
|
Karsten Hopp |
4c88de |
if (cterm_normal_fg_color == 0)
|
|
Karsten Hopp |
4c88de |
cterm_normal_fg_color = (g_attrCurrent & 0xf) + 1;
|
|
Karsten Hopp |
4c88de |
if (cterm_normal_bg_color == 0)
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 2562,2569 ****
|
|
Karsten Hopp |
4c88de |
SetConsoleMode(g_hConIn, g_cmodein);
|
|
Karsten Hopp |
4c88de |
SetConsoleMode(g_hConOut, g_cmodeout);
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
- CloseHandle(g_cbTermcap.handle);
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
#ifdef DYNAMIC_GETTEXT
|
|
Karsten Hopp |
4c88de |
dyn_libintl_end();
|
|
Karsten Hopp |
4c88de |
#endif
|
|
Karsten Hopp |
4c88de |
--- 2607,2612 ----
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 4585,4596 ****
|
|
Karsten Hopp |
4c88de |
else
|
|
Karsten Hopp |
4c88de |
return mch_system_classic(cmd, options);
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
#else
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
# ifdef FEAT_MBYTE
|
|
Karsten Hopp |
4c88de |
static int
|
|
Karsten Hopp |
4c88de |
! mch_system1(char *cmd, int options)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
--- 4628,4638 ----
|
|
Karsten Hopp |
4c88de |
else
|
|
Karsten Hopp |
4c88de |
return mch_system_classic(cmd, options);
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
#else
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
# ifdef FEAT_MBYTE
|
|
Karsten Hopp |
4c88de |
static int
|
|
Karsten Hopp |
4c88de |
! mch_system(char *cmd, int options)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
|
Karsten Hopp |
4c88de |
{
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 4605,4649 ****
|
|
Karsten Hopp |
4c88de |
return system(cmd);
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
# else
|
|
Karsten Hopp |
4c88de |
! # define mch_system1(c, o) system(c)
|
|
Karsten Hopp |
4c88de |
# endif
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
- static int
|
|
Karsten Hopp |
4c88de |
- mch_system(char *cmd, int options)
|
|
Karsten Hopp |
4c88de |
- {
|
|
Karsten Hopp |
4c88de |
- int ret;
|
|
Karsten Hopp |
4c88de |
- HANDLE hTemp = INVALID_HANDLE_VALUE;
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
- /*
|
|
Karsten Hopp |
4c88de |
- * Call DuplicateHandle before executing an external program, because msys
|
|
Karsten Hopp |
4c88de |
- * and msys2's programs will call CreateConsoleScreenBuffer and
|
|
Karsten Hopp |
4c88de |
- * CloseHandle. CreateConsoleScreenBuffer returns the same handle which
|
|
Karsten Hopp |
4c88de |
- * created by vim. This causes a crash. This workaround is required on
|
|
Karsten Hopp |
4c88de |
- * Windows7.
|
|
Karsten Hopp |
4c88de |
- */
|
|
Karsten Hopp |
4c88de |
- if (is_win7
|
|
Karsten Hopp |
4c88de |
- && g_fTermcapMode
|
|
Karsten Hopp |
4c88de |
- && DuplicateHandle(
|
|
Karsten Hopp |
4c88de |
- GetCurrentProcess(),
|
|
Karsten Hopp |
4c88de |
- g_hConOut,
|
|
Karsten Hopp |
4c88de |
- GetCurrentProcess(),
|
|
Karsten Hopp |
4c88de |
- &hTemp,
|
|
Karsten Hopp |
4c88de |
- 0,
|
|
Karsten Hopp |
4c88de |
- TRUE,
|
|
Karsten Hopp |
4c88de |
- DUPLICATE_SAME_ACCESS))
|
|
Karsten Hopp |
4c88de |
- SetConsoleActiveScreenBuffer(hTemp);
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
- ret = mch_system1(cmd, options);
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
- if (hTemp != INVALID_HANDLE_VALUE)
|
|
Karsten Hopp |
4c88de |
- {
|
|
Karsten Hopp |
4c88de |
- SetConsoleActiveScreenBuffer(g_hConOut);
|
|
Karsten Hopp |
4c88de |
- CloseHandle(hTemp);
|
|
Karsten Hopp |
4c88de |
- }
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
- return ret;
|
|
Karsten Hopp |
4c88de |
- }
|
|
Karsten Hopp |
4c88de |
-
|
|
Karsten Hopp |
4c88de |
#endif
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/*
|
|
Karsten Hopp |
4c88de |
--- 4647,4655 ----
|
|
Karsten Hopp |
4c88de |
return system(cmd);
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
# else
|
|
Karsten Hopp |
4c88de |
! # define mch_system(c, o) system(c)
|
|
Karsten Hopp |
4c88de |
# endif
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
#endif
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/*
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 4973,4980 ****
|
|
Karsten Hopp |
4c88de |
* screen buffer, and resize the buffer to match the current window
|
|
Karsten Hopp |
4c88de |
* size. We will use this as the size of our editing environment.
|
|
Karsten Hopp |
4c88de |
*/
|
|
Karsten Hopp |
4c88de |
- g_hConOut = g_cbTermcap.handle;
|
|
Karsten Hopp |
4c88de |
- SetConsoleActiveScreenBuffer(g_hConOut);
|
|
Karsten Hopp |
4c88de |
ClearConsoleBuffer(g_attrCurrent);
|
|
Karsten Hopp |
4c88de |
ResizeConBufAndWindow(g_hConOut, Columns, Rows);
|
|
Karsten Hopp |
4c88de |
}
|
|
Karsten Hopp |
4c88de |
--- 4979,4984 ----
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 5018,5024 ****
|
|
Karsten Hopp |
4c88de |
--- 5022,5032 ----
|
|
Karsten Hopp |
4c88de |
cmodein &= ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT);
|
|
Karsten Hopp |
4c88de |
SetConsoleMode(g_hConIn, cmodein);
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
+ #ifdef FEAT_RESTORE_ORIG_SCREEN
|
|
Karsten Hopp |
4c88de |
+ cb = exiting ? &g_cbOrig : &g_cbNonTermcap;
|
|
Karsten Hopp |
4c88de |
+ #else
|
|
Karsten Hopp |
4c88de |
cb = &g_cbNonTermcap;
|
|
Karsten Hopp |
4c88de |
+ #endif
|
|
Karsten Hopp |
4c88de |
RestoreConsoleBuffer(cb, p_rs);
|
|
Karsten Hopp |
4c88de |
SetConsoleCursorInfo(g_hConOut, &g_cci);
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
*** ../vim-7.4.901/src/version.c 2015-10-30 14:23:29.158200567 +0100
|
|
Karsten Hopp |
4c88de |
--- src/version.c 2015-10-30 16:45:09.697887553 +0100
|
|
Karsten Hopp |
4c88de |
***************
|
|
Karsten Hopp |
4c88de |
*** 743,744 ****
|
|
Karsten Hopp |
4c88de |
--- 743,746 ----
|
|
Karsten Hopp |
4c88de |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
4c88de |
+ /**/
|
|
Karsten Hopp |
4c88de |
+ 902,
|
|
Karsten Hopp |
4c88de |
/**/
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
--
|
|
Karsten Hopp |
4c88de |
Q: Should I clean my house or work on Vim?
|
|
Karsten Hopp |
4c88de |
A: Whatever contains more bugs.
|
|
Karsten Hopp |
4c88de |
|
|
Karsten Hopp |
4c88de |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
4c88de |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
4c88de |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
4c88de |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|