Path: utzoo!attcan!uunet!nems!ark1!uakari.primate.wisc.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!mountn.dec.com!minow From: minow@mountn.dec.com (Martin Minow) Newsgroups: comp.sys.mac.programmer Subject: Re: TextEdit Questions Message-ID: <1727@mountn.dec.com> Date: 29 Jun 90 12:20:20 GMT References: <1990Jun28.174941.3176@jarvis.csri.toronto.edu> Reply-To: minow@bolt.enet.dec.com (Martin Minow) Organization: Digital Equipment Corporation Lines: 39 In article <1990Jun28.174941.3176@jarvis.csri.toronto.edu> west@turing.toronto.edu (Tom West) writes: > > Perhaps a few people knowing about TextEdit could help here. I have a few >questions about the lineStarts and nLines fields. The best way to figure this out is to write a small program and use the ThinkC debugger to watch the TERec as you single-step through the program. These answers are from memory and probably incorrect. (1) I believe nLines is zero and lineStarts is empty when the TERecord is first initialized. Also teLength, selStart and selEnd are zeroed. (2) After entering one character, nLines is one and lineStarts[1] is one -- it's one past the index of the last character. (3) After entering \r, we all get lost. I *think* the first line is "X\r" so lineStarts[1] = 2 and nLines is still one: better look at the TERec: the case where there's a \r at the end of the TERec is what we professional programmers call a real mess. (4) After entering V (X\rV), nLines would be two, lineStarts[1] -> 'V', lineStarts[2] is the index to the character after 'V' (== teLength) When you poke around in the TERec, watch the interaction of the cursor and the presence/abscence of a \r at the end of a record. If you want to see code that more-or-less duplicates TextEdit, look at my articles in the Feb/March MacTutor (Note: it is *NOT* Apple code.) >In another unrelated question. I have found out that TextEdit displays >actual CRs at the end of each line when it is displaying a record. I wish >to use a character set where very character is printable. Is there any way >to have TE do the proper line ends, without actually putting a CR on the >screen? (I would display Chr(13)'s using another routine that wouldn't >use TE when the user wanted that character printed) I think you're out of luck, unless you decide to attack the display "bottleneck" functions. I think you'd be better off writing something that suits your specific needs, though. Martin Minow minow@bolt.enet.dec.com