Sometimes my implementation of NSTextViewDelegate method
textView:shouldChangeTextInRanges:replacementStrings: is called with
different arguments than I expect. Maybe I have overlooked some
way to get the desired behavior?
Here is an example of the behavior. I select a character, the 'w'
in the sentence below---I will use [] to indicate selections:
All [w]ork and no play makes Jack a dull boy.
Next, I Command-select another character, the 'b':
All [w]ork and no play makes Jack a dull [b]oy.
Then I tap the Delete key. I expect for the AppKit to call my
textView:shouldChangeTextInRanges:replacementStrings: method once with
ranges [rangeOfW, rangeOfB] and replacementStrings ["", ""]. Instead,
textView:shouldChangeTextInRanges:replacementStrings: is called twice,
once with [rangeOfW] and [""], and a second time with [rangeOfB] and
[""].
For my purposes, it is desirable for shouldChangeTextInRanges: to
see all of the ranges affected by a single editing command, such as
deleteBackward(), at once. Is there some way to select the behavior
that I expect?
Dave
--
David Young //\ Trestle Technology Consulting
(217) 721-9981 Urbana, IL http://trestle.tech/
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]