Eric Pouech escribió:
Alex Villacís Lasso a écrit :
Even though the code freeze is still in effect, I post this so that it
will be reviewed. For more information, see bug #12311.
Changelog:
* richedit: empty text should result in a scroll range of 0.
* Tests for this behavior.
------------------------------------------------------------------------
what I don't understand is why the height of an empty doc is not zero (I
had similar issues with the height of a doc where we systematically get
one row too much). I believe this root cause should be fixed instead of
the band aid your patch is providing
A+
The height of the document is irrelevant. Instead, if the actual height
is less than the height of the client area, the scrollbar should also be
set to zero, as shown by tests included in the attached patch. Empty
text is just one special case.
Changelog:
* Text that does not need to be scrolled should also result in a scroll
range of zero
* Tests for this behavior
--
perl -e '$x=2.4;print sprintf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'
diff -ur wine-orig/dlls/riched20/paint.c wine-build/dlls/riched20/paint.c
--- wine-orig/dlls/riched20/paint.c 2008-05-14 16:18:24.000000000 -0500
+++ wine-build/dlls/riched20/paint.c 2008-05-14 16:25:44.000000000 -0500
@@ -689,7 +689,7 @@
si.nMin = 0;
- if (ME_GetTextLength(editor) > 0)
+ if (editor->nTotalLength > editor->sizeWindow.cy)
{
si.nMax = editor->nTotalLength;
si.nPage = editor->sizeWindow.cy;
diff -ur wine-orig/dlls/riched20/tests/editor.c wine-build/dlls/riched20/tests/editor.c
--- wine-orig/dlls/riched20/tests/editor.c 2008-05-14 16:18:24.000000000 -0500
+++ wine-build/dlls/riched20/tests/editor.c 2008-05-14 16:20:27.000000000 -0500
@@ -1930,6 +1930,15 @@
/* test a richedit box containing a single line of text */
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) "a");/* one line of text */
+ memset(&si, 0, sizeof(si));
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
+ GetScrollInfo(hwndRichEdit, SB_VERT, &si);
+ ok(si.nMin == 0, "si.nMin == %d, expected 0\n", si.nMin);
+ ok(si.nMax == 0, "si.nMax == %d, expected 0\n", si.nMax);
+ ok(si.nPos == 0, "si.nPos == %d, expected 0\n", si.nPos);
+ ok(si.nPage == 0, "si.nPage == %d, expected 0\n", si.nPage);
+
expr = 0x00010000;
for (i = 0; i < 4; i++) {
static const int cmd[4] = { SB_PAGEDOWN, SB_PAGEUP, SB_LINEDOWN, SB_LINEUP };