richedit: Keep default char format on WM_SETFONT in plain text mode.

Dylan Smith dylan.ah.smith at gmail.com
Sun Jun 6 13:57:44 CDT 2010


Fixes bug 22952, which is a regression caused by commit
2da0d8e933b087a3edb87a18e5a44dd4d336603b.

In plain text mode the character format should only be changed by changing
the default character format, because otherwise a call to EM_SETCHARFORMAT
using SCF_DEFAULT will unsuccessfully change the character format which is
what caused the regression bug.
---
 dlls/riched20/editor.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 5bed094..b4bff4f 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3502,16 +3502,18 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
     CHARFORMAT2W fmt;
     HDC hDC;
     BOOL bRepaint = LOWORD(lParam);
-    ME_Cursor start;
 
     if (!wParam)
-      wParam = (WPARAM)GetStockObject(SYSTEM_FONT); 
+      wParam = (WPARAM)GetStockObject(SYSTEM_FONT);
     GetObjectW((HGDIOBJ)wParam, sizeof(LOGFONTW), &lf);
     hDC = ITextHost_TxGetDC(editor->texthost);
-    ME_CharFormatFromLogFont(hDC, &lf, &fmt); 
+    ME_CharFormatFromLogFont(hDC, &lf, &fmt);
     ITextHost_TxReleaseDC(editor->texthost, hDC);
-    ME_SetCursorToStart(editor, &start);
-    ME_SetCharFormat(editor, &start, NULL, &fmt);
+    if (editor->mode & TM_RICHTEXT) {
+      ME_Cursor start;
+      ME_SetCursorToStart(editor, &start);
+      ME_SetCharFormat(editor, &start, NULL, &fmt);
+    }
     ME_SetDefaultCharFormat(editor, &fmt);
 
     ME_CommitUndo(editor);
-- 
1.7.0.4



More information about the wine-patches mailing list