From 92f363bef1c2b0c457ad23c740fbd4f90d04d442 Mon Sep 17 00:00:00 2001 From: bagajjal Date: Fri, 3 Aug 2018 13:29:43 -0700 Subject: [PATCH] Remove console resize (#336) remove the window resize logic in ssh-shellhost.exe --- contrib/win32/win32compat/shell-host.c | 83 +++++++++++++++----------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/contrib/win32/win32compat/shell-host.c b/contrib/win32/win32compat/shell-host.c index d8fdc3182..88d3aa68f 100644 --- a/contrib/win32/win32compat/shell-host.c +++ b/contrib/win32/win32compat/shell-host.c @@ -803,43 +803,54 @@ MonitorChild(_In_ LPVOID lpParameter) unsigned __stdcall ControlThread(LPVOID p) { - short type, row, col; - DWORD len; - COORD coord; - SMALL_RECT rect; - while (1) { - if (!ReadFile(pipe_ctrl, &type, 2, &len, NULL)) - break; - if (type != PTY_SIGNAL_RESIZE_WINDOW) - break; - if (!ReadFile(pipe_ctrl, &col, 2, &len, NULL)) - break; - if (!ReadFile(pipe_ctrl, &row, 2, &len, NULL)) - break; - - /* - * when reducing width, console seemed to retain prior width - * while increasing width, however, it behaves right - * - * hence setting it less by 1 and setting it again to the right - * count - */ - - coord.X = col - 1; - coord.Y = row; - rect.Top = 0; - rect.Left = 0; - rect.Bottom = row - 1; - rect.Right = col - 2; - SetConsoleScreenBufferSize(child_out, coord); - SetConsoleWindowInfo(child_out, TRUE, &rect); - - coord.X = col; - rect.Right = col - 1; - SetConsoleScreenBufferSize(child_out, coord); - SetConsoleWindowInfo(child_out, TRUE, &rect); - } + /* + * TODO - Enable the console resize logic. + * With the current resize logic, we have two issues + * 1) console screen buffer rows should be always 9999, irrespective of the user setting. + * 2) when ssh client window is resized it clears everything and gives a blank screen. + * For now we disable this logic. + * + * It looks to be a bug in our console hook event pty implementation. + */ return 0; + + //short type, row, col; + //DWORD len; + //COORD coord; + //SMALL_RECT rect; + //while (1) { + // if (!ReadFile(pipe_ctrl, &type, 2, &len, NULL)) + // break; + // if (type != PTY_SIGNAL_RESIZE_WINDOW) + // break; + // if (!ReadFile(pipe_ctrl, &col, 2, &len, NULL)) + // break; + // if (!ReadFile(pipe_ctrl, &row, 2, &len, NULL)) + // break; + // + // /* + // * when reducing width, console seemed to retain prior width + // * while increasing width, however, it behaves right + // * + // * hence setting it less by 1 and setting it again to the right + // * count + // */ + // + // coord.X = col - 1; + // coord.Y = row; + // rect.Top = 0; + // rect.Left = 0; + // rect.Bottom = row - 1; + // rect.Right = col - 2; + // SetConsoleScreenBufferSize(child_out, coord); + // SetConsoleWindowInfo(child_out, TRUE, &rect); + + // coord.X = col; + // rect.Right = col - 1; + // SetConsoleScreenBufferSize(child_out, coord); + // SetConsoleWindowInfo(child_out, TRUE, &rect); + //} + //return 0; } DWORD