GRAPHICS: MACGUI: Better selection row detection

This commit is contained in:
Eugene Sandulenko 2017-08-04 07:46:57 +02:00
parent 55a241494e
commit 9e81f4de89

View file

@ -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;