]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/SelectionManager.ts
Merge pull request #733 from Tyriar/732_drop_selection_on_alt
[mirror_xterm.js.git] / src / SelectionManager.ts
index 3138048af6362923183fd7c4f734abd3c504bd47..cbcbf34dc8670662853d01f732c0c9122ab1bf90 100644 (file)
@@ -178,13 +178,19 @@ export class SelectionManager extends EventEmitter {
    */
   public setBuffer(buffer: CircularList<any>): void {
     this._buffer = buffer;
+    this.clearSelection();
   }
 
   /**
    * Gets whether there is an active text selection.
    */
   public get hasSelection(): boolean {
-    return !!this._model.finalSelectionStart && !!this._model.finalSelectionEnd;
+    const start = this._model.finalSelectionStart;
+    const end = this._model.finalSelectionEnd;
+    if (!start || !end) {
+      return false;
+    }
+    return start[0] !== end[0] || start[1] !== end[1];
   }
 
   /**
@@ -228,7 +234,7 @@ export class SelectionManager extends EventEmitter {
     // and joining the array into a multi-line string.
     const formattedResult = result.map(line => {
       return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');
-    }).join('\n');
+    }).join(Browser.isMSWindows ? '\r\n' : '\n');
 
     return formattedResult;
   }