mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 00:08:19 +00:00
vim-patch:8.1.0230: directly checking 'buftype' value
Problem: Directly checking 'buftype' value.
Solution: Add the bt_normal() function. (Yegappan Lakshmanan)
91335e5a67
This commit is contained in:
@@ -5179,6 +5179,13 @@ bool bt_help(const buf_T *const buf)
|
|||||||
return buf != NULL && buf->b_help;
|
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.
|
// Return true if "buf" is the quickfix buffer.
|
||||||
bool bt_quickfix(const buf_T *const buf)
|
bool bt_quickfix(const buf_T *const buf)
|
||||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
|
@@ -9553,7 +9553,7 @@ put_view(
|
|||||||
*/
|
*/
|
||||||
if ((*flagp & SSOP_FOLDS)
|
if ((*flagp & SSOP_FOLDS)
|
||||||
&& wp->w_buffer->b_ffname != NULL
|
&& 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)
|
if (put_folds(fd, wp) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
@@ -4834,7 +4834,7 @@ buf_check_timestamp(
|
|||||||
if (buf->terminal
|
if (buf->terminal
|
||||||
|| buf->b_ffname == NULL
|
|| buf->b_ffname == NULL
|
||||||
|| buf->b_ml.ml_mfp == NULL
|
|| buf->b_ml.ml_mfp == NULL
|
||||||
|| *buf->b_p_bt != NUL
|
|| !bt_normal(buf)
|
||||||
|| buf->b_saving
|
|| buf->b_saving
|
||||||
|| busy
|
|| busy
|
||||||
)
|
)
|
||||||
|
@@ -2140,7 +2140,7 @@ static win_T *qf_find_win_with_normal_buf(void)
|
|||||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
if (wp->w_buffer->b_p_bt[0] == NUL) {
|
if (bt_normal(wp->w_buffer)) {
|
||||||
return wp;
|
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
|
// Find a previous usable window
|
||||||
win = curwin;
|
win = curwin;
|
||||||
do {
|
do {
|
||||||
if (win->w_buffer->b_p_bt[0] == NUL) {
|
if (bt_normal(win->w_buffer)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (win->w_prev == NULL) {
|
if (win->w_prev == NULL) {
|
||||||
@@ -2258,7 +2258,7 @@ static void qf_goto_win_with_qfl_file(int qf_fnum)
|
|||||||
// Remember a usable window.
|
// Remember a usable window.
|
||||||
if (altwin == NULL
|
if (altwin == NULL
|
||||||
&& !win->w_p_pvw
|
&& !win->w_p_pvw
|
||||||
&& win->w_buffer->b_p_bt[0] == NUL) {
|
&& bt_normal(win->w_buffer)) {
|
||||||
altwin = win;
|
altwin = win;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user