Explorar o código

Fix multiline TextInput when moving selection outside of TextInput (#1102)

Clamp selected line index
Casey Clyde %!s(int64=3) %!d(string=hai) anos
pai
achega
5548c47434
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      h2d/TextInput.hx

+ 1 - 0
h2d/TextInput.hx

@@ -457,6 +457,7 @@ class TextInput extends Text {
 		x += scrollX;
 		var lineIndex = Math.floor(y / font.lineHeight);
 		var lines = getAllLines();
+		lineIndex = hxd.Math.iclamp(lineIndex, 0, lines.length - 1);
 		var selectedLine = lines[lineIndex];
 		var pos = 0;
 		for(i in 0...lineIndex) {