Author: matt
Date: 2011-09-30 03:09:16 -0700 (Fri, 30 Sep 2011)
New Revision: 9092
Log:
Horizontal scrollbar in TextDisplay is not shown if text wrappes at the right 
edge

Modified:
   branches/branch-1.3/src/Fl_Text_Display.cxx

Modified: branches/branch-1.3/src/Fl_Text_Display.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Display.cxx 2011-09-30 10:07:12 UTC (rev 
9091)
+++ branches/branch-1.3/src/Fl_Text_Display.cxx 2011-09-30 10:09:16 UTC (rev 
9092)
@@ -359,7 +359,8 @@
       }
 
       /*
-       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 @@
       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());
         }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to