Dylan Smith : richedit: Scroll cursor into view even with redraw turned off .

Alexandre Julliard julliard at winehq.org
Sat Oct 18 13:38:54 CDT 2008


Module: wine
Branch: master
Commit: f24678b285ad7adcd4fa1009a7288d80d0384a55
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f24678b285ad7adcd4fa1009a7288d80d0384a55

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Fri Oct 17 21:29:55 2008 -0400

richedit: Scroll cursor into view even with redraw turned off.

---

 dlls/riched20/paint.c        |   15 +++++++++------
 dlls/riched20/tests/editor.c |   14 ++++----------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 2955594..2202967 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -159,7 +159,6 @@ void ME_UpdateRepaint(ME_TextEditor *editor)
   BOOL wrappedParagraphs;
 
   wrappedParagraphs = ME_WrapMarkedParagraphs(editor);
-  if (!editor->bRedraw) return;
   if (wrappedParagraphs)
     ME_UpdateScrollBar(editor);
   
@@ -174,7 +173,8 @@ void ME_UpdateRepaint(ME_TextEditor *editor)
     ME_SendOldNotify(editor, EN_CHANGE);
     editor->nEventMask |= ENM_CHANGE;
   }
-  ME_Repaint(editor);
+  if (editor->bRedraw)
+    ME_Repaint(editor);
   ME_SendSelChange(editor);
 }
 
@@ -185,10 +185,10 @@ ME_RewrapRepaint(ME_TextEditor *editor)
    * looks, but not content. Like resizing. */
   
   ME_MarkAllForWrapping(editor);
+  ME_WrapMarkedParagraphs(editor);
+  ME_UpdateScrollBar(editor);
   if (editor->bRedraw)
   {
-    ME_WrapMarkedParagraphs(editor);
-    ME_UpdateScrollBar(editor);
     ME_Repaint(editor);
   }
 }
@@ -1093,6 +1093,7 @@ void ME_Scroll(ME_TextEditor *editor, int value, int type)
                             || (winStyle & ES_DISABLENOSCROLL);
   if (bScrollBarIsVisible != bScrollBarWillBeVisible)
   {
+    /* FIXME: ShowScrollBar will redraw the scrollbar when editor->bRedraw is FALSE */
     ShowScrollBar(hWnd, SB_VERT, bScrollBarWillBeVisible);
   }
   ME_UpdateScrollBar(editor);
@@ -1126,6 +1127,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
 
   if (bScrollBarWasVisible != bScrollBarWillBeVisible)
   {
+    /* FIXME: ShowScrollBar will redraw the scrollbar when editor->bRedraw is FALSE */
     ShowScrollBar(hWnd, SB_VERT, bScrollBarWillBeVisible);
     ME_MarkAllForWrapping(editor);
     ME_WrapMarkedParagraphs(editor);
@@ -1144,13 +1146,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
     editor->vert_si.nPage = si.nPage;
     if (bScrollBarWillBeVisible)
     {
-      SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
+      SetScrollInfo(hWnd, SB_VERT, &si, editor->bRedraw);
     }
     else
     {
       if (bScrollBarWasVisible && !(si.fMask & SIF_DISABLENOSCROLL))
       {
-        SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
+        SetScrollInfo(hWnd, SB_VERT, &si, editor->bRedraw);
+        /* FIXME: ShowScrollBar will redraw the scrollbar when editor->bRedraw is FALSE */
         ShowScrollBar(hWnd, SB_VERT, FALSE);
         ME_ScrollAbs(editor, 0);
       }
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 3f98f30..18deadd 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -5189,7 +5189,7 @@ static void test_eventMask(void)
     SendMessage(eventMaskEditHwnd, WM_SETREDRAW, FALSE, 0);
     queriedEventMask = 0;  /* initialize to something other than we expect */
     SendMessage(eventMaskEditHwnd, EM_REPLACESEL, 0, (LPARAM) text);
-    todo_wine ok(queriedEventMask == (eventMask & ~ENM_CHANGE),
+    ok(queriedEventMask == (eventMask & ~ENM_CHANGE),
             "wrong event mask (0x%x) during WM_COMMAND\n", queriedEventMask);
     SendMessage(eventMaskEditHwnd, WM_SETREDRAW, TRUE, 0);
 
@@ -5568,7 +5568,7 @@ static void test_word_wrap(void)
     ok(lines == 1, "Line wasn't expected to wrap (lines=%d).\n", lines);
     MoveWindow(hwnd, 0, 0, 200, 80, FALSE);
     lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
-    todo_wine ok(lines > 1, "Line was expected to wrap (lines=%d).\n", lines);
+    ok(lines > 1, "Line was expected to wrap (lines=%d).\n", lines);
 
     SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
     DestroyWindow(hwnd);
@@ -5588,15 +5588,9 @@ static void test_auto_yscroll(void)
         ok(lines == 8, "%d lines instead of 8\n", lines);
         ret = SendMessage(hwnd, EM_GETSCROLLPOS, 0, (LPARAM)&pt);
         ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
-        if (!redraw)
-            todo_wine ok(pt.y != 0, "Didn't scroll down after replacing text.\n");
-        else
-            ok(pt.y != 0, "Didn't scroll down after replacing text.\n");
+        ok(pt.y != 0, "Didn't scroll down after replacing text.\n");
         ret = GetWindowLong(hwnd, GWL_STYLE);
-        if (!redraw)
-            todo_wine ok(ret & WS_VSCROLL, "Scrollbar was not shown yet (style=%x).\n", (UINT)ret);
-        else
-            ok(ret & WS_VSCROLL, "Scrollbar was not shown yet (style=%x).\n", (UINT)ret);
+        ok(ret & WS_VSCROLL, "Scrollbar was not shown yet (style=%x).\n", (UINT)ret);
 
         SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)NULL);
         lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);




More information about the wine-cvs mailing list