Commit 94dfc0e8 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Don't mess with the caret if we don't have focus.

parent e848f6d5
...@@ -232,21 +232,28 @@ ME_MoveCaret(ME_TextEditor *editor) ...@@ -232,21 +232,28 @@ ME_MoveCaret(ME_TextEditor *editor)
ME_WrapMarkedParagraphs(editor); ME_WrapMarkedParagraphs(editor);
ME_GetCursorCoordinates(editor, &editor->pCursors[0], &x, &y, &height); ME_GetCursorCoordinates(editor, &editor->pCursors[0], &x, &y, &height);
CreateCaret(editor->hWnd, NULL, 0, height); if(editor->bHaveFocus)
SetCaretPos(x, y); {
CreateCaret(editor->hWnd, NULL, 0, height);
SetCaretPos(x, y);
}
} }
void ME_ShowCaret(ME_TextEditor *ed) void ME_ShowCaret(ME_TextEditor *ed)
{ {
ME_MoveCaret(ed); ME_MoveCaret(ed);
ShowCaret(ed->hWnd); if(ed->bHaveFocus)
ShowCaret(ed->hWnd);
} }
void ME_HideCaret(ME_TextEditor *ed) void ME_HideCaret(ME_TextEditor *ed)
{ {
HideCaret(ed->hWnd); if(ed->bHaveFocus)
DestroyCaret(); {
HideCaret(ed->hWnd);
DestroyCaret();
}
} }
void ME_InternalDeleteText(ME_TextEditor *editor, int nOfs, void ME_InternalDeleteText(ME_TextEditor *editor, int nOfs,
......
...@@ -1153,6 +1153,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) { ...@@ -1153,6 +1153,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) {
ed->lpOleCallback = NULL; ed->lpOleCallback = NULL;
ed->mode = TM_RICHTEXT | TM_MULTILEVELUNDO | TM_MULTICODEPAGE; ed->mode = TM_RICHTEXT | TM_MULTILEVELUNDO | TM_MULTICODEPAGE;
ed->AutoURLDetect_bEnable = FALSE; ed->AutoURLDetect_bEnable = FALSE;
ed->bHaveFocus = FALSE;
GetClientRect(hWnd, &ed->rcFormat); GetClientRect(hWnd, &ed->rcFormat);
for (i=0; i<HFONT_CACHE_SIZE; i++) for (i=0; i<HFONT_CACHE_SIZE; i++)
{ {
...@@ -2335,11 +2336,13 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -2335,11 +2336,13 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
} }
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
editor->bHaveFocus = TRUE;
ME_ShowCaret(editor); ME_ShowCaret(editor);
ME_SendOldNotify(editor, EN_SETFOCUS); ME_SendOldNotify(editor, EN_SETFOCUS);
return 0; return 0;
case WM_KILLFOCUS: case WM_KILLFOCUS:
ME_HideCaret(editor); ME_HideCaret(editor);
editor->bHaveFocus = FALSE;
ME_SendOldNotify(editor, EN_KILLFOCUS); ME_SendOldNotify(editor, EN_KILLFOCUS);
return 0; return 0;
case WM_ERASEBKGND: case WM_ERASEBKGND:
......
...@@ -321,6 +321,7 @@ typedef struct tagME_TextEditor ...@@ -321,6 +321,7 @@ typedef struct tagME_TextEditor
BOOL bHideSelection; BOOL bHideSelection;
BOOL AutoURLDetect_bEnable; BOOL AutoURLDetect_bEnable;
WCHAR cPasswordMask; WCHAR cPasswordMask;
BOOL bHaveFocus;
} ME_TextEditor; } ME_TextEditor;
typedef struct tagME_Context typedef struct tagME_Context
......
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