瀏覽代碼

fix ctr+shit+arrow action

ssaket 6 年之前
父節點
當前提交
61d4643562
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      gui/src/2D/controls/inputText.ts

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

@@ -521,7 +521,7 @@ export class InputText extends Control implements IFocusableControl {
                 if (evt && evt.shiftKey) {
                     // hide the cursor
                     this._blinkIsEven = true;
-                    // ctrl/cmd + shift + <-
+                    // shift + ctrl/cmd + <-
                     if (evt.ctrlKey || evt.metaKey) {
                         this._endHighlightIndex = this._isTextHighlightOn ? this._endHighlightIndex : this._text.length - this._cursorOffset + 1;
                         this._startHighlightIndex = 0;
@@ -536,11 +536,12 @@ export class InputText extends Control implements IFocusableControl {
                         this._isTextHighlightOn = true;
                         this._cursorIndex = (this._cursorOffset >= this._text.length) ? this._text.length : this._cursorOffset - 1;
                     }
-                    //if text is already highlighted, executed only once
+                    //if text is already highlighted
                     else if (this._cursorIndex === -1) {
                         this._cursorIndex = this._text.length - this._endHighlightIndex;
                         this._cursorOffset = this._text.length - this._startHighlightIndex + 1;
                     }
+                    //set the highlight indexes
                     if (this._cursorIndex < this._cursorOffset) {
                         this._endHighlightIndex = this._text.length - this._cursorIndex;
                         this._startHighlightIndex = this._text.length - this._cursorOffset;
@@ -593,11 +594,12 @@ export class InputText extends Control implements IFocusableControl {
                         this._isTextHighlightOn = true;
                         this._cursorIndex = (this._cursorOffset <= 0) ? 0 : this._cursorOffset + 1;
                     }
-                    //if text is already highlighted, executed only once
+                    //if text is already highlighted
                     else if (this._cursorIndex === -1) {
                         this._cursorIndex = this._text.length - this._startHighlightIndex;
                         this._cursorOffset = this._text.length - this._endHighlightIndex - 1;
                     }
+                    //set the highlight indexes
                     if (this._cursorIndex < this._cursorOffset) {
                         this._endHighlightIndex = this._text.length - this._cursorIndex;
                         this._startHighlightIndex = this._text.length - this._cursorOffset;