Fix issue with trimming whitespace
This commit is contained in:
@@ -63,7 +63,6 @@ export class SelectionManager extends EventEmitter {
|
|||||||
private _terminal: ITerminal,
|
private _terminal: ITerminal,
|
||||||
private _buffer: CircularList<any>,
|
private _buffer: CircularList<any>,
|
||||||
private _rowContainer: HTMLElement,
|
private _rowContainer: HTMLElement,
|
||||||
private _selectionContainer: HTMLElement,
|
|
||||||
private _charMeasure: CharMeasure
|
private _charMeasure: CharMeasure
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@@ -159,7 +158,9 @@ export class SelectionManager extends EventEmitter {
|
|||||||
let finalEndCol = widthAdjustedEndCol || line.length
|
let finalEndCol = widthAdjustedEndCol || line.length
|
||||||
if (trimRight) {
|
if (trimRight) {
|
||||||
const rightWhitespaceIndex = lineString.search(/\s+$/);
|
const rightWhitespaceIndex = lineString.search(/\s+$/);
|
||||||
finalEndCol = Math.min(finalEndCol, rightWhitespaceIndex);
|
if (rightWhitespaceIndex !== -1) {
|
||||||
|
finalEndCol = Math.min(finalEndCol, rightWhitespaceIndex);
|
||||||
|
}
|
||||||
// Return the empty string if only trimmed whitespace is selected
|
// Return the empty string if only trimmed whitespace is selected
|
||||||
if (finalEndCol <= widthAdjustedStartCol) {
|
if (finalEndCol <= widthAdjustedStartCol) {
|
||||||
return '';
|
return '';
|
||||||
@@ -368,7 +369,7 @@ export class SelectionManager extends EventEmitter {
|
|||||||
* non-whitespace characters.
|
* non-whitespace characters.
|
||||||
* @param coords The coordinates to get the word at.
|
* @param coords The coordinates to get the word at.
|
||||||
*/
|
*/
|
||||||
private _selectWordAt(coords: [number, number]): void {
|
protected _selectWordAt(coords: [number, number]): void {
|
||||||
// TODO: Only fetch buffer line once for translate and convert functions
|
// TODO: Only fetch buffer line once for translate and convert functions
|
||||||
const bufferLine = this._buffer.get(coords[1]);
|
const bufferLine = this._buffer.get(coords[1]);
|
||||||
const line = this._translateBufferLineToString(bufferLine, false);
|
const line = this._translateBufferLineToString(bufferLine, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user