diff options
author | Thomas Vigouroux <tomvig38@gmail.com> | 2020-11-24 08:48:05 +0100 |
---|---|---|
committer | Thomas Vigouroux <tomvig38@gmail.com> | 2021-07-06 19:12:15 +0200 |
commit | 7970631fa01e95a41ba4520e030e6208c8fb3648 (patch) | |
tree | 60a6a82ffb1f5d0388cb816c68e2a31ead1cda2d /src/nvim/buffer.h | |
parent | 763c852812c8c7e819881a76a237b6f19920f803 (diff) | |
download | rneovim-7970631fa01e95a41ba4520e030e6208c8fb3648.tar.gz rneovim-7970631fa01e95a41ba4520e030e6208c8fb3648.tar.bz2 rneovim-7970631fa01e95a41ba4520e030e6208c8fb3648.zip |
buffer: move BUFEMPTY to a function
Diffstat (limited to 'src/nvim/buffer.h')
-rw-r--r-- | src/nvim/buffer.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index ac7ead5f92..02a2ac36f7 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -9,6 +9,7 @@ #include "nvim/func_attr.h" #include "nvim/eval.h" #include "nvim/macros.h" +#include "nvim/memline.h" // Values for buflist_getfile() enum getf_values { @@ -128,4 +129,10 @@ static inline void buf_inc_changedtick(buf_T *const buf) buf_set_changedtick(buf, buf_get_changedtick(buf) + 1); } +static inline bool buf_is_empty(buf_T *buf) +{ + return buf->b_ml.ml_line_count == 1 + && *ml_get_buf(buf, (linenr_T)1, false) == '\0'; +} + #endif // NVIM_BUFFER_H |