diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 9638a7a..ee7bec0 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -235,10 +235,12 @@ ME_MoveCaret(ME_TextEditor *editor) if (ME_WrapMarkedParagraphs(editor)) ME_UpdateScrollBar(editor); ME_GetCursorCoordinates(editor, &editor->pCursors[0], &x, &y, &height); - if(editor->bHaveFocus) + if(editor->bHaveFocus && !ME_IsSelection(editor)) { CreateCaret(editor->hWnd, NULL, 0, height); SetCaretPos(x, y); + } else { + DestroyCaret(); } } @@ -246,13 +248,13 @@ ME_MoveCaret(ME_TextEditor *editor) void ME_ShowCaret(ME_TextEditor *ed) { ME_MoveCaret(ed); - if(ed->bHaveFocus) + if(ed->bHaveFocus && !ME_IsSelection(ed)) ShowCaret(ed->hWnd); } void ME_HideCaret(ME_TextEditor *ed) { - if(ed->bHaveFocus) + if(!ed->bHaveFocus || ME_IsSelection(ed)) { HideCaret(ed->hWnd); DestroyCaret(); @@ -977,8 +979,7 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y) ME_InvalidateSelection(editor); HideCaret(editor->hWnd); - ME_MoveCaret(editor); - ShowCaret(editor->hWnd); + ME_ShowCaret(editor); ME_ClearTempStyle(editor); ME_SendSelChange(editor); } @@ -999,10 +1000,9 @@ void ME_MouseMove(ME_TextEditor *editor, int x, int y) ME_ExtendAnchorSelection(editor); - HideCaret(editor->hWnd); - ME_MoveCaret(editor); ME_InvalidateSelection(editor); - ShowCaret(editor->hWnd); + HideCaret(editor->hWnd); + ME_ShowCaret(editor); ME_SendSelChange(editor); } diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index b363843..f23a915 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2136,6 +2136,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ME_InvalidateSelection(editor); ME_SetSelection(editor, wParam, lParam); ME_InvalidateSelection(editor); + HideCaret(editor->hWnd); + ME_ShowCaret(editor); ME_SendSelChange(editor); return 0; } @@ -2168,6 +2170,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ME_InvalidateSelection(editor); end = ME_SetSelection(editor, range.cpMin, range.cpMax); ME_InvalidateSelection(editor); + HideCaret(editor->hWnd); + ME_ShowCaret(editor); ME_SendSelChange(editor); return end; @@ -3066,8 +3070,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, return 0; case WM_KILLFOCUS: ME_CommitUndo(editor); /* End coalesced undos for typed characters */ - ME_HideCaret(editor); editor->bHaveFocus = FALSE; + ME_HideCaret(editor); ME_SendOldNotify(editor, EN_KILLFOCUS); return 0; case WM_ERASEBKGND: