diff --git a/ChangeLog b/ChangeLog index 3a85468a5..88396b557 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-01-09 Wolfgang Lux + + * Source/NSTextView.m (-performDragOperation:): Fix a bug that + prevented changing the color of the selected text of a text view + via drag and drop. + 2010-01-08 Riccardo Mottola * Source/NSScroller: init scrollerWidth to 0.0, so that GSTheme @@ -710,7 +716,7 @@ * Source/NSDocumentController.m (+initialize): Don't ignore types without an associated document class. - * Source/NSDocument.m (+reaableTypes, +writableTypes): + * Source/NSDocument.m (+readableTypes, +writableTypes): * Source/NSDocumentController.m(-_readableTypesForClass:, -_writableTypesForClass:): Add the exportable types to the writable types. Rename private NSDocumentController methods. diff --git a/Source/NSTextView.m b/Source/NSTextView.m index c050c5afa..31a8d425b 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -4819,10 +4819,17 @@ other than copy/paste or dragging. */ - (BOOL) performDragOperation: (id )sender { + /* In general, the position where the dragging source was dropped is given by + _dragTargetLocation. However, when dragging a color onto a text view, the + cursor is not updated, since the color change always effects the current + selection and hence _dragTargetLocation==NSNotFound in that case. */ NSRange sourceRange = [self selectedRange]; - NSRange changeRange = NSMakeRange(_dragTargetLocation, 0); - [self _draggingReleaseInsertionPoint]; - [self setSelectedRange: changeRange]; + if (_dragTargetLocation != NSNotFound) + { + NSRange changeRange = NSMakeRange(_dragTargetLocation, 0); + [self _draggingReleaseInsertionPoint]; + [self setSelectedRange: changeRange]; + } if ([sender draggingSource] == self && ([sender draggingSourceOperationMask] & NSDragOperationGeneric))