[comp.sys.mac.programmer] TECalText problem

anarch@eleazar.dartmouth.edu (The Anarch) (02/03/91)

     I have been having trouble with the TECalText() call lately, and I wonder
if anyone here might have the answers.  The situation is this: I have a
TextEdit record whose contents I want to change.  I do so, copying new text
into the hText buffer and setting the teLength field to the new number of
characters.  Then I call TECalText(), expecting to end up with a nice new
reformatted piece of text.  I do, in fact, get the expected results--and more,
as all sorts of garbage are tacked onto the tail of the text.  Now I had
thought that teLength would tell TECalText() where the end of my text was, but
I see that actually it's TECalText() that changes teLength to suit it.  From
that and the bit in Inside Mac about TERecal, it seems to me that TECalText
uses some parameter other than teLength to find out the length of the text.
I haven't had any luck with Inside Mac or the Tech Notes in trying to find out
what the parameter is, though, and I have neither the time nor the patience to
disassemble TECalText(), so can anyone tell me what I ought to be doing?  Is
this just something dumb?
     Please reply by mail since I don't read this group regularly.  I'll post
a summary.