From 44cef002ed3e52c2856432a3e5d59c1f17cf92b3 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Wed, 30 Dec 2015 15:41:36 +0100 Subject: [PATCH] make selection upon doubleclick more mac like --- AppKit/CPTextView/CPTextView.j | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 1ffc6499c..17141b30a 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -780,6 +780,9 @@ var kDelegateRespondsTo_textShouldBeginEditing switch (granularity) { case CPSelectByWord: + if (_isNewlineCharacter([string characterAtIndex:proposedRange.location])) + return CPMakeRange(proposedRange.location, 1); + var wordRange = [self _characterRangeForIndex:proposedRange.location inRange:proposedRange asDefinedByRegex:[[self class] _wordBoundaryRegex] skip:YES]; if (proposedRange.length) @@ -788,6 +791,9 @@ var kDelegateRespondsTo_textShouldBeginEditing return wordRange; case CPSelectByParagraph: + if (_isNewlineCharacter([string characterAtIndex:proposedRange.location])) + return CPMakeRange(proposedRange.location, 1); + var parRange = [self _characterRangeForIndex:proposedRange.location inRange:proposedRange asDefinedByRegex:[[self class] _paragraphBoundaryRegex] skip:YES]; if (proposedRange.length)