Author: matt
Date: 2011-05-13 00:58:26 -0700 (Fri, 13 May 2011)
New Revision: 8659
Log:
STR 2630: added bounds check for very narrow text editing widgets, wishing that
Valgrind was available for OS X
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-05-12 15:53:59 UTC (rev
8658)
+++ branches/branch-1.3/src/Fl_Text_Display.cxx 2011-05-13 07:58:26 UTC (rev
8659)
@@ -420,7 +420,8 @@
/* if empty lines become visible, there may be an opportunity to
display more text by scrolling down */
} else {
- while ( (mLineStarts[mNVisibleLines-2]==-1)
+ while ( mNVisibleLines>=2
+ && (mLineStarts[mNVisibleLines-2]==-1)
&& scroll_(mTopLineNum-1, mHorizOffset))
{ }
}
@@ -974,7 +975,7 @@
if (insert_position() < mFirstChar) {
topLine -= count_lines(insert_position(), mFirstChar, false);
- } else if (mLineStarts[mNVisibleLines-2] != -1) {
+ } else if (mNVisibleLines>=2 && mLineStarts[mNVisibleLines-2] != -1) {
int lastChar = line_end(mLineStarts[mNVisibleLines-2],true);
if (insert_position() >= lastChar)
topLine += count_lines(lastChar - (wrap_uses_character(mLastChar) ? 0 :
1),
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit