aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-06 22:15:10 -0500
committerGitHub <noreply@github.com>2020-11-06 22:15:10 -0500
commitda134270d3e9f8a4824b0e0540bf017f7e59b06e (patch)
treea42ff47bceb77e172d02e66ca42e54eeb45e0547 /src/nvim/buffer.c
parent40a742725ccd472038685ccb99090ee2a6b2c912 (diff)
parent038e98fd7de10f5442a11eb5d54c39d145559d79 (diff)
downloadrneovim-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.c12
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.
*/