🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1205

Re: [textObj1 readRichText: [textObj2 stream]]

#1205
From: simsong Simson L. Garfinkel
Date: Tue, 18 Aug 1992 13:48
27 lines
1546 bytes
In article <1992Aug17.211456.14181@Trirex.COM> mmelling@Trirex.com (Michael  
Mellinger) writes:
> When I try to set the text of one text object to be that of another text  
> object (the subject line puts it simpler), I get all of the text but the  
> linefeeds are missings, including the hard returns at the end of  
> paragraphs.  Is there something obvious that I'm overlooking when trying  
> to copy the text from one text object to another?  I hope that I'm not  
> going to get stuck looking at theBreaks variable in the Text object and  
> pulling each line out one by one.
> 
> -Mike

This isn't the approved way to do this.  Sadly, you've got to write the first  
Text object into a memory buffer, than read it out.

Try this:

	NXStream	*str = NXOpenMemory(0,0,NX_READWRITE);
	[text1		writeRichText:str];
	NXSeek(str,0L,NX_FROMSTART);
	[text2		readRichText:str];
	NXCloseMemory(str,NX_FREEBUFFER);

It's still quite zippy.
-- 

................................................................simson
Technical Details
Message-ID: <1992Aug18.134829.8420@next.cambridge.ma.us>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!yale!mintaka.lcs.mit.edu!ai-lab!next.cambridge.ma.us!simsong
References: <1992Aug17.211456.14181@Trirex.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!yale!mintaka.lcs.mit.edu!ai-lab!next.cambridge.ma.us!simsong
From: simsong (Simson L. Garfinkel)
Newsgroups: comp.sys.next.programmer
Subject: Re: [textObj1 readRichText: [textObj2 stream]]
Message-ID: <1992Aug18.134829.8420@next.cambridge.ma.us>
Date: 18 Aug 92 13:48:29 GMT
References: <1992Aug17.211456.14181@Trirex.COM>
Sender: simsong@next.cambridge.ma.us
Reply-To: simsong@next.cambridge.ma.us
Organization: Simson Garfinkel and Associates, Inc.
Lines: 27