From bbac1801e5328900328667e129f6fb8428aa93fe Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 28 Jan 2018 17:33:51 -0800 Subject: [PATCH] Small clean up --- src/SelectionManager.ts | 4 +++- src/handlers/Clipboard.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 00d22fb6..0d425a91 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -257,7 +257,9 @@ export class SelectionManager extends EventEmitter implements ISelectionManager return false; } - return (start[1] < coords[1] && end[1] > coords[1]) || (start[1] === coords[1] && coords[0] > start[0]) || (end[1] === coords[1] && coords[0] < end[0]); + return (start[1] < coords[1] && end[1] > coords[1]) || + (start[1] === coords[1] && coords[0] > start[0]) || + (end[1] === coords[1] && coords[0] < end[0]); } /** diff --git a/src/handlers/Clipboard.ts b/src/handlers/Clipboard.ts index 807516c7..7ac97714 100644 --- a/src/handlers/Clipboard.ts +++ b/src/handlers/Clipboard.ts @@ -121,8 +121,9 @@ export function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextA export function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, selectionManager: ISelectionManager, shouldSelectWord: boolean): void { moveTextAreaUnderMouseCursor(ev, textarea); - if (shouldSelectWord && !selectionManager.isClickInSelection(ev)) + if (shouldSelectWord && !selectionManager.isClickInSelection(ev)) { selectionManager.selectWordAtCursor(ev); + } // Get textarea ready to copy from the context menu textarea.value = selectionManager.selectionText;