To: vim_dev@googlegroups.com Subject: Patch 8.1.0230 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0230 Problem: Directly checking 'buftype' value. Solution: Add the bt_normal() function. (Yegappan Lakshmanan) Files: src/buffer.c, src/ex_docmd.c, src/fileio.c, src/proto/buffer.pro, src/quickfix.c *** ../vim-8.1.0229/src/buffer.c 2018-06-23 19:22:45.598486362 +0200 --- src/buffer.c 2018-08-01 17:39:05.854918677 +0200 *************** *** 5627,5632 **** --- 5627,5641 ---- #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. */ int *** ../vim-8.1.0229/src/ex_docmd.c 2018-07-29 17:35:19.493750319 +0200 --- src/ex_docmd.c 2018-08-01 17:37:07.895552456 +0200 *************** *** 11768,11774 **** */ if ((*flagp & SSOP_FOLDS) && wp->w_buffer->b_ffname != NULL ! && (*wp->w_buffer->b_p_bt == NUL || bt_help(wp->w_buffer))) { if (put_folds(fd, wp) == FAIL) return FAIL; --- 11768,11774 ---- */ if ((*flagp & SSOP_FOLDS) && wp->w_buffer->b_ffname != NULL ! && (bt_normal(wp->w_buffer) || bt_help(wp->w_buffer))) { if (put_folds(fd, wp) == FAIL) return FAIL; *** ../vim-8.1.0229/src/fileio.c 2018-07-07 18:34:08.430551330 +0200 --- src/fileio.c 2018-08-01 17:37:07.899552434 +0200 *************** *** 6897,6903 **** * this buffer. */ if (buf->b_ffname == NULL || buf->b_ml.ml_mfp == NULL ! || *buf->b_p_bt != NUL || buf->b_saving || busy #ifdef FEAT_NETBEANS_INTG --- 6897,6903 ---- * this buffer. */ if (buf->b_ffname == NULL || buf->b_ml.ml_mfp == NULL ! || !bt_normal(buf) || buf->b_saving || busy #ifdef FEAT_NETBEANS_INTG *** ../vim-8.1.0229/src/proto/buffer.pro 2018-06-03 14:42:17.848505102 +0200 --- src/proto/buffer.pro 2018-08-01 17:39:55.638650591 +0200 *************** *** 56,61 **** --- 56,62 ---- void do_modelines(int flags); int read_viminfo_bufferlist(vir_T *virp, int writing); void write_viminfo_bufferlist(FILE *fp); + int bt_normal(buf_T *buf); int bt_quickfix(buf_T *buf); int bt_terminal(buf_T *buf); int bt_help(buf_T *buf); *** ../vim-8.1.0229/src/quickfix.c 2018-07-25 22:36:48.991518559 +0200 --- src/quickfix.c 2018-08-01 17:37:07.899552434 +0200 *************** *** 2487,2493 **** win_T *wp; FOR_ALL_WINDOWS(wp) ! if (wp->w_buffer->b_p_bt[0] == NUL) return wp; return NULL; --- 2487,2493 ---- win_T *wp; FOR_ALL_WINDOWS(wp) ! if (bt_normal(wp->w_buffer)) return wp; return NULL; *************** *** 2563,2569 **** win = curwin; do { ! if (win->w_buffer->b_p_bt[0] == NUL) break; if (win->w_prev == NULL) win = lastwin; /* wrap around the top */ --- 2563,2569 ---- win = curwin; do { ! if (bt_normal(win->w_buffer)) break; if (win->w_prev == NULL) win = lastwin; /* wrap around the top */ *************** *** 2620,2627 **** } /* Remember a usable window. */ ! if (altwin == NULL && !win->w_p_pvw ! && win->w_buffer->b_p_bt[0] == NUL) altwin = win; } --- 2620,2626 ---- } /* Remember a usable window. */ ! if (altwin == NULL && !win->w_p_pvw && bt_normal(win->w_buffer)) altwin = win; } *** ../vim-8.1.0229/src/version.c 2018-07-29 17:40:37.239467625 +0200 --- src/version.c 2018-08-01 17:38:23.335147376 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 230, /**/ -- Individualists unite! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///