Quellcode durchsuchen

Small fix to ensure inbound index when moving cursor vertically (#1206)

robShiro vor 1 Jahr
Ursprung
Commit
d00340fbf8
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      h2d/TextInput.hx

+ 1 - 1
h2d/TextInput.hx

@@ -373,7 +373,7 @@ class TextInput extends Text {
 		}
 		if (cursorLineIndex == -1)
 			return;
-		var destinationIndex = hxd.Math.iclamp(cursorLineIndex + yDiff, 0, lines.length);
+		var destinationIndex = hxd.Math.iclamp(cursorLineIndex + yDiff, 0, lines.length - 1);
 		if (destinationIndex == cursorLineIndex)
 			return;
 		var current = lines[cursorLineIndex];