diff options
Diffstat (limited to 'graphics')
| -rw-r--r-- | graphics/macgui/mactext.cpp | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 64a8ebfd17..ade339f2e5 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -451,11 +451,13 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col) {  	// FIXME: We should use bsearch() here  	*row = 0; -	while (*row < _textLines.size() - 1 && _textLines[*row].y < y) +	while (*row < _textLines.size() && _textLines[*row].y < y)  		(*row)++; -	if (*row) +	if (*row == _textLines.size()) {  		(*row)--; +		x = getLineWidth(*row); +	}  	*sy = _textLines[*row].y; @@ -464,7 +466,7 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col) {  	int width = 0, pwidth = 0;  	int mcol = 0, pmcol = 0;  	uint chunk; -	for (chunk = 0; chunk < _textLines[*row].chunks.size() - 1; chunk++) { +	for (chunk = 0; chunk < _textLines[*row].chunks.size(); chunk++) {  		pwidth = width;  		pmcol = mcol;  		if (!_textLines[*row].chunks[chunk].text.empty()) { @@ -476,6 +478,9 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col) {  			break;  	} +	if (chunk == _textLines[*row].chunks.size()) +		chunk--; +  	Common::String str = _textLines[*row].chunks[chunk].text;  	*col = mcol; | 
