diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-11-06 22:15:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 22:15:10 -0500 |
commit | da134270d3e9f8a4824b0e0540bf017f7e59b06e (patch) | |
tree | a42ff47bceb77e172d02e66ca42e54eeb45e0547 /src/nvim/buffer.c | |
parent | 40a742725ccd472038685ccb99090ee2a6b2c912 (diff) | |
parent | 038e98fd7de10f5442a11eb5d54c39d145559d79 (diff) | |
download | rneovim-da134270d3e9f8a4824b0e0540bf017f7e59b06e.tar.gz rneovim-da134270d3e9f8a4824b0e0540bf017f7e59b06e.tar.bz2 rneovim-da134270d3e9f8a4824b0e0540bf017f7e59b06e.zip |
Merge pull request #13237 from janlazo/vim-8.2.1959
vim-patch:8.1.2422,8.2.{1959,1961,1962,1963}
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 12 |
1 files changed, 11 insertions, 1 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. */ |