30 #define MORE_STRING _T("-- Press space to view more. Press q or Ctrl+break to cancel.--") 31 #define MORE_EMPTY_STRING _T(" ") 102 DWORD dwCharsWrittenAdd = 0;
106 switch(
p[dwCharsWrittenAdd])
176 DWORD dwRecordsReaded;
179 ASSERT(dwRecordsReaded == 1);
180 if (dwRecordsReaded != 1)
271 #define X_CURSOR_POSITION_FROM_OFFSET(ofs) USHORT(((FristCharCursorPosition.X + ofs)%m_BufferSize.X)) 272 #define Y_CURSOR_POSITION_FROM_OFFSET(ofs) USHORT((FristCharCursorPosition.Y + (FristCharCursorPosition.X + ofs)/m_BufferSize.X)) 275 DWORD dwRecordsReaded;
276 DWORD dwCurrentCharOffset = 0;
277 DWORD dwLastCharOffset = 0;
282 unsigned long long nCompletionIndex = 0;
283 DWORD dwCompletionOffset = 0;
284 DWORD dwCompletionStringSize = 0;
285 COORD CompletionPosition = FristCharCursorPosition;
291 DWORD dwHistoryIndex = 0;
296 ASSERT(dwRecordsReaded == 1);
297 if (dwRecordsReaded != 1)
return FALSE;
336 if (blnCompletionMode) blnCompletionMode =
FALSE;
388 if ((
m_blnInsetMode)||(dwCurrentCharOffset == dwLastCharOffset)) dwLastCharOffset++;
389 dwCurrentCharOffset++;
394 DWORD ofs = dwCurrentCharOffset;
396 while(ofs <= dwLastCharOffset)
404 if (dwCurrentCharOffset < dwLastCharOffset)
427 if (blnCompletionMode) blnCompletionMode =
FALSE;
428 if (dwCurrentCharOffset)
449 ASSERT(dwCurrentCharOffset < dwLastCharOffset);
457 dwCurrentCharOffset--;
474 if (blnCompletionMode) blnCompletionMode =
FALSE;
475 if (dwCurrentCharOffset < dwLastCharOffset)
494 ASSERT(dwCurrentCharOffset <= dwLastCharOffset);
501 dwCurrentCharOffset++;
514 if (blnCompletionMode) blnCompletionMode =
FALSE;
515 dwCurrentCharOffset = 0;
521 if (blnCompletionMode) blnCompletionMode =
FALSE;
522 dwCurrentCharOffset = dwLastCharOffset;
529 if (blnCompletionMode) blnCompletionMode =
FALSE;
534 if (dwLastCharOffset)
540 dwCurrentCharOffset = dwLastCharOffset = 0;
544 dwCurrentCharOffset = dwLastCharOffset =
_tcslen(pchHistoryLine);
560 if (blnCompletionMode) blnCompletionMode =
FALSE;
565 if (dwLastCharOffset)
571 dwCurrentCharOffset = dwLastCharOffset = 0;
577 dwCurrentCharOffset = dwLastCharOffset =
_tcslen(pchHistoryLine);
593 DWORD dwCharOffset = dwCurrentCharOffset;
594 if (dwCharOffset < dwLastCharOffset)
596 while(dwCharOffset < dwLastCharOffset)
623 else if ((ch == 27) && dwLastCharOffset &&
626 if (blnCompletionMode) blnCompletionMode =
FALSE;
631 dwCurrentCharOffset = dwLastCharOffset = 0;
635 else if (ch ==
_T(
'\r'))
642 static TCHAR strLF[] =
_T(
"\n");
646 else if (ch ==
_T(
'\b'))
648 if (blnCompletionMode) blnCompletionMode =
FALSE;
652 COORD NewCursorPosition;
668 DWORD dwCharOffset = dwCurrentCharOffset-1;
669 while(dwCharOffset < dwLastCharOffset-1)
677 dwCurrentCharOffset--;
688 else if (ch ==
_T(
'\t'))
691 if (!blnCompletionMode)
695 nCompletionIndex = (
unsigned long long) -1;
697 nCompletionIndex = 0;
700 dwCompletionOffset = dwCurrentCharOffset;
702 while(dwCompletionOffset)
704 dwCompletionOffset--;
707 blnQuotedParameter = !blnQuotedParameter;
711 dwCompletionOffset++;
716 ASSERT(dwCompletionOffset <= dwCurrentCharOffset);
725 dwCompletionStringSize = dwCurrentCharOffset-dwCompletionOffset;
728 if (dwCompletionStringSize)
744 blnCompletionMode?&blnForward:
NULL,
759 DWORD dwOldCompletionStringSize = dwCompletionStringSize;
762 dwCompletionStringSize =
_tcslen(pchCompletion);
765 if (dwCompletionStringSize > dwFree)
766 dwCompletionStringSize = dwFree;
768 if (dwCompletionStringSize)
778 dwCurrentCharOffset = dwLastCharOffset = dwCompletionOffset + dwCompletionStringSize;
784 if (dwOldCompletionStringSize > dwCompletionStringSize)
787 dwOldCompletionStringSize - dwCompletionStringSize);
793 dwOldCompletionStringSize - dwCompletionStringSize))
804 blnCompletionMode =
TRUE;
808 if (blnCompletionMode) blnCompletionMode =
FALSE;
819 if ((
m_blnInsetMode)||(dwCurrentCharOffset == dwLastCharOffset)) dwLastCharOffset++;
820 dwCurrentCharOffset++;
825 DWORD ofs = dwCurrentCharOffset;
827 while(ofs <= dwLastCharOffset)
835 if (dwCurrentCharOffset < dwLastCharOffset)
962 if (dwMaxHistoryLines)
964 if (!
m_History.
Init(dwBufferSize,dwMaxHistoryLines))
goto Abort;
1000 static COORD BufferCoord = {0,0};
1025 static COORD BufferCoord = {0,0};
1068 DWORD dwRecordsWriten;
BOOL m_blnOldOutputModeSaved
union _KEY_EVENT_RECORD::@3234 uChar
ReplaceCompletionCallback m_pfReplaceCompletionCallback
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
DWORD m_dwOverwriteModeCursorHeight
static VOID Paste(PGUI_CONSOLE_DATA GuiData)
DWORD m_dwInsertModeCursorHeight
void BeginScrollingOperation()
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
#define WriteConsoleInput
*nSize LPSTR _Inout_ LPDWORD nSize
#define INVALID_HANDLE_VALUE
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
BOOL WINAPI FlushConsoleInputBuffer(IN HANDLE hConsoleInput)
DWORD WINAPI GetLastError(VOID)
#define MORE_EMPTY_STRING
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define Y_CURSOR_POSITION_FROM_OFFSET(ofs)
BOOL SetTitle(const TCHAR *p)
#define WriteConsoleOutput
BOOL WINAPI DECLSPEC_HOTPATCH GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, DWORD dwProcessGroupId)
BOOL SetTextAttribute(WORD wAttributes)
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
size_t __cdecl _tcslen(const _TCHAR *str)
BOOL SetInsertMode(BOOL blnInsetMode)
BOOL WINAPI SetConsoleCursorPosition(IN HANDLE hConsoleOutput, IN COORD dwCursorPosition)
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
const TCHAR * GetHistoryLine(DWORD dwIndex)
#define X_CURSOR_POSITION_FROM_OFFSET(ofs)
unsigned int GetTabWidth()
BOOL GetTextAttribute(WORD &rwAttributes)
BOOL WINAPI SetConsoleCursorInfo(IN HANDLE hConsoleOutput, IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo)
void AddHistoryLine(const TCHAR *pchLine)
BOOL Init(DWORD dwMaxHistoryLineSize, DWORD dwMaxHistoryLines)
union _CHAR_INFO::@3233 Char
BOOL WINAPI CloseClipboard(void)
#define LEFT_CTRL_PRESSED
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
void SetReplaceCompletionCallback(ReplaceCompletionCallback pfCallback)
#define STD_OUTPUT_HANDLE
BOOL Write(const TCHAR *p, DWORD dwChars=0)
#define ScrollConsoleScreenBuffer
TCHAR * Init(DWORD dwBufferSize, DWORD dwMaxHistoryLines=0)
BOOL m_blnOldInputModeSaved
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
HANDLE WINAPI GetClipboardData(_In_ UINT)
const TCHAR *(* ReplaceCompletionCallback)(unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pchContext, const TCHAR *pchBegin)
#define RIGHT_CTRL_PRESSED
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
BOOL WriteString(const TCHAR *pchString, COORD Position)