Commit 6e3a7254 authored by Phil Krylov's avatar Phil Krylov Committed by Alexandre Julliard

riched20: Select word on double click.

parent e0fc7728
......@@ -578,6 +578,17 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
}
void
ME_SelectWord(ME_TextEditor *editor)
{
if (!(editor->pCursors[0].pRun->member.run.nFlags & MERF_ENDPARA))
ME_MoveCursorWords(editor, &editor->pCursors[0], -1);
ME_MoveCursorWords(editor, &editor->pCursors[1], +1);
ME_InvalidateSelection(editor);
ME_SendSelChange(editor);
}
int ME_GetCursorOfs(ME_TextEditor *editor, int nCursor)
{
ME_Cursor *pCursor = &editor->pCursors[nCursor];
......
......@@ -3,6 +3,7 @@
*
* Copyright 2004 by Krzysztof Foltman
* Copyright 2005 by Cihan Altinay
* Copyright 2005 by Phil Krylov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -1837,6 +1838,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
if (GetCapture() == hWnd)
ReleaseCapture();
break;
case WM_LBUTTONDBLCLK:
ME_SelectWord(editor);
break;
case WM_PAINT:
if (editor->bRedraw)
{
......@@ -2167,7 +2171,7 @@ void ME_RegisterEditorClass(HINSTANCE hInstance)
WNDCLASSW wcW;
WNDCLASSA wcA;
wcW.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcW.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcW.lpfnWndProc = RichEditANSIWndProc;
wcW.cbClsExtra = 0;
wcW.cbWndExtra = 4;
......@@ -2183,7 +2187,7 @@ void ME_RegisterEditorClass(HINSTANCE hInstance)
bResult = RegisterClassW(&wcW);
assert(bResult);
wcA.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcA.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcA.lpfnWndProc = RichEditANSIWndProc;
wcA.cbClsExtra = 0;
wcA.cbWndExtra = 4;
......
......@@ -140,6 +140,7 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod);
/* caret.c */
void ME_SetSelection(ME_TextEditor *editor, int from, int to);
void ME_SelectWord(ME_TextEditor *editor);
void ME_HideCaret(ME_TextEditor *ed);
void ME_ShowCaret(ME_TextEditor *ed);
void ME_MoveCaret(ME_TextEditor *ed);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment