Merge pull request #496 from clasher113/main

fix: image render & LabelCache::update crash
This commit is contained in:
MihailRis 2025-03-31 14:04:35 +03:00 committed by GitHub
commit 0db778b4c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ void LabelCache::update(std::wstring_view text, bool multiline, bool wrap) {
if (text[i] == L'\n') {
lines.push_back(LineScheme {i+1, false});
len = 0;
} else if (i > 0 && wrap && text[i+1] != L'\n') {
} else if (i > 0 && i+1 < text.length() && wrap && text[i+1] != L'\n') {
size_t width = font->calcWidth(text, i-len-1, i-(i-len)+2);
if (width >= wrapWidth) {
// starting a fake line

View File

@ -160,9 +160,9 @@ CursorShape UINode::getCursor() const {
glm::vec2 UINode::calcPos() const {
if (parent) {
return pos + parent->calcPos() + parent->getContentOffset();
return glm::ivec2(pos + parent->calcPos() + parent->getContentOffset());
}
return pos;
return glm::ivec2(pos);
}
void UINode::scrolled(int value) {