Ken Takata wrote:
> The lnum member of getbufinfo() for the current buffer looks strange for me.
> E.g.:
>
> Open a new buffer and input some lines.
> Move the cursor to line 5, then execute the following:
> :echo getbufinfo('%')[0].lnum
> 1
> I expect 5 for this (as same as :ls).
>
> The following patch fixes this:
>
> --- a/src/evalfunc.c
> +++ b/src/evalfunc.c
> @@ -3979,7 +3979,8 @@ get_buffer_info(buf_T *buf)
> dict_add_nr_str(dict, "bufnr", buf->b_fnum, NULL);
> dict_add_nr_str(dict, "name", 0L,
> buf->b_ffname != NULL ? buf->b_ffname : (char_u *)"");
> - dict_add_nr_str(dict, "lnum", buflist_findlnum(buf), NULL);
> + dict_add_nr_str(dict, "lnum", buf == curbuf ? curwin->w_cursor.lnum
> + : buflist_findlnum(buf), NULL);
> dict_add_nr_str(dict, "loaded", buf->b_ml.ml_mfp != NULL, NULL);
> dict_add_nr_str(dict, "listed", buf->b_p_bl, NULL);
> dict_add_nr_str(dict, "changed", bufIsChanged(buf), NULL);
>
> This part is copied from the implementation of `:ls`.
Thanks. Should be able to test this in src/testdir/test_bufwintabinfo.vim
--
hundred-and-one symptoms of being an internet addict:
192. Your boss asks you to "go fer" coffee and you come up with 235 FTP sites.
/// 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.