Explorar o código

Correct DEL overrun

Guide %!s(int64=6) %!d(string=hai) anos
pai
achega
a02e688976
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      gui/src/2D/controls/inputText.ts

+ 1 - 1
gui/src/2D/controls/inputText.ts

@@ -307,7 +307,7 @@ export class InputText extends Control implements IFocusableControl {
                 }
                 return;
             case 46: // DELETE
-                if (this._text && this._text.length > 0) {
+                if (this._text && this._text.length > 0  && this._cursorOffset > 0) {
                     let deletePosition = this._text.length - this._cursorOffset;
                     this.text = this._text.slice(0, deletePosition) + this._text.slice(deletePosition + 1);
                     this._cursorOffset--;