• 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: Invisible characters in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invisible characters in NSTextView


  • Subject: Re: Invisible characters in NSTextView
  • From: Peter Borg <email@hidden>
  • Date: Mon, 3 Jan 2005 19:42:11 +0100

On Mon, 3 Jan 2005 09:17:11 -0600, email@hidden
<email@hidden> wrote:

> Unfortunately, the above code doesn't quite work correctly, since
> characterAtIndex: is a character based index, and you are going through
> glyph based indices.  Now while these two are usually the same (and the
> layout manager will insert null-glyphs to help maintain this), there is
> no guarantee that it will be the same, and so you should convert the
> glyph index to character index.
>

You are correct that it is slightly safer to convert the glyph index
to character index but it is also slightly slower. When I wrote the
code I tested it extensively to see if there I could find a fault with
using the character index instead of the glyph index when testing for
control characters like \t but I could not find any and I still
haven't found any. If you check for other characters you might have a
problem and as Mark points out if it's not plain text you can have
other problems as well. I suppose it's the age old problem of choosing
between slighty safer but slower and sligtly less safe but faster...

Peter
 _______________________________________________
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

  • Follow-Ups:
    • Re: Invisible characters in NSTextView
      • From: John Stiles <email@hidden>
References: 
 >Invisible characters in NSTextView (From: Jean Bovet <email@hidden>)
 >Re: Invisible characters in NSTextView (From: Peter Borg <email@hidden>)

  • Prev by Date: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
  • Next by Date: Re: Invisible characters in NSTextView
  • Previous by thread: Re: Invisible characters in NSTextView
  • Next by thread: Re: Invisible characters in NSTextView
  • Index(es):
    • Date
    • Thread