When do I have to update the typing attributes?

  • The documentation for -[NSTextView setTypingAttributes:] says:

    Typing attributes are reset automatically whenever the selection
    changes. If you add any user actions that change text attributes,
    you should use this method to apply those attributes to a
    zero-length selection.

    Is it unnecessary to change the typing attributes when there is a non-
    zero length selection? (The reason I ask is that it appears the -
    changeFont: action modifies the text storage and changes the typing
    attributes for a non-zero-length selection.)

    Thanks,
    Jim
  • On Oct 3, 2006, at 10:04 AM, Jim Correia wrote:

    > The documentation for -[NSTextView setTypingAttributes:] says:
    >
    > Typing attributes are reset automatically whenever the selection
    > changes. If you add any user actions that change text attributes,
    > you should use this method to apply those attributes to a
    > zero-length selection.
    >
    > Is it unnecessary to change the typing attributes when there is a
    > non-zero length selection? (The reason I ask is that it appears the
    > -changeFont: action modifies the text storage and changes the
    > typing attributes for a non-zero-length selection.)

    The convention is that user actions that change attributes should
    always set the typing attributes.  There might not be a subsequent
    change in selection before the next typing.  You can file a
    documentation bug if the documentation does not make this clear.

    Douglas Davidson
  • On Tue, 3 Oct 2006 13:04:46 -0400, Jim Correia <jim.correia...> said:
    > The documentation for -[NSTextView setTypingAttributes:] says:
    >
    > Typing attributes are reset automatically whenever the selection
    > changes.

    However, I've not found this to be so, and have had to implement
    textViewDidChangeSelection: to call setTypingAttributes: myself under
    certain circumstances. YMMV. m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
  • On Oct 4, 2006, at 9:34 AM, Matt Neuburg wrote:

    > However, I've not found this to be so, and have had to implement
    > textViewDidChangeSelection: to call setTypingAttributes: myself under
    > certain circumstances. YMMV. m.

    File a bug.

    Douglas Davidson
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today