Dylan Smith : richedit: Prevent redundant rewraps when scrollbar is shown.

Alexandre Julliard julliard at winehq.org
Tue Jan 6 08:23:12 CST 2009


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

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Mon Jan  5 13:14:31 2009 -0500

richedit: Prevent redundant rewraps when scrollbar is shown.

A common case for richedit controls are that a large amount of text is
set initially with word wrap enabled.  This causes the initially
wrapping of the text, which also calculates the text length.  After
this the vertical scrollbar will be shown, which causes the text to be
rewrapped again.  After this there are two redundant rewraps that are
done which this patch eliminates.

---

 dlls/riched20/paint.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 1bfb216..f0acf4a 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -1099,14 +1099,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
     bScrollBarWillBeVisible = TRUE;
   }
 
-  if (bScrollBarWasVisible != bScrollBarWillBeVisible)
-  {
-    ShowScrollBar(hWnd, SB_VERT, bScrollBarWillBeVisible);
-    ME_MarkAllForWrapping(editor);
-    ME_WrapMarkedParagraphs(editor);
-  }
-  
-  si.nMin = 0;  
+  si.nMin = 0;
   si.nMax = editor->nTotalLength;
   si.nPos = editor->vert_si.nPos;
   si.nPage = editor->sizeWindow.cy;
@@ -1122,6 +1115,9 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
     if (bScrollBarWillBeVisible || bScrollBarWasVisible)
       SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
   }
+
+  if (bScrollBarWasVisible != bScrollBarWillBeVisible)
+    ShowScrollBar(hWnd, SB_VERT, bScrollBarWillBeVisible);
 }
 
 int ME_GetYScrollPos(ME_TextEditor *editor)




More information about the wine-cvs mailing list