mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.0940: MS-Windows console resizing not handled properly
Problem: MS-Windows console resizing not handled properly. Solution: Handle resizing the console better. (Nobuhiro Takasaki, closes #3968, closes #3611)
This commit is contained in:
parent
3678f65d43
commit
78d21dae9c
@ -9852,6 +9852,9 @@ ex_redraw(exarg_T *eap)
|
|||||||
#ifdef FEAT_TITLE
|
#ifdef FEAT_TITLE
|
||||||
if (need_maketitle)
|
if (need_maketitle)
|
||||||
maketitle();
|
maketitle();
|
||||||
|
#endif
|
||||||
|
#if defined(WIN3264) && !defined(FEAT_GUI_W32)
|
||||||
|
resize_console_buf();
|
||||||
#endif
|
#endif
|
||||||
RedrawingDisabled = r;
|
RedrawingDisabled = r;
|
||||||
p_lz = p;
|
p_lz = p;
|
||||||
|
@ -5401,6 +5401,9 @@ nv_clear(cmdarg_T *cap)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
redraw_later(CLEAR);
|
redraw_later(CLEAR);
|
||||||
|
#if defined(WIN3264) && !defined(FEAT_GUI_W32)
|
||||||
|
resize_console_buf();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1492,6 +1492,8 @@ handle_focus_event(INPUT_RECORD ir)
|
|||||||
ui_focus_change((int)g_fJustGotFocus);
|
ui_focus_change((int)g_fJustGotFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ResizeConBuf(HANDLE hConsole, COORD coordScreen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait until console input from keyboard or mouse is available,
|
* Wait until console input from keyboard or mouse is available,
|
||||||
* or the time is up.
|
* or the time is up.
|
||||||
@ -1657,11 +1659,18 @@ WaitForChar(long msec, int ignore_input)
|
|||||||
handle_focus_event(ir);
|
handle_focus_event(ir);
|
||||||
else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT)
|
else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT)
|
||||||
{
|
{
|
||||||
/* Only call shell_resized() when the size actually change to
|
COORD dwSize = ir.Event.WindowBufferSizeEvent.dwSize;
|
||||||
* avoid the screen is cleard. */
|
|
||||||
if (ir.Event.WindowBufferSizeEvent.dwSize.X != Columns
|
// Only call shell_resized() when the size actually change to
|
||||||
|| ir.Event.WindowBufferSizeEvent.dwSize.Y != Rows)
|
// avoid the screen is cleard.
|
||||||
|
if (dwSize.X != Columns || dwSize.Y != Rows)
|
||||||
|
{
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
GetConsoleScreenBufferInfo(g_hConOut, &csbi);
|
||||||
|
dwSize.Y = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
|
||||||
|
ResizeConBuf(g_hConOut, dwSize);
|
||||||
shell_resized();
|
shell_resized();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MOUSE
|
#ifdef FEAT_MOUSE
|
||||||
else if (ir.EventType == MOUSE_EVENT
|
else if (ir.EventType == MOUSE_EVENT
|
||||||
@ -6327,7 +6336,7 @@ write_chars(
|
|||||||
* character was written, otherwise we get stuck. */
|
* character was written, otherwise we get stuck. */
|
||||||
if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length,
|
if (WriteConsoleOutputCharacterW(g_hConOut, unicodebuf, length,
|
||||||
coord, &cchwritten) == 0
|
coord, &cchwritten) == 0
|
||||||
|| cchwritten == 0)
|
|| cchwritten == 0 || cchwritten == (DWORD)-1)
|
||||||
cchwritten = 1;
|
cchwritten = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -6361,7 +6370,7 @@ write_chars(
|
|||||||
* character was written, otherwise we get stuck. */
|
* character was written, otherwise we get stuck. */
|
||||||
if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite,
|
if (WriteConsoleOutputCharacter(g_hConOut, (LPCSTR)pchBuf, cbToWrite,
|
||||||
coord, &written) == 0
|
coord, &written) == 0
|
||||||
|| written == 0)
|
|| written == 0 || written == (DWORD)-1)
|
||||||
written = 1;
|
written = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -7707,7 +7716,7 @@ vtp_flag_init(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef FEAT_GUI_W32
|
#if !defined(FEAT_GUI_W32) || defined(PROTO)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vtp_init(void)
|
vtp_init(void)
|
||||||
@ -7931,3 +7940,28 @@ is_conpty_stable(void)
|
|||||||
{
|
{
|
||||||
return conpty_stable;
|
return conpty_stable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(FEAT_GUI_W32) || defined(PROTO)
|
||||||
|
void
|
||||||
|
resize_console_buf(void)
|
||||||
|
{
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
COORD coord;
|
||||||
|
SMALL_RECT newsize;
|
||||||
|
|
||||||
|
if (GetConsoleScreenBufferInfo(g_hConOut, &csbi))
|
||||||
|
{
|
||||||
|
coord.X = SRWIDTH(csbi.srWindow);
|
||||||
|
coord.Y = SRHEIGHT(csbi.srWindow);
|
||||||
|
SetConsoleScreenBufferSize(g_hConOut, coord);
|
||||||
|
|
||||||
|
newsize.Left = 0;
|
||||||
|
newsize.Top = 0;
|
||||||
|
newsize.Right = coord.X - 1;
|
||||||
|
newsize.Bottom = coord.Y - 1;
|
||||||
|
SetConsoleWindowInfo(g_hConOut, TRUE, &newsize);
|
||||||
|
|
||||||
|
SetConsoleScreenBufferSize(g_hConOut, coord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -75,4 +75,5 @@ int is_term_win32(void);
|
|||||||
int has_vtp_working(void);
|
int has_vtp_working(void);
|
||||||
int has_conpty_working(void);
|
int has_conpty_working(void);
|
||||||
int is_conpty_stable(void);
|
int is_conpty_stable(void);
|
||||||
|
void resize_console_buf(void);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
@ -779,6 +779,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
940,
|
||||||
/**/
|
/**/
|
||||||
939,
|
939,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user