[comp.sys.mac.programmer] Tabs in TextEdit

c162-fs@zooey.Berkeley.EDU (Bruce Burkhalter) (10/07/88)

In an old issue of MacTutor there was an article implementing tabs in TextEdit.
As I recall, it looked pretty messy, but it did do the job.

I can't recall which issue, but it is in one of the "Best of MacTutor" 
compilations.  If you want more info, let me know.

Bruce 
Burkhalter

bruce@cory.berkeley.edu
c162-fs@zooey.berkeley.edu

tim@hoptoad.uucp (Tim Maroney) (10/07/88)

As David Oster pointed out, tabs can be handled by intercepting the TextEdit
bottleneck TEWidthHook using the new TECustomHook procedure documented in
Technical Note #207.  This only works on System 6.0+.  However, Tech Note
#203 ("Don't Abuse The Managers") indicates that there is little point in
doing so.  Past 2K or 3K, the performance becomes unmanageable, because
of a combination of handle resizing and line offset adjustment.  To do a
text editor in TextEdit, you'd have to keep everything in 2K chunks, which
could be done (after all, you handle your own scroll bar) but my guess is
the memory overhead from all those TEHandles would get mighty noticeable.

Yes, I had a reason for posting this.  What does Apple have against linked
lists?  If TextEdit did everything with a linked list of lines rather than
a relocatable contiguous array, both these sources of overhead would drop
out.  The same goes for their cautions about abusing the List Manager.  I'm
sure the original code was that way because no one expected to be handling
lots of data; but wouldn't it be great if Apple upgraded to linked lists?
You could, for example, put a real text editor in a terminal program with
only a few days work, build a simple spreadsheet on the List Manager, and
so on.  Since Apple is crawling with programmers, I hope they do this, unless
there's something I've overlooked.  There's still some memory manager overhead,
12 bytes per line, but this seems sustainable.
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
This message does represent the views of Eclectic Software.

alan@Apple.COM (Alan Mimms) (10/10/88)

> ...Since Apple is crawling with programmers, I hope they do this, unless
> there's something I've overlooked...

[Fairly new Apple employee steps onto enormously tall soapbox...]

Apple is most emphatically NOT crawling with programmers with nothing to
do.  In fact, it is quite a difficult task (as anyone who's tried will
tell you) to find EXCELLENT Macintosh programmers, or excellent programmers
of any sort, for that matter...

Please do not assume I'm whining just to get people to cut Apple some
possibly undeserved slack.  You KNOW we're growing at an ASTONISHING rate
and that some growing pains are simply unavoidable.  But I DO believe
that we really ARE addressing things in a priority basis.  Some of the
priorities might not be the same as yours, and we CERTAINLY MAY have
missed a lot of good ideas in the shuffle, but we are basically on your
side.

(Did I CAPITALIZE enough WORDS in the ABOVE to SUIT YOU?!? :-)

[Apple person steps sheepishly down from enormously tall soapbox...]

Alan Mimms (alan@apple.com)           My opinions are generally
Communications Products Development   pretty worthless, but
Apple Computer, Inc.                  they *are* my own...
...it's so simple that only a child can do it!  -- Tom Lehrer, "New Math"

mf2u+@andrew.cmu.edu (Matthew Raymond Flatt) (11/01/90)

Is there an easy way to do tabs in TextEdit?

Matthew

oster@well.sf.ca.us (David Phillip Oster) (11/10/90)

yes, since TextEdit is multi-font now, you can create a font of 256 blanks,
varying in width from 1-pixel to 256 wide. you compute how wide a sp[ace you
need to simulate a tab, and replace the tab by an appropriate char from your
blankFont.
-- 
-- David Phillip Oster - Note new signature. Old one has gone Bye Bye.
-- oster@well.sf.ca.us = {backbone}!well!oster

kazim@Apple.COM (Alex Kazim) (11/13/90)

In article <21590@well.sf.ca.us> oster@well.sf.ca.us (David Phillip Oster) writes:
>yes, since TextEdit is multi-font now, you can create a font of 256 blanks,
>varying in width from 1-pixel to 256 wide. you compute how wide a sp[ace you
>need to simulate a tab, and replace the tab by an appropriate char from your
>blankFont.
>-- 

(Much Laughing).  This is a pretty damn neat idea.  Too bad TextEdit
doesn't do this already.

===================================================================
Alex Kazim
Apple Computer
===================================================================