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) ...@@ -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) int ME_GetCursorOfs(ME_TextEditor *editor, int nCursor)
{ {
ME_Cursor *pCursor = &editor->pCursors[nCursor]; ME_Cursor *pCursor = &editor->pCursors[nCursor];
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2004 by Krzysztof Foltman * Copyright 2004 by Krzysztof Foltman
* Copyright 2005 by Cihan Altinay * Copyright 2005 by Cihan Altinay
* Copyright 2005 by Phil Krylov
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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 ...@@ -1837,6 +1838,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
if (GetCapture() == hWnd) if (GetCapture() == hWnd)
ReleaseCapture(); ReleaseCapture();
break; break;
case WM_LBUTTONDBLCLK:
ME_SelectWord(editor);
break;
case WM_PAINT: case WM_PAINT:
if (editor->bRedraw) if (editor->bRedraw)
{ {
...@@ -2167,7 +2171,7 @@ void ME_RegisterEditorClass(HINSTANCE hInstance) ...@@ -2167,7 +2171,7 @@ void ME_RegisterEditorClass(HINSTANCE hInstance)
WNDCLASSW wcW; WNDCLASSW wcW;
WNDCLASSA wcA; WNDCLASSA wcA;
wcW.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; wcW.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcW.lpfnWndProc = RichEditANSIWndProc; wcW.lpfnWndProc = RichEditANSIWndProc;
wcW.cbClsExtra = 0; wcW.cbClsExtra = 0;
wcW.cbWndExtra = 4; wcW.cbWndExtra = 4;
...@@ -2183,7 +2187,7 @@ void ME_RegisterEditorClass(HINSTANCE hInstance) ...@@ -2183,7 +2187,7 @@ void ME_RegisterEditorClass(HINSTANCE hInstance)
bResult = RegisterClassW(&wcW); bResult = RegisterClassW(&wcW);
assert(bResult); assert(bResult);
wcA.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS; wcA.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcA.lpfnWndProc = RichEditANSIWndProc; wcA.lpfnWndProc = RichEditANSIWndProc;
wcA.cbClsExtra = 0; wcA.cbClsExtra = 0;
wcA.cbWndExtra = 4; wcA.cbWndExtra = 4;
......
...@@ -140,6 +140,7 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod); ...@@ -140,6 +140,7 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod);
/* caret.c */ /* caret.c */
void ME_SetSelection(ME_TextEditor *editor, int from, int to); void ME_SetSelection(ME_TextEditor *editor, int from, int to);
void ME_SelectWord(ME_TextEditor *editor);
void ME_HideCaret(ME_TextEditor *ed); void ME_HideCaret(ME_TextEditor *ed);
void ME_ShowCaret(ME_TextEditor *ed); void ME_ShowCaret(ME_TextEditor *ed);
void ME_MoveCaret(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