Bug in NSFormatter
Bug in NSFormatter
- Subject: Bug in NSFormatter
- From: Bill Cheeseman <email@hidden>
- Date: Sun, 15 Jul 2001 20:56:14 -0400
The new NSFormatter method --
isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRa
nge:errorDescription:
-- does not appear to handle the delete key and the forward delete key
correctly.
When I use the delete key to delete a character backwards,
origSelRange.location reports the location where the insertion point ends
up, one to the left of the actual original insertion point location.
Also, origSelRange.length reports an original selection length of 1 when no
character was actually selected. It correctly reports 1 (or more) when one
character (or more) was selected.
The forward delete key gets the original location correct, but it also
reports an original selection length of 1 when nothing was selected.
These problems arise in a custom formatter that makes use of this method's
ability to let you substitute edited text for the text the user typed. I
thought it might be possible that these bugs only arise when edited text
that differs in length from what the user typed has been inserted into the
field. But that seems unlikely, because normal typing of printable
characters yields correct values.
Needless to say, these bugs make it very hard to write a custom formatter
that handles backspace and forward delete correctly.
Can anybody confirm these bugs, or explain what I'm doing wrong? And can
somebody remind me of the Cocoa feedback email address? -- I can't find it
anywhere on Apple's web pages.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
The AppleScript Sourcebook - www.AppleScriptSourcebook.com
Vermont Recipes - www.stepwise.com/Articles/VermontRecipes