[PATCH] riched20: properly calculate control display height

Lei Zhang thestig at google.com
Wed Aug 15 12:43:10 CDT 2007


Hi,

This fixed the spinners problem in bug 5504. The spinners are actually
scrollbars that were visible due to a wrong calculation in the
richedit control paint code.
-------------- next part --------------
From 5db6e9159063c13e658396b1c36a2edb86efb0f6 Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Wed, 15 Aug 2007 10:39:43 -0700
Subject: [PATCH] riched20: properly calculate control display height
---
 dlls/riched20/editor.c  |    1 +
 dlls/riched20/editstr.h |    1 +
 dlls/riched20/paint.c   |    2 +-
 dlls/riched20/wrap.c    |    2 ++
 4 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 740828f..f46c4b2 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1131,6 +1131,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) 
   ed->pCursors[1].pRun = ME_FindItemFwd(ed->pBuffer->pFirst, diRun);
   ed->pCursors[1].nOffset = 0;
   ed->nLastTotalLength = ed->nTotalLength = 0;
+  ed->nHeight = 0;
   ed->nUDArrowX = -1;
   ed->nSequence = 0;
   ed->rgbBackColor = -1;
diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h
index 7bb91d5..b86aeba 100644
--- a/dlls/riched20/editstr.h
+++ b/dlls/riched20/editstr.h
@@ -291,6 +291,7 @@ typedef struct tagME_TextEditor
   int nCursors;
   SIZE sizeWindow;
   int nTotalLength, nLastTotalLength;
+  int nHeight;
   int nUDArrowX;
   int nSequence;
   COLORREF rgbBackColor;
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 676543e..215477b 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -460,7 +460,7 @@ void ME_Scroll(ME_TextEditor *editor, in
   hWnd = editor->hWnd;
   si.cbSize = sizeof(si);
   bScrollBarWasVisible = ME_GetYScrollVisible(editor);
-  bScrollBarWillBeVisible = editor->nTotalLength > editor->sizeWindow.cy;
+  bScrollBarWillBeVisible = editor->nHeight > editor->sizeWindow.cy;
   
   if (bScrollBarWasVisible != bScrollBarWillBeVisible)
   {
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index af6e9a9..c8b5710 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -429,11 +429,13 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEdit
   ME_InitContext(&c, editor, hDC);
   c.pt.x = 0;
   c.pt.y = 0;
+  editor->nHeight = 0;
   item = editor->pBuffer->pFirst->next;
   while(item != editor->pBuffer->pLast) {
     BOOL bRedraw = FALSE;
 
     assert(item->type == diParagraph);
+    editor->nHeight = max(editor->nHeight, item->member.para.nYPos);
     if ((item->member.para.nFlags & MEPF_REWRAP)
      || (item->member.para.nYPos != c.pt.y))
       bRedraw = TRUE;
-- 
1.4.1


More information about the wine-patches mailing list