aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/macgui/mactext.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index ade339f2e5..4647f9c300 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -449,15 +449,13 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col) {
CLIP(y, 0, _textMaxHeight);
// FIXME: We should use bsearch() here
- *row = 0;
+ *row = _textLines.size() - 1;
- while (*row < _textLines.size() && _textLines[*row].y < y)
- (*row)++;
-
- if (*row == _textLines.size()) {
+ while (*row && _textLines[*row].y > y)
(*row)--;
+
+ if (y > _textMaxHeight)
x = getLineWidth(*row);
- }
*sy = _textLines[*row].y;