Commit 160f65f2 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Move the various selection setting methods to a common function.

parent 660bc8b7
...@@ -2016,6 +2016,22 @@ static int ME_GetTextRange(ME_TextEditor *editor, WCHAR *strText, ...@@ -2016,6 +2016,22 @@ static int ME_GetTextRange(ME_TextEditor *editor, WCHAR *strText,
} }
} }
static int handle_EM_EXSETSEL( ME_TextEditor *editor, int to, int from )
{
int end;
TRACE("%d - %d\n", to, from );
ME_InvalidateSelection( editor );
end = ME_SetSelection( editor, to, from );
ME_InvalidateSelection( editor );
ITextHost_TxShowCaret( editor->texthost, FALSE );
ME_ShowCaret( editor );
ME_SendSelChange( editor );
return end;
}
typedef struct tagME_GlobalDestStruct typedef struct tagME_GlobalDestStruct
{ {
HGLOBAL hData; HGLOBAL hData;
...@@ -2383,7 +2399,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey) ...@@ -2383,7 +2399,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
case 'A': case 'A':
if (ctrl_is_down) if (ctrl_is_down)
{ {
ME_SetSelection(editor, 0, -1); handle_EM_EXSETSEL( editor, 0, -1 );
return TRUE; return TRUE;
} }
break; break;
...@@ -3246,12 +3262,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, ...@@ -3246,12 +3262,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
} }
case EM_SETSEL: case EM_SETSEL:
{ {
ME_InvalidateSelection(editor); handle_EM_EXSETSEL( editor, wParam, lParam );
ME_SetSelection(editor, wParam, lParam);
ME_InvalidateSelection(editor);
ITextHost_TxShowCaret(editor->texthost, FALSE);
ME_ShowCaret(editor);
ME_SendSelChange(editor);
return 0; return 0;
} }
case EM_SETSCROLLPOS: case EM_SETSCROLLPOS:
...@@ -3275,19 +3286,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, ...@@ -3275,19 +3286,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
} }
case EM_EXSETSEL: case EM_EXSETSEL:
{ {
int end;
CHARRANGE range = *(CHARRANGE *)lParam; CHARRANGE range = *(CHARRANGE *)lParam;
TRACE("EM_EXSETSEL (%d,%d)\n", range.cpMin, range.cpMax); return handle_EM_EXSETSEL( editor, range.cpMin, range.cpMax );
ME_InvalidateSelection(editor);
end = ME_SetSelection(editor, range.cpMin, range.cpMax);
ME_InvalidateSelection(editor);
ITextHost_TxShowCaret(editor->texthost, FALSE);
ME_ShowCaret(editor);
ME_SendSelChange(editor);
return end;
} }
case EM_SHOWSCROLLBAR: case EM_SHOWSCROLLBAR:
{ {
......
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