Module: wine
Branch: master
Commit: d43cddcc8351215eb4f60e1a41439e29261f1268
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d43cddcc8351215eb4f60e1a4…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com>
Date: Wed Jan 12 02:23:40 2011 -0500
richedit: Clear non-default style when changing to plain text mode.
Although the text must be empty for the mode to change to plain text
mode, there still may be a non-default style for the temporary insert
style and style for the end of text run.
---
dlls/riched20/editor.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 48b64c9..aace0ea 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -4332,6 +4332,18 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
{
mask |= TM_RICHTEXT | TM_PLAINTEXT;
changes |= wParam & (TM_RICHTEXT | TM_PLAINTEXT);
+ if (wParam & TM_PLAINTEXT) {
+ /* Clear selection since it should be possible to select the
+ * end of text run for rich text */
+ ME_InvalidateSelection(editor);
+ ME_SetCursorToStart(editor, &editor->pCursors[0]);
+ editor->pCursors[1] = editor->pCursors[0];
+ /* plain text can only have the default style. */
+ ME_ClearTempStyle(editor);
+ ME_AddRefStyle(editor->pBuffer->pDefaultStyle);
+ ME_ReleaseStyle(editor->pCursors[0].pRun->member.run.style);
+ editor->pCursors[0].pRun->member.run.style = editor->pBuffer->pDefaultStyle;
+ }
}
/* FIXME: Currently no support for undo level and code page options */
editor->mode = (editor->mode & ~mask) | changes;