GRAPHICS: MACGUI: Improved text selection edge case behaviour
This commit is contained in:
parent
b284895100
commit
55a241494e
1 changed files with 8 additions and 3 deletions
|
@ -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
|
// FIXME: We should use bsearch() here
|
||||||
*row = 0;
|
*row = 0;
|
||||||
|
|
||||||
while (*row < _textLines.size() - 1 && _textLines[*row].y < y)
|
while (*row < _textLines.size() && _textLines[*row].y < y)
|
||||||
(*row)++;
|
(*row)++;
|
||||||
|
|
||||||
if (*row)
|
if (*row == _textLines.size()) {
|
||||||
(*row)--;
|
(*row)--;
|
||||||
|
x = getLineWidth(*row);
|
||||||
|
}
|
||||||
|
|
||||||
*sy = _textLines[*row].y;
|
*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 width = 0, pwidth = 0;
|
||||||
int mcol = 0, pmcol = 0;
|
int mcol = 0, pmcol = 0;
|
||||||
uint chunk;
|
uint chunk;
|
||||||
for (chunk = 0; chunk < _textLines[*row].chunks.size() - 1; chunk++) {
|
for (chunk = 0; chunk < _textLines[*row].chunks.size(); chunk++) {
|
||||||
pwidth = width;
|
pwidth = width;
|
||||||
pmcol = mcol;
|
pmcol = mcol;
|
||||||
if (!_textLines[*row].chunks[chunk].text.empty()) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chunk == _textLines[*row].chunks.size())
|
||||||
|
chunk--;
|
||||||
|
|
||||||
Common::String str = _textLines[*row].chunks[chunk].text;
|
Common::String str = _textLines[*row].chunks[chunk].text;
|
||||||
|
|
||||||
*col = mcol;
|
*col = mcol;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue