0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.0230: directly checking 'buftype' value

Problem:    Directly checking 'buftype' value.
Solution:   Add the bt_normal() function. (Yegappan Lakshmanan)
This commit is contained in:
Bram Moolenaar 2018-08-01 17:53:12 +02:00
parent d2855f5454
commit 91335e5a67
6 changed files with 17 additions and 6 deletions

View File

@ -5626,6 +5626,15 @@ write_viminfo_bufferlist(FILE *fp)
} }
#endif #endif
/*
* Return TRUE if "buf" is a normal buffer, 'buftype' is empty.
*/
int
bt_normal(buf_T *buf)
{
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.
*/ */

View File

@ -11768,7 +11768,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;

View File

@ -6897,7 +6897,7 @@ buf_check_timestamp(
* this buffer. */ * this buffer. */
if (buf->b_ffname == NULL if (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
#ifdef FEAT_NETBEANS_INTG #ifdef FEAT_NETBEANS_INTG

View File

@ -56,6 +56,7 @@ void ex_buffer_all(exarg_T *eap);
void do_modelines(int flags); void do_modelines(int flags);
int read_viminfo_bufferlist(vir_T *virp, int writing); int read_viminfo_bufferlist(vir_T *virp, int writing);
void write_viminfo_bufferlist(FILE *fp); void write_viminfo_bufferlist(FILE *fp);
int bt_normal(buf_T *buf);
int bt_quickfix(buf_T *buf); int bt_quickfix(buf_T *buf);
int bt_terminal(buf_T *buf); int bt_terminal(buf_T *buf);
int bt_help(buf_T *buf); int bt_help(buf_T *buf);

View File

@ -2487,7 +2487,7 @@ qf_find_win_with_normal_buf(void)
win_T *wp; win_T *wp;
FOR_ALL_WINDOWS(wp) FOR_ALL_WINDOWS(wp)
if (wp->w_buffer->b_p_bt[0] == NUL) if (bt_normal(wp->w_buffer))
return wp; return wp;
return NULL; return NULL;
@ -2563,7 +2563,7 @@ qf_goto_win_with_ll_file(win_T *use_win, int qf_fnum, qf_info_T *ll_ref)
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)
win = lastwin; /* wrap around the top */ win = lastwin; /* wrap around the top */
@ -2620,8 +2620,7 @@ qf_goto_win_with_qfl_file(int qf_fnum)
} }
/* Remember a usable window. */ /* Remember a usable window. */
if (altwin == NULL && !win->w_p_pvw if (altwin == NULL && !win->w_p_pvw && bt_normal(win->w_buffer))
&& win->w_buffer->b_p_bt[0] == NUL)
altwin = win; altwin = win;
} }

View File

@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
230,
/**/ /**/
229, 229,
/**/ /**/