diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 16ec3740c..8bd00a039 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -942,11 +942,11 @@ var kDelegateRespondsTo_textShouldBeginEditing _movingSelection = CPMakeRange(_startTrackingLocation, 0); var dragPlaceholder = [CPTextField new], originPoint = [_layoutManager locationForGlyphAtIndex:[self selectedRange].location]; - - originPoint.y -= [_layoutManager _descentAtLocation:_selectionRange.location]; + + originPoint.y += [_layoutManager _characterOffsetAtLocation:_selectionRange.location] + _textContainerOrigin.y - 1; originPoint.x += _textContainerOrigin.x; - originPoint.y += _textContainerOrigin.y; + dragPlaceholder._DOMElement.style.opacity = '0.6'; [dragPlaceholder setStringValue:[[self stringValue] substringWithRange:_selectionRange]]; [dragPlaceholder sizeToFit]; @@ -2025,6 +2025,9 @@ var kDelegateRespondsTo_textShouldBeginEditing return; } + if (_movingSelection.location > CPMaxRange(_selectionRange)) + _movingSelection.location -= _selectionRange.length; + [self _deleteForRange:_selectionRange]; [self setSelectedRange:_movingSelection];