summaryrefslogtreecommitdiff
path: root/src/Fl_Text_Display.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2011-09-30 10:09:16 +0000
committerMatthias Melcher <fltk@matthiasm.com>2011-09-30 10:09:16 +0000
commit41876bf00a4a17c5da6188894bdb51b1bdd16c55 (patch)
tree771eecbf62cc6fcb2bde79b1687d6b2177b6cf1f /src/Fl_Text_Display.cxx
parent00e8e44cf43f423a61c0712499b313e8a2bb1556 (diff)
Horizontal scrollbar in TextDisplay is not shown if text wrappes at the right edge
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9092 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Text_Display.cxx')
-rw-r--r--src/Fl_Text_Display.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index 358da7571..a7d315e69 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -359,7 +359,8 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
}
/*
- Decide if the horizontal scrollbar needs to be visible. If there
+ Decide if the horizontal scrollbar needs to be visible. If the text
+ wraps at the right edge, do not draw a horizontal scrollbar. Otherwise, if there
is a vertical scrollbar, a horizontal is always created too. This
is because the alternatives are unattractive:
* Dynamically creating a horizontal scrollbar based on the currently
@@ -382,18 +383,19 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
if (scrollbar_align() & (FL_ALIGN_TOP|FL_ALIGN_BOTTOM) &&
(mVScrollBar->visible() || longest_vline() > text_area.w))
{
- if (!mHScrollBar->visible()) {
+ char wrap_at_bounds = mContinuousWrap && (mWrapMarginPix==0);
+ if (!mHScrollBar->visible() && !wrap_at_bounds) {
mHScrollBar->set_visible();
again = 1; // loop again to see if we now need vert. & recalc sizes
}
if (scrollbar_align() & FL_ALIGN_TOP) {
text_area.y = Y + scrollbar_width()+TOP_MARGIN;
- text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
+ text_area.h = H - (wrap_at_bounds?0:scrollbar_width())-TOP_MARGIN-BOTTOM_MARGIN;
mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y,
text_area.w+LEFT_MARGIN+RIGHT_MARGIN, scrollbar_width());
} else {
text_area.y = Y+TOP_MARGIN;
- text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
+ text_area.h = H - (wrap_at_bounds?0:scrollbar_width())-TOP_MARGIN-BOTTOM_MARGIN;
mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y+H-scrollbar_width(),
text_area.w+LEFT_MARGIN+RIGHT_MARGIN, scrollbar_width());
}