riched20: Selection painting fixes

Phil Krylov phil at newstar.rinet.ru
Wed Jan 25 12:53:27 CST 2006


ChangeLog:

Fixed some more selection painting bugs in riched20.

---

 dlls/riched20/caret.c  |    5 +++--
 dlls/riched20/editor.c |    8 ++++----
 dlls/riched20/paint.c  |    2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

d28c35c1831a94b6c155480ad5d21ae0daf94000
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index f3d120e..0932656 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -759,8 +759,8 @@ void ME_MouseMove(ME_TextEditor *editor,
     return;
   
   HideCaret(editor->hWnd);
+  ME_InvalidateSelection(editor);
   ME_MoveCaret(editor);
-  ME_Repaint(editor);
   ShowCaret(editor->hWnd);
   ME_SendSelChange(editor);
 }
@@ -1185,7 +1185,8 @@ ME_ArrowKey(ME_TextEditor *editor, int n
     editor->pCursors[1] = tmp_curs;
   *p = tmp_curs;
   
-  ME_InvalidateSelection(editor);
+  if (ME_IsSelection(editor))
+    ME_InvalidateSelection(editor);
   HideCaret(editor->hWnd);
   ME_EnsureVisible(editor, tmp_curs.pRun); 
   ME_ShowCaret(editor);
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 4fd7d03..2479b85 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1278,8 +1278,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
     return 0;
   case EM_SETSEL:
   {
+    ME_InvalidateSelection(editor);
     ME_SetSelection(editor, wParam, lParam);
-    ME_Repaint(editor);
+    ME_InvalidateSelection(editor);
     ME_SendSelChange(editor);
     return 0;
   }
@@ -1287,9 +1288,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
   {
     CHARRANGE *pRange = (CHARRANGE *)lParam;
     TRACE("EM_EXSETSEL (%ld,%ld)\n", pRange->cpMin, pRange->cpMax);
+    ME_InvalidateSelection(editor);
     ME_SetSelection(editor, pRange->cpMin, pRange->cpMax);
-    /* FIXME optimize */
-    ME_Repaint(editor);
+    ME_InvalidateSelection(editor);
     ME_SendSelChange(editor);
     return 0;
   }
@@ -1365,7 +1366,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
     else
       nStyle &= ~ES_READONLY;
     SetWindowLongW(hWnd, GWL_STYLE, nStyle);
-    ME_Repaint(editor);
     return 0;
   }
   case EM_SETEVENTMASK:
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 0995482..b9745e2 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -143,13 +143,13 @@ void ME_Repaint(ME_TextEditor *editor)
 {
   ME_Cursor *pCursor = &editor->pCursors[0];
 
-  ME_MarkSelectionForRepaint(editor);
   if (ME_WrapMarkedParagraphs(editor)) {
     ME_UpdateScrollBar(editor);
   }
   if (editor->bRedraw)
   {
     ME_EnsureVisible(editor, pCursor->pRun);
+    UpdateWindow(editor->hWnd);
   }
 }
 
-- 
1.0.GIT



More information about the wine-patches mailing list