[comp.sys.mac.programmer] Need Help! Tabs 'n TextEdit

johnston@ug.cs.dal.ca (Bruce Johnston) (11/30/89)

Hi there Mac gurus ...... I have yet another question about using TextEdit

I realize that Inside Mac explicitly states that TextEdit does not support the
use of tabs. (at least IM I does) Anyway I would really like implement some
sort of tab system. It wouldn't have to be very complicated.... a fixed length
tab would be fine. 

Has anyone had any experience in doing this or any ideas. I thought about 
checking for a tab before I go into TEKey and if I find a tab then I would
change the call into a specified number of spaces by repeatedly calling TEKey
with a space value. But this would be a real, and I mean REAL, ugly hack and
it wouldn't help with back tabbing. So anybody got any neat ideas?

Thanx in advance
Bruce

-- 
Bruce Johnston       
Dalhousie University Halifax, Nova Scotia, CAnada.

Disclaimer: I'm always right... and submarines have screen doors!

stores@unix.SRI.COM (Matt Mora) (12/01/89)

In article <1989Nov30.044549.24362@ug.cs.dal.ca> johnston@ug.cs.dal.ca (Bruce Johnston) writes:
>Hi there Mac gurus ...... I have yet another question about using TextEdit
>
>I realize that Inside Mac explicitly states that TextEdit does not support the
>use of tabs. (at least IM I does) Anyway I would really like implement some
>sort of tab system. It wouldn't have to be very complicated.... a fixed length
>tab would be fine. 
>

>Bruce Johnston       
>Dalhousie University Halifax, Nova Scotia, CAnada.

In "The Complete MacTutor, Vol.2" page 299 is an article called
"extending Textedit to handle tabs" by Bradley W. Nedrud.

You might want to look at that to see what you might be getting yourself into.


Good luck







-- 
___________________________________________________________
Matthew Mora
SRI International                       stores@unix.sri.com
___________________________________________________________

d88-jwa@nada.kth.se (Jon Watte) (12/01/89)

In article <6288@unix.SRI.COM> stores@unix.UUCP (Matt Mora) writes:
>In article <1989Nov30.044549.24362@ug.cs.dal.ca> johnston@ug.cs.dal.ca (Bruce Johnston) writes:

>>use of tabs. (at least IM I does) Anyway I would really like implement some
>>sort of tab system. It wouldn't have to be very complicated.... a fixed

[the Complete MacYutor]
>You might want to look at that to see what you might be getting yourself into.

Or, the crude & easy way, modify the font you're using so that the 'tab'
character (8) is four times the width of the blank character...

This requires you to ship the font with the application, though :-(

									h+
-- 
   --  Stay alert !  -  Trust noone !  -  Keep your laser handy !  ---
            h+@nada.kth.se  ==  h+@proxxi.se  ==  Jon Watte
                   longer .sig available on request

jrk@sys.uea.ac.uk (Richard Kennaway) (12/03/89)

In article <1989Nov30.044549.24362@ug.cs.dal.ca> johnston@ug.cs.dal.ca (Bruce Johnston) writes:
>I realize that Inside Mac explicitly states that TextEdit does not support the
>use of tabs. (at least IM I does) Anyway I would really like implement some
>sort of tab system. It wouldn't have to be very complicated.... a fixed length
>tab would be fine. 
>
>Has anyone had any experience in doing this or any ideas. I thought about 
>checking for a tab before I go into TEKey and if I find a tab then I would
>change the call into a specified number of spaces by repeatedly calling TEKey
>with a space value.

That's exactly how I did tabs in a little TextEdit-based editor I have,
originally based on one of the TransSkel demos.  The users seem to like it.

>But this would be a real, and I mean REAL, ugly hack and

Ugly?  It avoids assembler and patches - good enough for me :-).

>it wouldn't help with back tabbing. So anybody got any neat ideas?

For back tabbing, I defined option-backspace to delete spaces back to
the last tab stop (mutatis mutandis when there isnt a run of spaces back
to the last tab stop).

Remember to handle not just tab keystrokes, but every other way of
inserting tabs, e.g. pasting, reading a file, search/replace, undo.

Of course, the real answer is for someone to reimplement TextEdit to
handle tabs, large buffers, and low memory, and make it public domain.
Any takers?  (Don't ask me, I'm just a hobbyist.)

--
Richard Kennaway          SYS, University of East Anglia, Norwich, U.K.
Internet:  kennaway@sys.uea.ac.uk	uucp:  ...mcvax!ukc!uea-sys!jrk

usenet@cps3xx.UUCP (Usenet file owner) (12/05/89)

In article <1989Nov30.044549.24362@ug.cs.dal.ca> johnston@ug.cs.dal.ca (Bruce Johnston) writes:
>checking for a tab before I go into TEKey and if I find a tab then I would
>change the call into a specified number of spaces by repeatedly calling TEKey
>with a space value. But this would be a real, and I mean REAL, ugly hack and

Not only very ugly, it doesn't give true tabs.

I haven't done it myself, but if I where, I'd get the following...

    MacTutor volume 2 number 11.  Contains source example and good
        explanations of how to do variable tabs.

    All Tech Notes regarding TextEdit.  One of them contains a routine
        that can be used for this purpose.  Actually, it documents a
        new hook into TE.

The examples in MacTutor where (understandably) typical of that publication...  nearly no error handling and no guarentee of compatiblity.  The Tech Notes will
help with both items.  Hope that this helps, and I'm sorry if this has
already been repeated.  I still have nearly a hundred articles to catch
up on after finals...

---
Robert Cook.
Michigan State University, E. Lansing, MI
I'm just a student, have nothing of value, so please don't sue me...

svc@well.UUCP (Leonard Rosenthol) (12/11/89)

In article <5664@cps3xx.UUCP> cookr@cpsin1.UUCP (Robert W Jr Cook) writes:
>In article <1989Nov30.044549.24362@ug.cs.dal.ca> johnston@ug.cs.dal.ca (Bruce
Johnston) writes:
>>[discussion of substituting spaces for tabs]
>
>I haven't done it myself, but if I where, I'd get the following...
>
>    MacTutor volume 2 number 11.  Contains source example and good
>        explanations of how to do variable tabs.
>
        This will not work with the new Styled TE (or at least it didn't under
System 4.2 when Styled TE first came out).  It should still work the older TE,
but I have not tried it recently.

>    All Tech Notes regarding TextEdit.  One of them contains a routine
>        that can be used for this purpose.  Actually, it documents a
>        new hook into TE.
>
        Don't bother!  David Dunham and I tried it when this first got
published and it was discovered after LOTS of time in TMON and MacNosy (and then
confirming with the author) that there was a missing piece of code in TE - the 
System TE code is missing about two-three lines of code which would actually
USE the 'tabHook' (forget the name right now).
        They were supposed to fix this, but as of System 6.0.4 they have not
done so - maybe by the time they get TE to be Script Manager compatible, it
will  also either support tabs themselves or at least fix the hook!!

-- 
+--------------------------------------------------+
Leonard Rosenthol        |  GEnie : MACgician
Lazerware, inc.          |  MacNet: MACgician
UUCP: svc@well.UUCP      |  ALink : D0025