Browse Source

fixed cursor offset

ssaket 6 years ago
parent
commit
e48c043a05
1 changed files with 3 additions and 0 deletions
  1. 3 0
      gui/src/2D/controls/inputText.ts

+ 3 - 0
gui/src/2D/controls/inputText.ts

@@ -553,6 +553,7 @@ export class InputText extends Control implements IFocusableControl {
                         this._cursorOffset = this.text.length - (this._startHighlightIndex + 1);
                         this._isTextHighlightOn = false;
                         this._blinkIsEven = false;
+                        this._markAsDirty();
                     }
                     else {
                         let insertPosition = this._text.length - this._cursorOffset;
@@ -573,7 +574,9 @@ export class InputText extends Control implements IFocusableControl {
             moveLeft =  this._startHighlightIndex > 0 && (this._text[this._startHighlightIndex - 1 ].search(rWord) !== -1) ? --this._startHighlightIndex : 0;
         } while (moveLeft || moveRight);
 
+        this._cursorOffset = this.text.length - this._startHighlightIndex;
         this.onTextHighlightObservable.notifyObservers(this);
+
         this._isTextHighlightOn = true;
         this._clickedCoordinate = null;
         this._blinkIsEven = true;