]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Merge branch 'master' into 553_find_api
authorDaniel Imms <tyriar@tyriar.com>
Fri, 23 Jun 2017 02:37:18 +0000 (19:37 -0700)
committerGitHub <noreply@github.com>
Fri, 23 Jun 2017 02:37:18 +0000 (19:37 -0700)
1  2 
src/SelectionManager.ts
src/xterm.js

index 0151427c0caf18fd31e39b4fac31a1c293c09390,b3316ae6cdad574ac79e867f3f64c491cf44de6a..a99cfa09234751e3f145e649c89519c442a7f7a1
@@@ -5,10 -7,8 +7,9 @@@ import * as Browser from './utils/Brows
  import { CharMeasure } from './utils/CharMeasure';
  import { CircularList } from './utils/CircularList';
  import { EventEmitter } from './EventEmitter';
- import * as Mouse from './utils/Mouse';
  import { ITerminal } from './Interfaces';
  import { SelectionModel } from './SelectionModel';
 +import { translateBufferLineToString } from './utils/BufferLine';
  
  /**
   * The number of pixels the mouse needs to be above or below the viewport in
@@@ -245,10 -247,62 +251,13 @@@ export class SelectionManager extends E
      this.refresh();
    }
  
 -  /**
 -   * Translates a buffer line to a string, with optional start and end columns.
 -   * Wide characters will count as two columns in the resulting string. This
 -   * function is useful for getting the actual text underneath the raw selection
 -   * position.
 -   * @param line The line being translated.
 -   * @param trimRight Whether to trim whitespace to the right.
 -   * @param startCol The column to start at.
 -   * @param endCol The column to end at.
 -   */
 -  private _translateBufferLineToString(line: any, trimRight: boolean, startCol: number = 0, endCol: number = null): string {
 -    // TODO: This function should live in a buffer or buffer line class
 -
 -    // Get full line
 -    let lineString = '';
 -    let widthAdjustedStartCol = startCol;
 -    let widthAdjustedEndCol = endCol;
 -    for (let i = 0; i < line.length; i++) {
 -      const char = line[i];
 -      lineString += char[LINE_DATA_CHAR_INDEX];
 -      // Adjust start and end cols for wide characters if they affect their
 -      // column indexes
 -      if (char[LINE_DATA_WIDTH_INDEX] === 0) {
 -        if (startCol >= i) {
 -          widthAdjustedStartCol--;
 -        }
 -        if (endCol >= i) {
 -          widthAdjustedEndCol--;
 -        }
 -      }
 -    }
 -
 -    // Calculate the final end col by trimming whitespace on the right of the
 -    // line if needed.
 -    let finalEndCol = widthAdjustedEndCol || line.length;
 -    if (trimRight) {
 -      const rightWhitespaceIndex = lineString.search(/\s+$/);
 -      if (rightWhitespaceIndex !== -1) {
 -        finalEndCol = Math.min(finalEndCol, rightWhitespaceIndex);
 -      }
 -      // Return the empty string if only trimmed whitespace is selected
 -      if (finalEndCol <= widthAdjustedStartCol) {
 -        return '';
 -      }
 -    }
 -
 -    return lineString.substring(widthAdjustedStartCol, finalEndCol);
 -  }
 -
    /**
     * Queues a refresh, redrawing the selection on the next opportunity.
+    * @param isNewSelection Whether the selection should be registered as a new
+    * selection on Linux.
     */
-   public refresh(): void {
+   public refresh(isNewSelection?: boolean): void {
+     // Queue the refresh for the renderer
      if (!this._refreshAnimationFrame) {
        this._refreshAnimationFrame = window.requestAnimationFrame(() => this._refresh());
      }
diff --cc src/xterm.js
Simple merge