mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 03:40:25 +00:00
GRAPHICS: MACGUI: MacText: Fix selection condition
Outside the while loop we only check pos > 0 once.
This commit is contained in:
parent
1ef07ff5dd
commit
4c996feb5d
@ -1037,35 +1037,35 @@ void MacText::setSelection(int pos, bool start) {
|
||||
int row = 0, col = 0;
|
||||
int colX = 0;
|
||||
|
||||
while (pos > 0) {
|
||||
if (pos < getLineCharWidth(row)) {
|
||||
for (uint i = 0; i < _textLines[row].chunks.size(); i++) {
|
||||
if ((uint)pos < _textLines[row].chunks[i].text.size()) {
|
||||
colX += _textLines[row].chunks[i].getFont()->getStringWidth(Common::U32String(_textLines[row].chunks[i].text.c_str(), pos));
|
||||
col += pos + 1;
|
||||
pos = 0;
|
||||
break;
|
||||
} else {
|
||||
colX += _textLines[row].chunks[i].getFont()->getStringWidth(Common::U32String(_textLines[row].chunks[i].text));
|
||||
pos -= _textLines[row].chunks[i].text.size();
|
||||
col += _textLines[row].chunks[i].text.size() + 1;
|
||||
if (pos > 0) {
|
||||
while (pos > 0) {
|
||||
if (pos < getLineCharWidth(row)) {
|
||||
for (uint i = 0; i < _textLines[row].chunks.size(); i++) {
|
||||
if ((uint)pos < _textLines[row].chunks[i].text.size()) {
|
||||
colX += _textLines[row].chunks[i].getFont()->getStringWidth(Common::U32String(_textLines[row].chunks[i].text.c_str(), pos));
|
||||
col += pos + 1;
|
||||
pos = 0;
|
||||
break;
|
||||
} else {
|
||||
colX += _textLines[row].chunks[i].getFont()->getStringWidth(Common::U32String(_textLines[row].chunks[i].text));
|
||||
pos -= _textLines[row].chunks[i].text.size();
|
||||
col += _textLines[row].chunks[i].text.size() + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
pos -= getLineCharWidth(row) + 1; // (row ? 1 : 0);
|
||||
}
|
||||
|
||||
row++;
|
||||
if ((uint)row >= _textLines.size()) {
|
||||
colX = _surface->w;
|
||||
col = getLineCharWidth(row);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
pos -= getLineCharWidth(row) + (row ? 1 : 0);
|
||||
}
|
||||
|
||||
row++;
|
||||
if ((uint)row >= _textLines.size()) {
|
||||
colX = _surface->w;
|
||||
col = getLineCharWidth(row);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos == -1) {
|
||||
} else {
|
||||
row = _textLines.size() - 1;
|
||||
colX = _surface->w;
|
||||
col = getLineCharWidth(row);
|
||||
|
Loading…
Reference in New Issue
Block a user