• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Examples of textStorageWillProcessEditing's use ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Examples of textStorageWillProcessEditing's use ?


  • Subject: Re: Examples of textStorageWillProcessEditing's use ?
  • From: Thomas Deniau <email@hidden>
  • Date: Thu, 28 Feb 2002 09:17:31 +0100

Le 28/02/02 0:46, Thomas Deniau disait :

> I'm trying to use to it to make auto-colorization of source code as the user
> types, but if I use setAttributes:range: in this method, I don't know why,
> sometimes, not always, the cursor moves to the end of the specified range.
>
> I do not see why a change on the color of the text should change the
> insertion point's position ...

For example the following code snippet makes the insertion point change (it
moves to the next line) (whereas the code never uses the insertion point) :

- (void)textStorageWillProcessEditing:(NSNotification *)aNotification
{
NSTextStorage *storage=[aNotification object];
if ([storage editedMask] & NSTextStorageEditedCharacters)
{
NSRange range=[[storage string] lineRangeForRange:[storage
editedRange]];
NSDictionary *attrs=[NSDictionary
dictionaryWithObjectsAndKeys:[NSColor
textColor],NSForegroundColorAttributeName,nil];
[storage setAttributes:attrs range:range];
}
}

Is there an obvious bug here ?
All I want to do is to reset the paragraph's color (here it is dumb, but in
fact it's an extract - which is bugging too - from some syntax-colorization
code).

Thanks in advance (and sorry if my question is stupid),

--
Thomas Deniau
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Examples of textStorageWillProcessEditing's use ? (From: Thomas Deniau <email@hidden>)

  • Prev by Date: Two basic questions
  • Next by Date: help system
  • Previous by thread: Examples of textStorageWillProcessEditing's use ?
  • Next by thread: NSPanel owned by NSDocumentController: cause of a problem?
  • Index(es):
    • Date
    • Thread