From 0db6c667c6ca6aeec6ecf3a3caba4cb455c349cf Mon Sep 17 00:00:00 2001 From: daboe01 Date: Sat, 18 Jun 2016 11:40:12 +0200 Subject: [PATCH] fixed: word granularity selection was not always correct --- AppKit/CPTextView/CPTextView.j | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 74aab8ddf..bdfe8bd04 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -913,13 +913,13 @@ var kDelegateRespondsTo_textShouldBeginEditing if (_startTrackingLocation === CPNotFound) _startTrackingLocation = [_layoutManager numberOfCharacters]; - - if (fraction[0] > 0.5) + else if (fraction[0] > 0.5) _startTrackingLocation++; [self setSelectionGranularity:granularities[[event clickCount]]]; - var setRange = CPMakeRange(_startTrackingLocation, 0); + var setRange = [self selectionRangeForProposedRange:CPMakeRange(_startTrackingLocation, 0) granularity:[self selectionGranularity]]; + _startTrackingLocation = CPMaxRange(setRange) if ([event modifierFlags] & CPShiftKeyMask) setRange = _MakeRangeFromAbs(_startTrackingLocation < _MidRange(_selectionRange) ? CPMaxRange(_selectionRange) : _selectionRange.location, _startTrackingLocation);