From 4828c4a6faa15d5d4609b4921d28254bdd3fa6eb Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 30 Sep 2017 07:59:06 -0400 Subject: [PATCH] Clean up logs/comments --- src/SelectionManager.ts | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 65f6a57ee..9ba66efdf 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -282,8 +282,6 @@ export class SelectionManager extends EventEmitter implements ISelectionManager coords[0]--; coords[1]--; - console.log('coords', coords); - // Convert viewport coords to buffer coords coords[1] += this._terminal.buffer.ydisp; return coords; @@ -550,14 +548,11 @@ export class SelectionManager extends EventEmitter implements ISelectionManager if (char[CHAR_DATA_WIDTH_INDEX] === 0) { // Wide characters aren't included in the line string so decrement the index charIndex--; - // } } else if (char[CHAR_DATA_CHAR_INDEX].length > 1) { - console.log('char length > 1', char[CHAR_DATA_CHAR_INDEX], char[CHAR_DATA_CHAR_INDEX].length); // Emojis take up multiple characters, so adjust accordingly charIndex += char[CHAR_DATA_CHAR_INDEX].length - 1; } } - console.log('character index: ', charIndex); return charIndex; } @@ -616,47 +611,30 @@ export class SelectionManager extends EventEmitter implements ISelectionManager endCol++; } // Expand the string in both directions until a space is hit - let nextCharData = startIndex > 0 ? bufferLine[startCol - 1] : null; - - - -// TODO: Need to make sure that characters whose strings are longer than 1 get compensated for -// Double click words should expand to the spaces. - - - // while (startIndex > 0 && !this._isCharWordSeparator(line.charAt(startIndex - 1))) { - console.log('start char: ' + bufferLine[startCol]); - console.log('scan backwards'); - console.log(' startIndex:',startIndex); while (startIndex > 0 && !this._isCharWordSeparator(bufferLine[startCol - 1][CHAR_DATA_CHAR_INDEX])) { const char = bufferLine[startCol - 1]; - console.log(' char: ' + char); if (char[CHAR_DATA_WIDTH_INDEX] === 0) { // If the next character is a wide char, record it and skip the column leftWideCharCount++; startCol--; } else if (char[CHAR_DATA_CHAR_INDEX].length > 1) { + // If the next character's string is longer than 1 char (eg. emoji), + // adjust the index startIndex -= char[CHAR_DATA_CHAR_INDEX].length - 1; -console.log('x', char[CHAR_DATA_CHAR_INDEX], char[CHAR_DATA_CHAR_INDEX].length); } startIndex--; startCol--; } - console.log('scan forwards'); - // while (endIndex + 1 < line.length && !this._isCharWordSeparator(line.charAt(endIndex + 1))) { - console.log(' first checking: ',bufferLine[endCol + 1]); - console.log(' endIndex:',endIndex); - console.log(' line:',line); - console.log(' line.length:',line.length); while (endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine[endCol + 1][CHAR_DATA_CHAR_INDEX])) { const char = bufferLine[endCol + 1]; - console.log(' char: ' + char); if (char[CHAR_DATA_WIDTH_INDEX] === 2) { // If the next character is a wide char, record it and skip the column rightWideCharCount++; endCol++; } else if (char[CHAR_DATA_CHAR_INDEX].length > 1) { - startIndex += char[CHAR_DATA_CHAR_INDEX].length - 1; + // If the next character's string is longer than 1 char (eg. emoji), + // adjust the index + endIndex += char[CHAR_DATA_CHAR_INDEX].length - 1; } endIndex++; endCol++;