aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/macros.h
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-09-16 22:57:34 +0200
committerThomas Vigouroux <tomvig38@gmail.com>2021-07-06 19:07:11 +0200
commit55a2c513aafb386c01259fca711b2e0f9b85e359 (patch)
treee9775da5a45147c4706ad468af925e0a53bcdcb3 /src/nvim/macros.h
parentdf33f30e8882b2bf692253d63f73fb602a13f888 (diff)
downloadrneovim-55a2c513aafb386c01259fca711b2e0f9b85e359.tar.gz
rneovim-55a2c513aafb386c01259fca711b2e0f9b85e359.tar.bz2
rneovim-55a2c513aafb386c01259fca711b2e0f9b85e359.zip
buffer: don't rely on curbuf in BUFEMPTY
Diffstat (limited to 'src/nvim/macros.h')
-rw-r--r--src/nvim/macros.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index 48a16ed42a..dce1e73dfd 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -35,8 +35,8 @@
#define LINEEMPTY(p) (*ml_get(p) == NUL)
/// BUFEMPTY() - return TRUE if the current buffer is empty
-#define BUFEMPTY() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == \
- NUL)
+#define BUFEMPTY(buf) ((buf)->b_ml.ml_line_count == 1 \
+ && *ml_get_buf((buf), (linenr_T)1, false) == '\0')
// toupper() and tolower() that use the current locale.
// Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the