Re: Converting the whole buffer to a simple string
- on 09/01/2000 18:22, Johannes Zellner at johannes@... wrote:
> On Sun, 9 Jan 2000, Dany St-Amant wrote:Thanks for the hint, the do_join showed me how to do it. FYI, Here's the
>> In order to support Vim as an External Editor for CodeWarðior on the MacOS,
>> I need to have the whole buffer as a simple string (probably with the MacOS
>> end-of-line character). Is there any function doing this in the current
>> code? I tried to follow the "clip_..." stuff but got lost.
> does this help?
snippet of code which use some MacOS specific memory reallocation stuff.
for (lineno = 0; lineno < buf->b_ml.ml_line_count; lineno++)
line = ml_get((linenr_t) lineno);
linesize = STRLEN(line) + 1;
lineStart = BufferSize;
BufferSize += linesize;
/* Resize handle to linesize+1 to include the linefeed */
SetHandleSize (GetTextData.theText, BufferSize);
if (GetHandleSize (GetTextData.theText) != BufferSize)
printf ("KAHL_GTTX: SetHandleSize increase: %d, size %d\n",
break; /* Simple handling for now */
fullbuffer = (char_u *) *GetTextData.theText;
STRCPY ((char_u *) (fullbuffer + lineStart), line);
fullbuffer[BufferSize-1] = '\r';
fullbuffer[BufferSize-1] = 0;