]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Merge branch 'master' into 697_select_to_word
authorDaniel Imms <tyriar@tyriar.com>
Mon, 19 Jun 2017 14:47:40 +0000 (07:47 -0700)
committerGitHub <noreply@github.com>
Mon, 19 Jun 2017 14:47:40 +0000 (07:47 -0700)
1  2 
src/SelectionManager.ts

index ac0e42908fc35e264812521bab8eed5898ce73ea,ec0c71e3165c7eb2d77bf85f0a8a40b63555b378..a769afd113c79a504fdfdab13005d4d95c939579
@@@ -649,30 -636,20 +655,39 @@@ export class SelectionManager extends E
        }
      }
  
 -    // Record the resulting selection
 -    this._model.selectionStart = [startIndex + charOffset - leftWideCharCount, coords[1]];
 -    this._model.selectionStartLength = Math.min(endIndex - startIndex + leftWideCharCount + rightWideCharCount + 1/*include endIndex char*/, this._terminal.cols);
 +    const start = startIndex + charOffset - leftWideCharCount;
 +    const length = Math.min(endIndex - startIndex + leftWideCharCount + rightWideCharCount + 1/*include endIndex char*/, this._terminal.cols);
 +    return {start, length};
 +  }
 +
 +  /**
 +   * Selects the word at the coordinates specified.
 +   * @param coords The coordinates to get the word at.
 +   */
 +  protected _selectWordAt(coords: [number, number]): void {
 +    const wordPosition = this._getWordAt(coords);
 +    this._model.selectionStart = [wordPosition.start, coords[1]];
 +    this._model.selectionStartLength = wordPosition.length;
 +  }
 +
 +  /**
 +   * Sets the selection end to the word at the coordinated specified.
 +   * @param coords The coordinates to get the word at.
 +   */
 +  private _selectToWordAt(coords: [number, number]): void {
 +    const wordPosition = this._getWordAt(coords);
 +    this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : (wordPosition.start + wordPosition.length), coords[1]];
    }
  
+   /**
+    * Gets whether the character is considered a word separator by the select
+    * word logic.
+    * @param char The character to check.
+    */
+   private _isCharWordSeparator(char: string): boolean {
+     return WORD_SEPARATORS.indexOf(char) >= 0;
+   }
    /**
     * Selects the line specified.
     * @param line The line index.