Skip to content

Commit

Permalink
gh-629: Don't imply ‘AppKeys’ mode (DECCKM) by -cur_console:p or `E…
Browse files Browse the repository at this point in the history
…NABLE_VIRTUAL_TERMINAL_INPUT`.
  • Loading branch information
Maximus5 committed Apr 16, 2018
1 parent 160bfb7 commit 56e771f
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/ConEmu/RealConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4436,11 +4436,11 @@ void CRealConsole::UpdateRootInfo(const CESERVER_ROOT_INFO& RootInfo)
if (m_Args.nPTY)
{
// xterm keys notation
StartStopXTerm(RootInfo.nPID, ((m_Args.nPTY & 1) == 1));
StartStopXTerm(RootInfo.nPID, (m_Args.nPTY & pty_XTerm));
// Bracketed paste
StartStopBracketedPaste(RootInfo.nPID, ((m_Args.nPTY & 2) == 2));
StartStopBracketedPaste(RootInfo.nPID, (m_Args.nPTY & pty_BrPaste));
// Application cursor keys
StartStopAppCursorKeys(RootInfo.nPID, ((m_Args.nPTY & 4) == 4));
StartStopAppCursorKeys(RootInfo.nPID, (m_Args.nPTY & pty_AppKeys));
}
}

Expand Down Expand Up @@ -6287,7 +6287,7 @@ bool CRealConsole::StartStopTermMode(TermModeCommand mode, ChangeTermAction acti

switch (mode)
{
case tmc_Keyboard:
case tmc_TerminalType:
if (action == cta_Switch)
bValue = (GetTermType() == te_win32);
StartStopXTerm(nActivePID, bValue);
Expand Down
2 changes: 1 addition & 1 deletion src/ConEmu/RealServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ CESERVER_REQ* CRealServer::cmdStartXTerm(LPVOID pInst, CESERVER_REQ* pIn, UINT n

switch (mode)
{
case tmc_Keyboard:
case tmc_TerminalType:
_ASSERTE(value == te_win32 || value == te_xterm);
mp_RCon->StartStopXTerm(nPID, (value != te_win32));
break;
Expand Down
2 changes: 1 addition & 1 deletion src/ConEmu/Status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 +2196,7 @@ bool CStatus::ProcessTermModeMenuId(WORD nCmd)
switch (nCmd)
{
case 1: case 2:
mode = tmc_Keyboard;
mode = tmc_TerminalType;
action = (nCmd == 2) ? cta_Enable : cta_Disable;
break;
case 3:
Expand Down
2 changes: 1 addition & 1 deletion src/ConEmuHk/Ansi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3983,7 +3983,7 @@ void CEAnsi::StartXTermMode(bool bStart)

// Remember last mode
gbWasXTermOutput = bStart;
ChangeTermMode(tmc_Keyboard, bStart ? te_xterm : te_win32);
ChangeTermMode(tmc_TerminalType, bStart ? te_xterm : te_win32);
}

// This is useful when user press Shift+Home,
Expand Down
2 changes: 1 addition & 1 deletion src/ConEmuHk/ShellProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3030,7 +3030,7 @@ void CShellProc::OnCreateProcessFinished(BOOL abSucceeded, PROCESS_INFORMATION *

if (m_Args.nPTY)
{
CEAnsi::ChangeTermMode(tmc_Keyboard, (m_Args.nPTY == 1), lpPI->dwProcessId);
CEAnsi::ChangeTermMode(tmc_TerminalType, (m_Args.nPTY & pty_XTerm) ? 1 : 0, lpPI->dwProcessId);
}

if (isDefTermEnabled())
Expand Down
4 changes: 2 additions & 2 deletions src/ConEmuHk/hkConsoleOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ BOOL WINAPI OnSetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
{
_ASSERT(HandleKeeper::IsInputHandle(hConsoleHandle));
CEAnsi::StartXTermMode((dwMode & ENABLE_VIRTUAL_TERMINAL_INPUT) != 0);
if (dwMode & ENABLE_VIRTUAL_TERMINAL_INPUT)
CEAnsi::ChangeTermMode(tmc_AppCursorKeys, true);
//if (dwMode & ENABLE_VIRTUAL_TERMINAL_INPUT)
// CEAnsi::ChangeTermMode(tmc_AppCursorKeys, true);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ enum RealBufferScroll
// `console` - survive on process termination
enum TermModeCommand
{
tmc_Keyboard = 0, // TermEmulationType - process life-time
tmc_TerminalType = 0, // TermEmulationType - process life-time
tmc_BracketedPaste = 1, // true/false - process life-time
tmc_AppCursorKeys = 2, // true/false - process life-time
tmc_CursorShape = 3, // TermCursorShapes - ***console*** life-time
Expand All @@ -378,7 +378,7 @@ enum TermModeCommand
tmc_Last
};

// tmc_Keyboard: used for control keys (arrows e.g.) translation
// tmc_TerminalType: used for control keys (arrows e.g.) translation
enum TermEmulationType
{
te_win32 = 0,
Expand Down Expand Up @@ -507,7 +507,7 @@ const CECMD
CECMD_GUICLIENTSHIFT = 71, // GuiStylesAndShifts
CECMD_ALTBUFFER = 72, // CESERVER_REQ_ALTBUFFER: CmdOutputStore/Restore
CECMD_ALTBUFFERSTATE = 73, // Проверить, разрешен ли Alt.Buffer?
CECMD_STARTXTERM = 74, // dwData[0]=TermModeCommand, dwData[1]=value (TermEmulationType for tmc_Keyboard, and so on), dwData[2]=the PID (may differ from hdr's one).
CECMD_STARTXTERM = 74, // dwData[0]=TermModeCommand, dwData[1]=value (TermEmulationType for tmc_TerminalType, and so on), dwData[2]=the PID (may differ from hdr's one).
//CECMD_DEFTERMSTARTED = 75, // Уведомить GUI, что инициализация хуков для Default Terminal была завершена -- не требуется, ConEmuC ждет успеха
CECMD_UPDCONMAPHDR = 76, // AltServer не может менять CESERVER_CONSOLE_MAPPING_HDR во избежание конфликтов. Это делает только RM_MAINSERVER (req.ConInfo)
CECMD_SETCONSCRBUF = 77, // CESERVER_REQ_SETCONSCRBUF - temporarily block active server reading thread to change console buffer size
Expand Down
2 changes: 1 addition & 1 deletion src/common/RConStartArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ int RConStartArgs::ProcessNewConArg(bool bForceCurConsole /*= false*/)
}
else
{
nPTY = DefaultPtyFlags; // xterm + app cursor keys
nPTY = pty_Default; // xterm mode
}
break;

Expand Down
10 changes: 8 additions & 2 deletions src/common/RConStartArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ enum RConBoolArg
};

#define DefaultSplitValue 500
#define DefaultPtyFlags (1|4)

typedef UINT PtyFlags;
const PtyFlags
pty_XTerm = 1,
pty_BrPaste = 2,
pty_AppKeys = 4,
pty_Default = pty_XTerm;

struct RConStartArgs
{
Expand Down Expand Up @@ -86,7 +92,7 @@ struct RConStartArgs

RConBoolArg OverwriteMode; // -new_console:w - enable "Overwrite" mode in console prompt

UINT nPTY; // -new_console:p[N] - change pty modes, N is bitmask: 1 - xterm keyboard, 2 - bracketed paste, 4 - app cursor keys
PtyFlags nPTY; // -new_console:p[N] - change pty modes, N is bitmask: 1 - xterm keyboard, 2 - bracketed paste, 4 - app cursor keys

RConBoolArg BufHeight; // -new_console:h<lines>
UINT nBufHeight; //
Expand Down
2 changes: 1 addition & 1 deletion src/common/RConStartArgsEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ wchar_t* RConStartArgsEx::CreateCommandLine(bool abForTasks /*= false*/) const
else if (OverwriteMode == crb_Off)
wcscat_c(szAdd, L"w0");

if (nPTY == DefaultPtyFlags)
if (nPTY == pty_Default)
wcscat_c(szAdd, L"p");
else if (nPTY)
msprintf(szAdd+lstrlen(szAdd), 15, L"p%u", nPTY);
Expand Down

0 comments on commit 56e771f

Please sign in to comment.