fix(ui): clip selection background rects to the widget's visible area (#1770)

This commit is contained in:
mimus-assa 2026-07-25 07:18:38 -06:00 committed by GitHub
parent 36f4595793
commit ef80e7f5dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -172,8 +172,13 @@ void UITextEdit::drawSelf(const DrawPoolType drawPane)
}
}
if (width > 0)
m_glyphsSelectBgRectCache.emplace_back(Rect(pos.x, pos.y, width, lineHeight));
if (width > 0) {
// clip to the widget's visible area, like glyph coords do; otherwise
// selection rects for scrolled-out lines are drawn outside the widget
const Rect bgRect = Rect(pos.x, pos.y, width, lineHeight).intersection(getPaddingRect());
if (bgRect.isValid())
m_glyphsSelectBgRectCache.emplace_back(bgRect);
}
}
}