mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[CONSRV]
- text.c: Few code formatting, and remove a warning. - guiterm.c: Implement basic word selection. svn path=/trunk/; revision=62670
This commit is contained in:
parent
0888fb5cb5
commit
0c43ce824a
2 changed files with 39 additions and 4 deletions
|
@ -1162,7 +1162,42 @@ GuiConsoleHandleMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM
|
|||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
DPRINT1("Handle left-double-click for selecting a word\n");
|
||||
PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer;
|
||||
|
||||
if (GetType(Buffer) == TEXTMODE_BUFFER)
|
||||
{
|
||||
#define IS_WHITESPACE(c) \
|
||||
((c) == L'\0' || (c) == L' ' || (c) == L'\t' || (c) == L'\r' || (c) == L'\n')
|
||||
|
||||
PTEXTMODE_SCREEN_BUFFER TextBuffer = (PTEXTMODE_SCREEN_BUFFER)Buffer;
|
||||
COORD cL, cR;
|
||||
PCHAR_INFO ptrL, ptrR;
|
||||
|
||||
/* Starting point */
|
||||
cL = cR = PointToCoord(GuiData, lParam);
|
||||
ptrL = ptrR = ConioCoordToPointer(TextBuffer, cL.X, cL.Y);
|
||||
|
||||
/* Enlarge the selection by checking for whitespace */
|
||||
while ((0 < cL.X) && !IS_WHITESPACE(ptrL->Char.UnicodeChar)
|
||||
&& !IS_WHITESPACE((ptrL-1)->Char.UnicodeChar))
|
||||
{
|
||||
--cL.X;
|
||||
--ptrL;
|
||||
}
|
||||
while ((cR.X < TextBuffer->ScreenBufferSize.X - 1) &&
|
||||
!IS_WHITESPACE(ptrR->Char.UnicodeChar) &&
|
||||
!IS_WHITESPACE((ptrR+1)->Char.UnicodeChar))
|
||||
{
|
||||
++cR.X;
|
||||
++ptrR;
|
||||
}
|
||||
|
||||
Console->Selection.dwSelectionAnchor = cL;
|
||||
Console->dwSelectionCursor = cR;
|
||||
|
||||
GuiConsoleUpdateSelection(Console, &Console->dwSelectionCursor);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,9 +89,9 @@ GuiCopyFromTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
|
|||
|
||||
for (yPos = 0; yPos < selHeight; yPos++)
|
||||
{
|
||||
ptr = ConioCoordToPointer(Buffer,
|
||||
ptr = ConioCoordToPointer(Buffer,
|
||||
Console->Selection.srSelection.Left,
|
||||
yPos + Console->Selection.srSelection.Top);
|
||||
Console->Selection.srSelection.Top + yPos);
|
||||
/* Copy only the characters, leave attributes alone */
|
||||
for (xPos = 0; xPos < selWidth; xPos++)
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ GuiPasteToTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
|
|||
LPWSTR str;
|
||||
WCHAR CurChar = 0;
|
||||
|
||||
SHORT VkKey; // MAKEWORD(low = vkey_code, high = shift_state);
|
||||
USHORT VkKey; // MAKEWORD(low = vkey_code, high = shift_state);
|
||||
INPUT_RECORD er;
|
||||
|
||||
hData = GetClipboardData(CF_UNICODETEXT);
|
||||
|
|
Loading…
Reference in a new issue