remove setting the console title (#494)
This commit is contained in:
parent
794bf53f49
commit
5bcc5aa4d0
|
@ -56,8 +56,10 @@ int LastCursorX;
|
|||
int LastCursorY;
|
||||
BOOL isAnsiParsingRequired = FALSE;
|
||||
BOOL isConsoleVTSeqAvailable = FALSE;
|
||||
/* 1 - We track the viewport (visible window) and restore it back because console renders badly when user scroll up/down */
|
||||
int track_view_port = 0;
|
||||
/* 1 - We track the viewport (visible window) and restore it back because
|
||||
* console renders badly when user scroll up/down. Only used if ConPTY not
|
||||
* available. */
|
||||
int track_view_port_no_pty_hack= 0;
|
||||
char *pSavedScreen = NULL;
|
||||
static COORD ZeroCoord = { 0,0 };
|
||||
COORD SavedScreenSize = { 0,0 };
|
||||
|
@ -75,8 +77,6 @@ typedef struct _SCREEN_RECORD {
|
|||
|
||||
PSCREEN_RECORD pSavedScreenRec = NULL;
|
||||
int in_raw_mode = 0;
|
||||
char *consoleTitle = "OpenSSH SSH client";
|
||||
|
||||
|
||||
HANDLE
|
||||
GetConsoleOutputHandle()
|
||||
|
@ -140,8 +140,6 @@ ConEnterRawMode()
|
|||
return;
|
||||
}
|
||||
|
||||
SetConsoleTitle(consoleTitle);
|
||||
|
||||
dwAttributes = stdin_dwSavedAttributes;
|
||||
dwAttributes &= ~(ENABLE_LINE_INPUT |
|
||||
ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
|
||||
|
@ -188,7 +186,7 @@ ConEnterRawMode()
|
|||
|
||||
/* We track the view port, if conpty is not supported */
|
||||
if (!is_conpty_supported())
|
||||
track_view_port = 1;
|
||||
track_view_port_no_pty_hack= 1;
|
||||
|
||||
/* if we are passing rawbuffer to console then we need to move the cursor to top
|
||||
* so that the clearscreen will not erase any lines.
|
||||
|
@ -210,8 +208,8 @@ ConEnterRawMode()
|
|||
else
|
||||
error("Failed to set console input code page from:%d to %d error:%d", console_in_cp_saved, CP_UTF8, GetLastError());
|
||||
|
||||
if (track_view_port) {
|
||||
ConSaveViewRect();
|
||||
if (track_view_port_no_pty_hack) {
|
||||
ConSaveViewRect_NoPtyHack();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,8 +323,8 @@ ConSetScreenRect(int xSize, int ySize)
|
|||
bSuccess = SetConsoleScreenBufferSize(GetConsoleOutputHandle(), coordScreen);
|
||||
}
|
||||
|
||||
if (bSuccess && track_view_port)
|
||||
ConSaveViewRect();
|
||||
if (bSuccess && track_view_port_no_pty_hack)
|
||||
ConSaveViewRect_NoPtyHack();
|
||||
|
||||
/* if the current buffer *is* the size we want, don't do anything! */
|
||||
return bSuccess;
|
||||
|
@ -372,8 +370,8 @@ ConSetScreenSize(int xSize, int ySize)
|
|||
bSuccess = SetConsoleWindowInfo(GetConsoleOutputHandle(), TRUE, &srWindowRect);
|
||||
}
|
||||
|
||||
if (bSuccess && track_view_port)
|
||||
ConSaveViewRect();
|
||||
if (bSuccess && track_view_port_no_pty_hack)
|
||||
ConSaveViewRect_NoPtyHack();
|
||||
|
||||
/* if the current buffer *is* the size we want, don't do anything! */
|
||||
return bSuccess;
|
||||
|
@ -1589,7 +1587,7 @@ ConSaveScreen()
|
|||
}
|
||||
|
||||
void
|
||||
ConSaveViewRect()
|
||||
ConSaveViewRect_NoPtyHack()
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
if (GetConsoleScreenBufferInfo(GetConsoleOutputHandle(), &csbi))
|
||||
|
@ -1597,10 +1595,10 @@ ConSaveViewRect()
|
|||
}
|
||||
|
||||
void
|
||||
ConRestoreViewRect()
|
||||
ConRestoreViewRect_NoPtyHack()
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
|
||||
HWND hwnd = FindWindow(NULL, consoleTitle);
|
||||
HWND hwnd = GetConsoleWindow();
|
||||
|
||||
WINDOWPLACEMENT wp;
|
||||
wp.length = sizeof(WINDOWPLACEMENT);
|
||||
|
@ -1646,8 +1644,8 @@ ConMoveCursorTopOfVisibleWindow()
|
|||
offset = csbi.dwCursorPosition.Y - csbi.srWindow.Top;
|
||||
ConMoveVisibleWindow(offset);
|
||||
|
||||
if(track_view_port)
|
||||
ConSaveViewRect();
|
||||
if(track_view_port_no_pty_hack)
|
||||
ConSaveViewRect_NoPtyHack();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,8 +140,8 @@ BOOL ConRestoreScreenHandle(SCREEN_HANDLE hScreen);
|
|||
BOOL ConRestoreScreenColors();
|
||||
SCREEN_HANDLE ConSaveScreenHandle(SCREEN_HANDLE);
|
||||
void ConDeleteScreenHandle(SCREEN_HANDLE hScreen);
|
||||
void ConSaveViewRect();
|
||||
void ConRestoreViewRect();
|
||||
void ConSaveViewRect_NoPtyHack();
|
||||
void ConRestoreViewRect_NoPtyHack();
|
||||
void ConDeleteChars(int n);
|
||||
void ConSaveWindowsState();
|
||||
void ConMoveVisibleWindow(int offset);
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
extern BOOL isAnsiParsingRequired;
|
||||
extern BOOL isConsoleVTSeqAvailable;
|
||||
extern int track_view_port;
|
||||
extern int track_view_port_no_pty_hack;
|
||||
extern bool gbVTAppMode;
|
||||
BOOL isFirstPacket = TRUE;
|
||||
|
||||
|
@ -99,14 +99,14 @@ processBuffer(HANDLE handle, char *buf, DWORD len, unsigned char **respbuf, size
|
|||
/* WriteFile() gets messy when user does scroll up/down so we need to restore the visible window.
|
||||
* It's a conhost bug but we need to live with it as they are not going to back port the fix.
|
||||
*/
|
||||
if(track_view_port)
|
||||
ConRestoreViewRect();
|
||||
if(track_view_port_no_pty_hack)
|
||||
ConRestoreViewRect_NoPtyHack();
|
||||
|
||||
/* Console has the capability to parse so pass the raw buffer to console directly */
|
||||
WriteFile(handle, buf, len, 0, 0);
|
||||
|
||||
if (track_view_port)
|
||||
ConSaveViewRect();
|
||||
if (track_view_port_no_pty_hack)
|
||||
ConSaveViewRect_NoPtyHack();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue