Author: hbelusca
Date: Sun Apr  6 17:46:49 2014
New Revision: 62670

URL: http://svn.reactos.org/svn/reactos?rev=62670&view=rev
Log:
[CONSRV]
- text.c: Few code formatting, and remove a warning.
- guiterm.c: Implement basic word selection.

Modified:
    trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c
    trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c

Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c?rev=62670&r1=62669&r2=62670&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c    
[iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c    
[iso-8859-1] Sun Apr  6 17:46:49 2014
@@ -1162,7 +1162,42 @@
 
             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;
             }
 

Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c?rev=62670&r1=62669&r2=62670&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c       
[iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c       
[iso-8859-1] Sun Apr  6 17:46:49 2014
@@ -89,9 +89,9 @@
 
     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 @@
     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);


Reply via email to