Explorar o código

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

robShiro hai 1 ano
pai
achega
d00340fbf8
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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];