diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2011-05-13 07:58:26 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2011-05-13 07:58:26 +0000 |
| commit | 6892d8a2655f2976198a07b14dcd2c981e2d1de9 (patch) | |
| tree | 7008f099c460a0c201c86ff7aad28eed6eecc4ab /src/Fl_Text_Display.cxx | |
| parent | b588a8d399065865bc82ca1b7786eb8f35378c0c (diff) | |
STR 2630: added bounds check for very narrow text editing widgets, wishing that Valgrind was available for OS X
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8659 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Text_Display.cxx')
| -rw-r--r-- | src/Fl_Text_Display.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 17ca17f2a..d82261780 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -420,7 +420,8 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) { /* 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 @@ void Fl_Text_Display::display_insert() { 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), |
