Skip to content

Commit 91335e5

Browse files
committed
patch 8.1.0230: directly checking 'buftype' value
Problem: Directly checking 'buftype' value. Solution: Add the bt_normal() function. (Yegappan Lakshmanan)
1 parent d2855f5 commit 91335e5

6 files changed

Lines changed: 17 additions & 6 deletions

File tree

src/buffer.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5626,6 +5626,15 @@ write_viminfo_bufferlist(FILE *fp)
56265626
}
56275627
#endif
56285628

5629+
/*
5630+
* Return TRUE if "buf" is a normal buffer, 'buftype' is empty.
5631+
*/
5632+
int
5633+
bt_normal(buf_T *buf)
5634+
{
5635+
return buf != NULL && buf->b_p_bt[0] == NUL;
5636+
}
5637+
56295638
/*
56305639
* Return TRUE if "buf" is the quickfix buffer.
56315640
*/

src/ex_docmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11768,7 +11768,7 @@ put_view(
1176811768
*/
1176911769
if ((*flagp & SSOP_FOLDS)
1177011770
&& wp->w_buffer->b_ffname != NULL
11771-
&& (*wp->w_buffer->b_p_bt == NUL || bt_help(wp->w_buffer)))
11771+
&& (bt_normal(wp->w_buffer) || bt_help(wp->w_buffer)))
1177211772
{
1177311773
if (put_folds(fd, wp) == FAIL)
1177411774
return FAIL;

src/fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6897,7 +6897,7 @@ buf_check_timestamp(
68976897
* this buffer. */
68986898
if (buf->b_ffname == NULL
68996899
|| buf->b_ml.ml_mfp == NULL
6900-
|| *buf->b_p_bt != NUL
6900+
|| !bt_normal(buf)
69016901
|| buf->b_saving
69026902
|| busy
69036903
#ifdef FEAT_NETBEANS_INTG

src/proto/buffer.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void ex_buffer_all(exarg_T *eap);
5656
void do_modelines(int flags);
5757
int read_viminfo_bufferlist(vir_T *virp, int writing);
5858
void write_viminfo_bufferlist(FILE *fp);
59+
int bt_normal(buf_T *buf);
5960
int bt_quickfix(buf_T *buf);
6061
int bt_terminal(buf_T *buf);
6162
int bt_help(buf_T *buf);

src/quickfix.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,7 +2487,7 @@ qf_find_win_with_normal_buf(void)
24872487
win_T *wp;
24882488

24892489
FOR_ALL_WINDOWS(wp)
2490-
if (wp->w_buffer->b_p_bt[0] == NUL)
2490+
if (bt_normal(wp->w_buffer))
24912491
return wp;
24922492

24932493
return NULL;
@@ -2563,7 +2563,7 @@ qf_goto_win_with_ll_file(win_T *use_win, int qf_fnum, qf_info_T *ll_ref)
25632563
win = curwin;
25642564
do
25652565
{
2566-
if (win->w_buffer->b_p_bt[0] == NUL)
2566+
if (bt_normal(win->w_buffer))
25672567
break;
25682568
if (win->w_prev == NULL)
25692569
win = lastwin; /* wrap around the top */
@@ -2620,8 +2620,7 @@ qf_goto_win_with_qfl_file(int qf_fnum)
26202620
}
26212621

26222622
/* Remember a usable window. */
2623-
if (altwin == NULL && !win->w_p_pvw
2624-
&& win->w_buffer->b_p_bt[0] == NUL)
2623+
if (altwin == NULL && !win->w_p_pvw && bt_normal(win->w_buffer))
26252624
altwin = win;
26262625
}
26272626

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,8 @@ static char *(features[]) =
794794

795795
static int included_patches[] =
796796
{ /* Add new patch number below this line */
797+
/**/
798+
230,
797799
/**/
798800
229,
799801
/**/

0 commit comments

Comments
 (0)