Loading ...
Sorry, an error occurred while loading the content.

Re: Converting the whole buffer to a simple string

Expand Messages
  • Dany St-Amant
    ... Thanks for the hint, the do_join showed me how to do it. FYI, Here s the snippet of code which use some MacOS specific memory reallocation stuff. for
    Message 1 of 3 , Jan 11, 2000
    • 0 Attachment
      on 09/01/2000 18:22, Johannes Zellner at johannes@... wrote:

      > On Sun, 9 Jan 2000, Dany St-Amant wrote:
      >
      >> Hi,
      >>
      >> 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.
      >
      > :%join!
      >
      > does this help?

      Thanks for the hint, the do_join showed me how to do it. FYI, Here's the
      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)
      {
      #ifdef USE_SIOUX
      printf ("KAHL_GTTX: SetHandleSize increase: %d, size %d\n",
      linesize, BufferSize);
      #endif
      break; /* Simple handling for now */
      }
      else
      {
      HLock (GetTextData.theText);
      fullbuffer = (char_u *) *GetTextData.theText;
      STRCPY ((char_u *) (fullbuffer + lineStart), line);
      fullbuffer[BufferSize-1] = '\r';
      HUnlock (GetTextData.theText);
      }
      }
      HLock (GetTextData.theText);
      fullbuffer[BufferSize-1] = 0;
      HUnlock (GetTextData.theText);
    Your message has been successfully submitted and would be delivered to recipients shortly.