Author: matt
Date: 2011-09-30 03:20:03 -0700 (Fri, 30 Sep 2011)
New Revision: 9093
Log:
Text area width needs to be recalculated if vertical scrollbar changes
visibility.
Modified:
branches/branch-3.0/src/fltk3/TextDisplay.cxx
branches/branch-3.0/test/editor.cxx
Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/TextDisplay.cxx 2011-09-30 10:09:16 UTC
(rev 9092)
+++ branches/branch-3.0/src/fltk3/TextDisplay.cxx 2011-09-30 10:20:03 UTC
(rev 9093)
@@ -305,6 +305,7 @@
text_area.y = Y+TOP_MARGIN;
text_area.w = W-LEFT_MARGIN-RIGHT_MARGIN;
text_area.h = H-TOP_MARGIN-BOTTOM_MARGIN;
+ const int oldTAWidth = text_area.w;
int i;
/* Find the new maximum font height for this text display */
@@ -324,7 +325,7 @@
/* In continuous wrap mode, a change in width affects the total number of
lines in the buffer, and can leave the top line number incorrect, and
the top character no longer pointing at a valid line start */
- if (mContinuousWrap && !mWrapMarginPix && W!=oldWidth) {
+ if (mContinuousWrap && !mWrapMarginPix && (W!=oldWidth ||
text_area.w!=oldTAWidth)) {
int oldFirstChar = mFirstChar;
mNBufferLines = count_lines(0, buffer()->length(), true);
mFirstChar = line_start(mFirstChar);
@@ -351,6 +352,7 @@
// figure the scrollbars
if (scrollbar_width()) {
/* Decide if the vertical scrollbar needs to be visible */
+ int vbvis = mVScrollBar->visible();
if (scrollbar_align() & (fltk3::ALIGN_LEFT|fltk3::ALIGN_RIGHT) &&
mNBufferLines >= mNVisibleLines - 1)
{
@@ -367,7 +369,7 @@
scrollbar_width(),
text_area.h+TOP_MARGIN+BOTTOM_MARGIN);
}
}
-
+ if (vbvis != mVScrollBar->visible()) again = 1;
/*
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
Modified: branches/branch-3.0/test/editor.cxx
===================================================================
--- branches/branch-3.0/test/editor.cxx 2011-09-30 10:09:16 UTC (rev 9092)
+++ branches/branch-3.0/test/editor.cxx 2011-09-30 10:20:03 UTC (rev 9093)
@@ -785,6 +785,7 @@
w->editor->highlight_data(stylebuf, styletable,
sizeof(styletable) / sizeof(styletable[0]),
'A', style_unfinished_cb, 0);
+ w->editor->wrap_mode(fltk3::TextDisplay::WRAP_AT_BOUNDS, 80);
textbuf->text();
style_init();
w->end();
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit