- this.selectionManager = new SelectionManager(this, this.lines, this.rowContainer, this.charMeasure);
- this.selectionManager.on('refresh', data => this.renderer.refreshSelection(data.start, data.end));
+ this.selectionManager = new SelectionManager(
+ this, this.buffer.lines, this.rowContainer, this.charMeasure
+ );
+ this.selectionManager.on('refresh', data => {
+ this.renderer.refreshSelection(data.start, data.end);
+ });
+ this.selectionManager.on('newselection', text => {
+ // If there's a new selection, put it into the textarea, focus and select it
+ // in order to register it as a selection on the OS. This event is fired
+ // only on Linux to enable middle click to paste selection.
+ this.textarea.value = text;
+ this.textarea.focus();
+ this.textarea.select();
+ });