fix incorrect textbox horizontal scroll
This commit is contained in:
@@ -1211,13 +1211,12 @@ void TextBox::setCaret(size_t position) {
|
|||||||
}
|
}
|
||||||
int lcaret = caret - rawTextCache.getTextLineOffset(line);
|
int lcaret = caret - rawTextCache.getTextLineOffset(line);
|
||||||
int realoffset =
|
int realoffset =
|
||||||
rawTextCache.metrics.calcWidth(labelText, lcaret) - static_cast<int>(textOffset) + 2;
|
rawTextCache.metrics.calcWidth(labelText, 0, lcaret) - static_cast<int>(textOffset) + 2;
|
||||||
|
|
||||||
if (realoffset - width > 0) {
|
if (realoffset - width > 0) {
|
||||||
setTextOffset(textOffset + realoffset - width);
|
setTextOffset(textOffset + realoffset - width);
|
||||||
} else if (realoffset < 0) {
|
} else if (realoffset < 0) {
|
||||||
setTextOffset(std::max(textOffset + realoffset, static_cast<size_t>(0))
|
setTextOffset(std::max(textOffset + realoffset, static_cast<size_t>(0)));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user