Bringing over fix [r12000] from 1.3 current to the porting branch.

Applying my suggested patch to solve immediate issues with STR #3231.
Probably more needs to be done (see STR), but at least solves the
immediate issues.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12001 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2016-10-01 21:22:20 +00:00
parent 7e273a9fd3
commit a82eed18e5

View File

@ -1027,7 +1027,9 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) const {
int lineStartPos, fontHeight;
int visLineNum;
/* If position is not displayed, return false */
if (pos < mFirstChar || (pos > mLastChar && !empty_vlines())) {
if ((pos < mFirstChar) ||
(pos > mLastChar && !empty_vlines()) ||
(pos > buffer()->length()) ) { // STR #3231
return (*X=*Y=0); // make sure X & Y are set when it is out of view
}