2
0
Эх сурвалжийг харах

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

robShiro 1 жил өмнө
parent
commit
d00340fbf8
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  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];