aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-09-29 09:29:16 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-10-01 22:27:45 -0400
commit655085204e36cdf91750db5e09ae3feb4884c670 (patch)
treeb07fd88bd650fec2746b86d248bfd0f3f44b8415
parent8b67c8f8c6538f22c6b6868a2603109b6670874e (diff)
downloadrneovim-655085204e36cdf91750db5e09ae3feb4884c670.tar.gz
rneovim-655085204e36cdf91750db5e09ae3feb4884c670.tar.bz2
rneovim-655085204e36cdf91750db5e09ae3feb4884c670.zip
vim-patch:8.1.0230: directly checking 'buftype' value
Problem: Directly checking 'buftype' value. Solution: Add the bt_normal() function. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/91335e5a67aaa9937e65f1e779b9f3f10fd33ee4
-rw-r--r--src/nvim/buffer.c7
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/quickfix.c6
4 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index b50c764ac3..e5b80693a4 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -5179,6 +5179,13 @@ bool bt_help(const buf_T *const buf)
return buf != NULL && buf->b_help;
}
+// Return true if "buf" is a normal buffer, 'buftype' is empty.
+bool bt_normal(const buf_T *const buf)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ return buf != NULL && buf->b_p_bt[0] == NUL;
+}
+
// Return true if "buf" is the quickfix buffer.
bool bt_quickfix(const buf_T *const buf)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index a6931f3acd..34b4c10d3e 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -9553,7 +9553,7 @@ put_view(
*/
if ((*flagp & SSOP_FOLDS)
&& wp->w_buffer->b_ffname != NULL
- && (*wp->w_buffer->b_p_bt == NUL || bt_help(wp->w_buffer))
+ && (bt_normal(wp->w_buffer) || bt_help(wp->w_buffer))
) {
if (put_folds(fd, wp) == FAIL)
return FAIL;
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 4cf42b41e9..0394639a16 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -4834,7 +4834,7 @@ buf_check_timestamp(
if (buf->terminal
|| buf->b_ffname == NULL
|| buf->b_ml.ml_mfp == NULL
- || *buf->b_p_bt != NUL
+ || !bt_normal(buf)
|| buf->b_saving
|| busy
)
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 310b074cfb..0897367b2d 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -2140,7 +2140,7 @@ static win_T *qf_find_win_with_normal_buf(void)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
- if (wp->w_buffer->b_p_bt[0] == NUL) {
+ if (bt_normal(wp->w_buffer)) {
return wp;
}
}
@@ -2204,7 +2204,7 @@ static void qf_goto_win_with_ll_file(win_T *use_win, int qf_fnum,
// Find a previous usable window
win = curwin;
do {
- if (win->w_buffer->b_p_bt[0] == NUL) {
+ if (bt_normal(win->w_buffer)) {
break;
}
if (win->w_prev == NULL) {
@@ -2258,7 +2258,7 @@ static void qf_goto_win_with_qfl_file(int qf_fnum)
// Remember a usable window.
if (altwin == NULL
&& !win->w_p_pvw
- && win->w_buffer->b_p_bt[0] == NUL) {
+ && bt_normal(win->w_buffer)) {
altwin = win;
}
}