Christian wrote:

> here is a patch, that allows the setline() functions to remove lines 
> after the newly added content. For example you have used setline() to 
> add 10 lines to a buffer and later one, you noticed you only want the 
> buffer to have 2 lines, you cannot do it without deleting the whole 
> buffer using e.g. `:%d` before.
> 
> While that is okay for using `setline()` it becomes cumbersome, if one 
> needs to do it for the non-current buffer, e.g. using setbufline() it is 
> not possible, without manually going to the buffer, deleting it and then 
> using setline(). That means, one cannot take advantage of the 
> `setbufline()` function at all and might not be possible for timer or 
> async functions.
> 
> So here is a patch, that allows to remove lines after the newly pasted 
> content.

Hmm, this is counterintuitive: A function that adds some lines and
deletes others.

Another way would be to have a replace() function:
        call replace(first, last, lines)

But probably it's better to just add a delete lines function, to counter
the setline() and setbufline() functions:
        call delline(lnum)
        call delline(first, last)
        call delbufline(buffer, lnum)
        call delbufline(buffer, first, last)

Better than:
        exe first . ',' . last . 'd'

-- 
   They now pass three KNIGHTS impaled to a tree.  With their feet off the
   ground,  with one lance through the lot of them, they are skewered up
   like a barbecue.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui