Fix font hit test on multi-line text past the line end character

#3503
This commit is contained in:
Wojtek Figat
2025-10-08 16:36:34 +02:00
parent cd7fc3242e
commit deb2ad7c8f

View File

@@ -388,7 +388,10 @@ int32 Font::HitTestText(const StringView& text, const Float2& location, const Te
if (dst < smallestDst)
{
// Pointer is behind the last character in the line
smallestIndex = line.LastCharIndex + 1;
if (text[line.LastCharIndex] == '\n' && lineIndex != lines.Count() - 1)
smallestIndex = line.LastCharIndex;
else
smallestIndex = line.LastCharIndex + 1;
// Fix for last line
//if (lineIndex == lines.Count() - 1)