Improved text selection (#4127)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
kornes
2022-11-13 11:26:33 +00:00
committed by GitHub
parent 39f7d8ac4c
commit d409e3f17d
2 changed files with 3 additions and 1 deletions
@@ -327,7 +327,8 @@ int TextLayoutElement::getMouseOverIndex(const QPoint &abs) const
auto &&text = this->getText();
auto width = metrics.horizontalAdvance(this->getText()[i]);
if (x + width > abs.x())
// accept mouse to be at only 50%+ of character width to increase index
if (x + (width * 0.5) > abs.x())
{
if (text.size() > i + 1 && QChar::isLowSurrogate(text[i].unicode()))
{