ncannasse 10 anos atrás
pai
commit
a222d34dbb
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      h2d/Console.hx

+ 2 - 0
h2d/Console.hx

@@ -134,6 +134,7 @@ class Console extends h2d.Sprite {
 	}
 
 	function set_cursorPos(v:Int) {
+		if( v > tf.text.length ) v = tf.text.length;
 		cursor.x = tf.calcTextWidth(tf.text.substr(0, v));
 		return cursorPos = v;
 	}
@@ -205,6 +206,7 @@ class Console extends h2d.Sprite {
 	function hide() {
 		bg.visible = false;
 		tf.text = "";
+		cursorPos = 0;
 	}
 
 	function handleCommand( command : String ) {