mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
Merge branch 'main' into dev
This commit is contained in:
commit
4a15abd806
4 changed files with 22 additions and 6 deletions
|
|
@ -1211,13 +1211,12 @@ void TextBox::setCaret(size_t position) {
|
|||
}
|
||||
int lcaret = caret - rawTextCache.getTextLineOffset(line);
|
||||
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) {
|
||||
setTextOffset(textOffset + realoffset - width);
|
||||
} 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