mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 14:31:50 +00:00
fix incorrect textbox horizontal scroll
This commit is contained in:
parent
5460c716cc
commit
bc86a3d8da
1 changed files with 2 additions and 3 deletions
|
|
@ -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)));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue