diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 12 | ||||
-rw-r--r-- | src/nvim/eval/typval.c | 3 | ||||
-rw-r--r-- | src/nvim/eval/typval.h | 3 | ||||
-rw-r--r-- | src/nvim/testdir/shared.vim | 2 |
4 files changed, 16 insertions, 4 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 7ea5a64a96..0ebe33f2f8 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -5416,7 +5416,7 @@ char_u *buf_spname(buf_T *buf) return (char_u *)_("[Scratch]"); } if (buf->b_fname == NULL) { - return (char_u *)_("[No Name]"); + return buf_get_fname(buf); } return NULL; } @@ -5477,6 +5477,16 @@ int buf_signcols(buf_T *buf) return buf->b_signcols; } +// Get "buf->b_fname", use "[No Name]" if it is NULL. +char_u *buf_get_fname(const buf_T *buf) + FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL +{ + if (buf->b_fname == NULL) { + return (char_u *)_("[No Name]"); + } + return buf->b_fname; +} + /* * Set 'buflisted' for curbuf to "on" and trigger autocommands if it changed. */ diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 8dde78de3d..ada6f78f10 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1358,7 +1358,8 @@ void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item) //{{{2 Alloc/free -/// Allocate an empty dictionary +/// Allocate an empty dictionary. +/// Caller should take care of the reference count. /// /// @return [allocated] new dictionary. dict_T *tv_dict_alloc(void) diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 503a32a81e..1e3e9bd366 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -301,7 +301,8 @@ struct funccall_S { int dbg_tick; ///< Debug_tick when breakpoint was set. int level; ///< Top nesting level of executed function. proftime_T prof_child; ///< Time spent in a child. - funccall_T *caller; ///< Calling function or NULL. + funccall_T *caller; ///< Calling function or NULL; or next funccal in + ///< list pointed to by previous_funccal. int fc_refcount; ///< Number of user functions that reference this funccall. int fc_copyID; ///< CopyID used for garbage collection. garray_T fc_funcs; ///< List of ufunc_T* which keep a reference to "func". diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index 440da67412..0e20ac1593 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -243,7 +243,7 @@ func s:feedkeys(timer) call feedkeys('x', 'nt') endfunc -" Get $VIMPROG to run Vim executable. +" Get $VIMPROG to run the Vim executable. " The Makefile writes it as the first line in the "vimcmd" file. " Nvim: uses $NVIM_TEST_ARG0. func GetVimProg() |