I just figured out that $curbuf->Count() doesn't track the contents of $curbuf
accross $curbuf->Delete() (and presumably other methods).  For example:

    our $curbuf;
    my @buflines = $curbuf->Get(1 .. $curbuf->Count());
    print LOG "\...@buflines size before Delete: "....@buflines."\n";
    print LOG '$curbuf->Count() before Delete: '.$curbuf->Count()."\n";
    $curbuf->Delete(1 .. $curbuf->Count());
    print LOG '$curbuf->Count() after Delete: '.$curbuf->Count()."\n";

results in:

   @buflines size before Delete: 86
   $curbuf->Count() before Delete: 86
   $curbuf->Count() after Delete: 86

This was different that my expectations at least.  I don't know if these methods
get synced back up after a VIM::DoCommand that changes lines or not.

It would be nice if the documentation would talk about this stuff.  Probably the
best way given the current behavior is to just read the whole buffer into perl,
do whatever you have in mind, then write it back at the end.  Methods for this
might be a good idea.

Also, it might be nice to show an example using 'our $curbuf' since this is a
somewhat uncommon perl thing.  Of course, using $curbuf everywhere is no
so good anyway given the above issue.

Britton

-- 
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

Raspunde prin e-mail lui