Re: Issues with NSTextView and undoing attributes - Solved (I think)
Re: Issues with NSTextView and undoing attributes - Solved (I think)
- Subject: Re: Issues with NSTextView and undoing attributes - Solved (I think)
- From: Scott Lehman <email@hidden>
- Date: Mon, 6 Mar 2006 10:09:57 -0800 (PST)
The real issue was that I was changing characters in a
styled paragraph using a plain string, rather than an
attributed string that included the matching paragraph
style, resulting in inconsistent attributes that were
fixed in a way I didn't want.
So it seems the easy fix is to just build an
attributed string and send that to the text storage.
Which leads me to a question that the docs don't clear
up for me...
When I call NSTextView's
shouldChangeTextInRange:replacementString: with a
non-nil replacement string, are attribute changes made
before the matching didChangeText undone?
It seems to work right, but the docs lead me to
believe if it's non-nil, only character changes are
supported.
Thanks,
Scott
--- Douglas Davidson <email@hidden> wrote:
>
> On Mar 5, 2006, at 10:15 PM, Scott Lehman wrote:
>
> > I think the culprit was non-lazy attribute fixing
> in
> > the text storage. I wasn't expecting a text
> change to
> > the start of a paragraph to cause the prior
> > paragraph's style to extend to this entire
> paragraph.
> > Making the fixing lazy provides the proper result.
> >
> > I take it I should always be careful to apply
> > paragraph styles to entire paragraphs at a time to
> > avoid any similar issues?
> >
>
> Paragraph style attributes are expected to be
> applied to complete
> paragraphs. There is an attribute fixing step,
> paragraph attribute
> fixing, that specifically corrects any violations of
> this. After
> attribute fixing, a paragraph that contained
> multiple paragraph style
> attributes will end up with one of them over its
> entire range.
>
> Douglas Davidson
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden