aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui/mactext.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2017-08-04 07:46:57 +0200
committerEugene Sandulenko2017-08-04 21:54:20 +0200
commit9e81f4de89d8625757578f152833a6e1f71c997a (patch)
tree10ce282eeedb7ede7430d45ef4a354988e321006 /graphics/macgui/mactext.cpp
parent55a241494e0045d6e9a6b573e4d2cae3f390244f (diff)
downloadscummvm-rg350-9e81f4de89d8625757578f152833a6e1f71c997a.tar.gz
scummvm-rg350-9e81f4de89d8625757578f152833a6e1f71c997a.tar.bz2
scummvm-rg350-9e81f4de89d8625757578f152833a6e1f71c997a.zip
GRAPHICS: MACGUI: Better selection row detection
Diffstat (limited to 'graphics/macgui/mactext.cpp')
-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;