> 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.
Getting the number of lines in a buffer is a generic thing. line()
already takes an optional window ID argument. It's logical to also
accept a buffer number.
line({expr}, {winid}, {bufnr})
However, that is ambiguous, the {winid} would be ignored when using the
{bufnr}. Perhaps it's better to use:
line({expr}, {id}, {id-is-bufnr})
When the third argument is omitted or FALSE, the {id} is used as the
{winid} like before. When it is TRUE then {id} is used as {bufnr}.
So for your example you can use: line('$', bufnr, 1).
How about that?
An alternative would be to add a bufline() function. Advantage is that
we can drop the window related items, since a buffer by itself does not
have a cursor position or visible lines.
--
There are three kinds of people: Those who can count & those who can't.
/// 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/20211118135702.2510C1C6567%40moolenaar.net.