richedit: Prevent redundant rewraps when scrollbar is shown.
authorDylan Smith <dylan.ah.smith@gmail.com>
Mon, 5 Jan 2009 18:14:31 +0000 (13:14 -0500)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 6 Jan 2009 11:51:55 +0000 (12:51 +0100)
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

index 1bfb216b2f5068857e9554d75209b3509581121f..f0acf4a9449adcf64edbe2cb132a9756d80fb371 100644 (file)
@@ -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)