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).
This commit is contained in:
parent
5d74f58382
commit
a051a23119
|
@ -1067,14 +1067,16 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
|
||||||
{
|
{
|
||||||
LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
|
LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
|
||||||
bScrollBarIsVisible = (winStyle & WS_HSCROLL) != 0;
|
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);
|
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
||||||
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
|
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
|
||||||
bScrollBarWillBeVisible);
|
bScrollBarWillBeVisible);
|
||||||
|
|
||||||
bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0;
|
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);
|
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
||||||
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
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;
|
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)
|
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, 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;
|
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)
|
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
||||||
|
|
Loading…
Reference in New Issue