Adress feedback

This commit is contained in:
Bruno Ribeito
2017-11-07 21:21:44 +00:00
parent 1877e7019d
commit 2865d935b6
3 changed files with 10 additions and 7 deletions
+2
View File
@@ -143,6 +143,7 @@ namespace methods_core {
const r20: string = t.getOption('bellStyle');
const r21: boolean = t.getOption('enableBold');
const r22: number = t.getOption('letterSpacing');
const r23: boolean = t.getOption('rightClickSelectsWord');
}
{
const t: Terminal = new Terminal();
@@ -177,6 +178,7 @@ namespace methods_core {
t.setOption('lineHeight', 1);
t.setOption('fontFamily', 'foo');
t.setOption('theme', {background: '#ff0000'});
t.setOption('rightClickSelectsWord', false);
}
}
namespace scrolling {
+1 -1
View File
@@ -26,7 +26,7 @@ class TestSelectionManager extends SelectionManager {
public get model(): SelectionModel { return this._model; }
public selectLineAt(line: number): void { this._selectLineAt(line); }
public selectWordAt(coords: [number, number]): void { this._selectWordAt(coords); }
public selectWordAt(coords: [number, number]): void { this._selectWordAt(coords, true); }
// Disable DOM interaction
public enable(): void {}
+7 -6
View File
@@ -250,7 +250,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
}
/**
* Selects word at the current mouse event coordenates.
* Selects word at the current mouse event coordinates.
* @param event The mouse event.
*/
public selectWordAtCursor(event: MouseEvent): void {
@@ -590,7 +590,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
* Gets positional information for the word at the coordinated specified.
* @param coords The coordinates to get the word at.
*/
private _getWordAt(coords: [number, number], selectWhiteSpace: boolean): IWordPosition {
private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): IWordPosition {
const bufferLine = this._buffer.lines.get(coords[1]);
if (!bufferLine) {
return null;
@@ -696,8 +696,9 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
- leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)
- rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)
if (!selectWhiteSpace && line.slice(startIndex, endIndex).trim() === '')
if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {
return null;
}
return { start, length };
}
@@ -705,10 +706,10 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
/**
* Selects the word at the coordinates specified.
* @param coords The coordinates to get the word at.
* @param selectWhiteSpace If whitespace should be selected
* @param allowWhitespaceOnlySelection If whitespace should be selected
*/
protected _selectWordAt(coords: [number, number], selectWhiteSpace: boolean): void {
const wordPosition = this._getWordAt(coords, selectWhiteSpace);
protected _selectWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): void {
const wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection);
if (wordPosition) {
this._model.selectionStart = [wordPosition.start, coords[1]];
this._model.selectionStartLength = wordPosition.length;