Small selection fix.

This commit is contained in:
Martín Lucas Golini
2024-07-02 20:56:14 -03:00
parent 3d59b3c64b
commit fa169cf7e5

View File

@@ -1290,7 +1290,7 @@ Int32 Text::findCharacterFromPos( const Vector2i& pos, bool returnNearest, Font*
if ( pos.x <= width && pos.x >= lWidth && pos.y <= height &&
pos.y >= lHeight ) {
if ( run.pos() + curGlyph.cluster + 1 < tSize ) {
if ( run.pos() + curGlyph.cluster + 1 <= tSize ) {
Int32 tcurDist = eeabs( pos.x - lWidth );
Int32 nextDist = eeabs( pos.x - width );
if ( nextDist < tcurDist ) {
@@ -1355,7 +1355,7 @@ Int32 Text::findCharacterFromPos( const Vector2i& pos, bool returnNearest, Font*
}
if ( pos.x <= width && pos.x >= lWidth && pos.y <= height && pos.y >= lHeight ) {
if ( i + 1 < tSize ) {
if ( i + 1 <= tSize ) {
Int32 tcurDist = eeabs( pos.x - lWidth );
Int32 nextDist = eeabs( pos.x - width );
if ( nextDist < tcurDist )