From a051a231190a0b76887a8f90a00d41b54ac703d5 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Wed, 28 Jan 2009 01:35:02 -0500 Subject: [PATCH] richedit: Suppress scrollbar if missing WS_[VH]SCROLL style. If the scrollbar style isn't initially used, then the scrollbar should be shown. Otherwise this can be a problem when the horizontal scrollbar is shown for a single line richedit control, since it will cover all the text (See bug 12088). --- dlls/riched20/paint.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 7d7ea763a55..0c027e4dfdf 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -1067,14 +1067,16 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y) { LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE); bScrollBarIsVisible = (winStyle & WS_HSCROLL) != 0; - bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx) + bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx + && (editor->styleFlags & WS_HSCROLL)) || (editor->styleFlags & ES_DISABLENOSCROLL); if (bScrollBarIsVisible != bScrollBarWillBeVisible) ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, bScrollBarWillBeVisible); bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0; - bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy) + bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy + && (editor->styleFlags & WS_VSCROLL)) || (editor->styleFlags & ES_DISABLENOSCROLL); if (bScrollBarIsVisible != bScrollBarWillBeVisible) ITextHost_TxShowScrollBar(editor->texthost, SB_VERT, @@ -1163,8 +1165,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) } } - if (si.fMask & SIF_DISABLENOSCROLL) + if (si.fMask & SIF_DISABLENOSCROLL) { bScrollBarWillBeVisible = TRUE; + } else if (!(editor->styleFlags & WS_HSCROLL)) { + /* SetScrollInfo or SetScrollRange may cause the scrollbar to be + * shown, so hide the scrollbar if necessary. */ + bScrollBarWasVisible = bScrollBarWillBeVisible; + bScrollBarWillBeVisible = FALSE; + } if (bScrollBarWasVisible != bScrollBarWillBeVisible) ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, bScrollBarWillBeVisible); @@ -1203,8 +1211,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) } } - if (si.fMask & SIF_DISABLENOSCROLL) + if (si.fMask & SIF_DISABLENOSCROLL) { bScrollBarWillBeVisible = TRUE; + } else if (!(editor->styleFlags & WS_VSCROLL)) { + /* SetScrollInfo or SetScrollRange may cause the scrollbar to be + * shown, so hide the scrollbar if necessary. */ + bScrollBarWasVisible = bScrollBarWillBeVisible; + bScrollBarWillBeVisible = FALSE; + } if (bScrollBarWasVisible != bScrollBarWillBeVisible) ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,