> On Thu, Nov 18, 2021 at 5:57 AM Bram Moolenaar <[email protected]> wrote:
> >
> >
> > > How do we get all text-properties of a specific buffer?
> > >
> > > In the examples you use `line('$')` but the function doesn't accept a
> > > buffer number. Currently the only way to obtain the number of lines in
> > > a buffer is through `getbufinfo(bufnr)[0].linecount` but this is a bit
> > > heavy considering how much data `getbufinfo()` could return. So
> > > wouldn't it be more efficient to accept `'$'` directly in `end_lnum`?
> > >
> > > For example: `prop_list(1, {'bufnr': 4, 'end_lnum': '$', 'id': [123]})`.
> >
> > We try to stay away from arguments with mixed types.  Accepting both a
> > number and a string makes it harder to give good error messages.
> >
> 
> The existing buffer related functions appendbufline(),
> deletebufline(), getbufline()
> and setbufline() already accept "$" to refer to the last line in a buffer.
> I can modify prop_list() to also accept '$' for 'end_lnum'.

Yeah, we used to do this in the past, but now that we have added more
type checking it's probably better to stop doing it like this.

Using a very large number works, although it's not the nicest.
Perhaps we could use -1, as a negative number is relative to the end?
So -2 would be last-but-one line.  Might be useful?
It's at least existing, see :help list-index.

-- 
Be nice to your kids...  they'll be the ones choosing your nursing home.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211118171252.257E31C6566%40moolenaar.net.

Raspunde prin e-mail lui