Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[APSTUD-1469] fix Ctrl+C handling for Terminal apps; add special hand…

…ling for SSH process
  • Loading branch information...
commit 6cce4a44e0f2071a78ef5f7ad630d855304393e2 1 parent 9ea9723
@mstepanov mstepanov authored
View
22 native/wintty/consolehandler.cpp
@@ -663,6 +663,7 @@ static void ReadConsoleBuffer()
}
static BOOL ProcessEscSequence(CHAR *chSequence, DWORD dwLength);
+static BOOL IsSpecialConsoleApp();
#define ESC '\x1B'
#define DLE '\x10'
@@ -724,10 +725,10 @@ static void WriteConsole(void)
SHORT state = HIBYTE(key);
DWORD dwKeyState = 0;
key = LOBYTE(key);
- /*if( (key == VK_CANCEL) ) {
+ if( (key == VK_CANCEL && !IsSpecialConsoleApp()) ) {
::GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
continue;
- }*/
+ }
if( (key == VK_BACK) )
{
ch = ::MapVirtualKey(key, 2/*MAPVK_VK_TO_CHAR*/);
@@ -983,4 +984,21 @@ static void SendProcessList()
}
OutputChar('p');
FlushBuffer();
+}
+
+static BOOL IsSpecialConsoleApp()
+{
+ BOOL bResult = FALSE;
+ DWORD dwProcesses[64];
+ DWORD dwCount = ::GetConsoleProcessList(dwProcesses, sizeof(dwProcesses)/sizeof(dwProcesses[0]));
+ HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcesses[0]);
+ if (hModuleSnap != INVALID_HANDLE_VALUE) {
+ MODULEENTRY32 me32 = {0};
+ me32.dwSize = sizeof(MODULEENTRY32);
+ if (Module32First(hModuleSnap, &me32)) {
+ bResult = wcsstr(me32.szExePath, _T("ssh.exe")) != NULL;
+ }
+ CloseHandle(hModuleSnap);
+ }
+ return bResult;
}
View
BIN  plugins/com.aptana.terminal/os/win32/wintty.dll
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.