🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #26869

Re: Help! TextEdit Programming Problem - "nLines"

#26869
From: Will Clinger
Date: Wed, 30 Mar 1988 20:57
35 lines
1786 bytes
In article <2653@tekig4.TEK.COM> gregr@tekig4.UUCP (Greg Rogers) writes:
>
>Can any Mac wizard shed some light on a programming problem I'm having?  My
>edit record (TERec) seems to completely loose track of the number of lines of
>text as I'm adding characters to the text....

I'll bet you're using a Macintosh SE.  On an SE, the lineStarts array will
be calculated incorrectly (or sometimes the system will crash) when all of
the following conditions hold:

    _TEInsert is called;
    the inserted text ends in a space;
    selEnd = teLength;
    after the text has been inserted, the (garbage) byte following the
        newly inserted text in RAM happens to contain a carriage return.

Neither the Macintosh Plus nor the Macintosh II have this bug.

The bug lies in the routine whose address is stored at $07fc.  The ninth
through eleventh instructions in that routine are:

    cmpi.b  #$0d,0(a0,d0.w)
    bne.s   ...
    addq.w  #1,d0

If you change the add instruction to a no-op, your bug will disappear.
(You may have created a different bug because this undoubtedly disables
a minor feature of TextEdit, but the new bug seems much less serious than
the old.)

I hope this helps.  The bug was reported to Apple on 10 February 1988.

Peace,
William Clinger
Semantic Microsystems, Inc.
Technical Details
Message-ID: <3105@tekchips.TEK.COM>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!tektronix!tekcrl!tekchips!willc
References: <18317@think.UUCP> <2653@tekig4.TEK.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!tektronix!tekcrl!tekchips!willc
From: willc@tekchips.TEK.COM (Will Clinger)
Newsgroups: comp.sys.mac
Subject: Re: Help! TextEdit Programming Problem - "nLines"
Message-ID: <3105@tekchips.TEK.COM>
Date: 30 Mar 88 20:57:38 GMT
References: <18317@think.UUCP> <2653@tekig4.TEK.COM>
Reply-To: willc@tekchips.UUCP (Will Clinger)
Organization: Tektronix Inc., Beaverton, Or.
Lines: 35
Summary: It's an SE patch resource bug