Hi all,
I'm working with a Vim that has been patched to support ECL Lisp
(http://wiki.alu.org/Vim_ECL).  Part of our project involves
outputting potentially large amounts of data  to a buffer in a
streaming fashion, ie always adding at the end.
I think that I have worked out a reasonable way to append lines[1],
but I can't see any obvious way to quickly append single chars to a
buffer.
Are there any functions like ml_append I can look to for this support?
How should I go about appending single chars very quickly?

Cheers
Brad

[1] Here is the append code that I hacked up tonight

static cl_object cl_vim_append_lines_int (cl_object buf, cl_object lines)
{
   buf_T *savebuf = curbuf;
   curbuf = ((buf_T *)ecl_foreign_data_pointer_safe(buf));
   int start_line = curbuf->b_ml.ml_line_count;

   while (lines != Cnil) {
       char_u *line = string_to_line (cl_car (lines));
       ml_append (curbuf->b_ml.ml_line_count-1, line, 0, FALSE);
       vim_free (line);
       lines = cl_cdr (lines);
   }
   changed_lines(start_line, 0, curbuf->b_ml.ml_line_count,
(long)(curbuf->b_ml.ml_line_count - start_line));

   /* restore and return */
   curbuf = savebuf;
   return Ct;
}

Reply via email to