On 2011-03-10, at 1:15 AM, Richard Frith-Macdonald wrote: > > On 9 Mar 2011, at 18:38, Fred Kiefer wrote: > >> Am 09.03.2011 06:28, schrieb Eric Wasylishen: >>> Author: ericwa >>> Date: Wed Mar 9 06:28:47 2011 >>> New Revision: 32503 >>> >>> URL: http://svn.gna.org/viewcvs/gnustep?rev=32503&view=rev >>> Log: >>> gui: implement NSLayoutManager temporary attributes >>> >>> Modified: >>> libs/gui/trunk/ChangeLog >>> libs/gui/trunk/Headers/AppKit/NSLayoutManager.h >>> libs/gui/trunk/Source/NSLayoutManager.m >> >> Excellent change! During FOSDEM Richard and I discussed about extracting >> the basic attribute handling from NSAttributedString to allow >> implementing temporary attribute handling on top of that. But your >> solution is a lot more elegant than that. > > I agree that this a an elegant and simple solution ... but it's also very > fragile as it depends on an implementation detail of > NSMutableAttributedString (the fact that it happens to create its internal > string storage using the -mutableCopy method of the string passed to its > initialiser) rather than a guaranteed/documented behavior. I'll add comments > in the source code to remind us about this.
Thanks. I agree it's somewhat of a hack, but at least the worst that should happen if NSMutableAttributedString were implemented differently would be higher memory usage (say if it called [NSMutableString stringWithString:] instead of -mutableCopy). > So I think your idea of creating a new class to store attributes in ranges > without a string behind it is still a good one in the long run. Yeah, that could be better. I'm not sure, but it might be useful to have in other places as well. btw, I committed an implementation of continuous spell checking which uses the temporary attributes. I just need to add a menu item in Ink to turn it on so people can test it more easily. :-) Cheers Eric _______________________________________________ Gnustep-dev mailing list [email protected] http://lists.gnu.org/mailman/listinfo/gnustep-dev
