Fix vertical scrollbar visibility in wxStyledTextCtrl

Vertical scrollbar didn't appear even when the number of lines in the control
became one greater than the maximal fitting number of lines, but only when one
more line was added.

This seems to have been a simple off-by-one error in SetScrollbar() calls, so
fix this by adding 1 to the upper end of the range.

Closes #17548.
This commit is contained in:
yenwu 2016-06-04 22:24:41 +02:00 committed by Vadim Zeitlin
parent 152b9fc0eb
commit beaca78962
2 changed files with 4 additions and 3 deletions

View File

@ -79,6 +79,7 @@ All (GUI):
- Add support for wxAuiManager and wxAuiPaneInfo to XRC (Andrea Zanellato).
- Add support for wxSL_MIN_MAX_LABELS and wxSL_VALUE_LABEL to XRC (ousnius).
- Update Scintilla to v3.6.6 (Paul Kulchenko).
- Fix vertical scrollbar visibility in wxStyledTextCtrl (yenwu, NewPagodi).
- Fix bug with not being able to select AUI tab after dragging.
- Make wxDataViewCtrl::Expand() expand ancestors in native ports too.
- Add wxDataViewCtrl::SetHeaderAttr().

View File

@ -421,7 +421,7 @@ const int H_SCROLL_STEP = 20;
bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
bool modified = false;
int vertEnd = nMax;
int vertEnd = nMax+1;
if (!verticalScrollBarVisible)
vertEnd = 0;
@ -431,7 +431,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbThumb = stc->GetScrollThumb(wxVERTICAL);
int sbPos = stc->GetScrollPos(wxVERTICAL);
if (sbMax != vertEnd || sbThumb != nPage) {
stc->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd+1);
stc->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd);
modified = true;
}
}
@ -440,7 +440,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbPage = stc->m_vScrollBar->GetPageSize();
int sbPos = stc->m_vScrollBar->GetThumbPosition();
if (sbMax != vertEnd || sbPage != nPage) {
stc->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd+1, nPage);
stc->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd, nPage);
modified = true;
}
}