Path: utzoo!utgpu!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!agate!helios.ee.lbl.gov!ux1.lbl.gov!beard From: beard@ux1.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: Serious programming question Message-ID: <4002@helios.ee.lbl.gov> Date: 23 Oct 89 01:17:50 GMT References: <89295.142753CXT105@PSUVM.BITNET> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux1.lbl.gov (Patrick C Beard) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 24 In article <89295.142753CXT105@PSUVM.BITNET> CXT105@PSUVM.BITNET (Christopher Tate) writes: >What sort of data structures are generally used for representing text in an >editor or word-processor? Obviously TextEdit is an alternative, but it's slow >(as far as I've heard) and imposes size restrictions. > >Has anyone here done work with writing editors or word-processors? Could you >give a newcomer to the problem a little hand getting started...? > I've thought about this a bit, though I've not gotten around to implementing it. The solution that seems the most flexible is a doubly linked list of lines (or paragraphs if you prefer). That way, you'll have fairly small blocks of memory to move around when you insert characters etc. And changing the order of things is very inexpensive. And the solution would definitely depend on what the possible attributes are that you'll be keeping track of. This is an interesting topic. What have others done? Patrick ------------------------------------------------------------------------------- - Patrick Beard, Macintosh Programmer (beard@lbl.gov) - - Berkeley Systems, Inc. "..............Good day!" - Paul Harvey - -------------------------------------------------------------------------------