Alex Villacís Lasso escribió:
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
The previous version resulted in a misassignment of the range when scrollbars
forced visible but scroll range makes scrollbar visible. This version fixes it.
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 --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 7bb1a01..1cddf58 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -689,15 +689,10 @@ void ME_Scroll(ME_TextEditor *editor, int value, int type)
si.nMin = 0;
- if (ME_GetTextLength(editor) > 0)
+ if (editor->nTotalLength > editor->sizeWindow.cy)
{
si.nMax = editor->nTotalLength;
si.nPage = editor->sizeWindow.cy;
- if (bForcedVisible)
- {
- TRACE("Setting page to max to preserve scrollbar...\n");
- si.nPage = si.nMax;
- }
} else {
si.nMax = si.nPage = 0;
if (bForcedVisible)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index c17cc40..7d9bf42 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -1930,6 +1930,15 @@ static void test_EM_SCROLL(void)
/* 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 };