[comp.sys.mac.programmer] WordBreak routine for TextEdit

bwbecker@watdragon.waterloo.edu (Byron Weber Becker) (05/03/90)

I am trying to implement a word-break routine for TextEdit.  When
text is inserted with TEInsert and my routine is called, 'text'
points to the text being inserted, but 'CharPos' is longer than
the text is.  Thus '*t' in the code below points to random memory.
Any pointers?

I'm using MPW C 3.1.  Everything works fine with the default word-
break routine.

pascal Boolean MyWordBreak(Ptr text, short charPos)
{
  unsigned char *	t;

  t = text + charPos;
  if ( *t <= ' ' || *t == '<' || *t == '>' )
	return(TRUE);
  else
	return(FALSE);
}


Thanks in advance!

Byron Weber Becker
bwbecker@watdragon.waterloo.edu
Open Text Systems, Inc.
Waterloo, Ont.  
Canada