[comp.sys.mac.programmer] TE changes

tarr-michael@CS.YALE.EDU (michael tarr) (08/30/90)

Anyone know how to find out if text in a TE window has changed? I could
check the char count in the struct, but that could be misleading (e.g.
replacing one character wouldn't change it).

-- 
 * Mike Tarr                                    The Human Neuron Project  *
 * tarr@cs.yale.edu                             Department of Psychology  *
 * "My opinions are always my own."             Yale University           *
 **************************************************************************

philip@pescadero.Stanford.EDU (Philip Machanick) (08/31/90)

In article <25932@cs.yale.edu>, tarr-michael@CS.YALE.EDU (michael tarr) writes:
> Anyone know how to find out if text in a TE window has changed? I could
> check the char count in the struct, but that could be misleading (e.g.
> replacing one character wouldn't change it).

When your program does something that could result in changing the text, it
will usually be obvious whether something will change, e.g., an insert/paste
(empty selection) or a delete (with non-empty selection).

The only case that's slightly complicated is an insert (or paste) with a
non-empty selection, when you need to check if the current selection = what's
being inserted.

Seems simple - am I missing something?

Philip Machanick
philip@pescadero.stanford.edu

dorner@pequod.cso.uiuc.edu (Steve Dorner) (09/01/90)

In article <1990Aug30.181935.15335@Neon.Stanford.EDU> philip@pescadero.stanford.edu writes:
>When your program does something that could result in changing the text, it
>will usually be obvious whether something will change, e.g., an insert/paste
>(empty selection) or a delete (with non-empty selection).
>Seems simple - am I missing something?

Well, arrow keys, for one; TE does handle them all by itself.

It would be convenient if TE did tell you if it changed text, or only
the position of the insertion point.  It isn't impossible the way you
suggest (I do it myself), but it _is_ messy and it _would_ be nice if TE
could tell you, since it knows.  Perhaps something like ScrapCount could
work.

Of course, it would be even nicer if TE handled text >32K, but I guess
Apple feels that's a wheel we should all invent separately.
--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner