Mercurial > vim
diff src/quickfix.c @ 11757:74abb6c84984 v8.0.0761
patch 8.0.0761: options not set properly for a terminal buffer
commit https://github.com/vim/vim/commit/1f2903c43109b16594d141a730659317b15f388d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 23 19:51:01 2017 +0200
patch 8.0.0761: options not set properly for a terminal buffer
Problem: Options of a buffer for a terminal window are not set properly.
Solution: Add "terminal" value for 'buftype'. Make 'buftype' and
'bufhidden' not depend on the quickfix feature.
Also set the buffer name and show "running" or "finished" in the
window title.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 23 Jul 2017 20:00:05 +0200 |
parents | c43118ecb0a3 |
children | 77bf0346687e |
line wrap: on
line diff
--- a/src/quickfix.c +++ b/src/quickfix.c @@ -2169,7 +2169,7 @@ qf_jump( * quickfix window. */ FOR_ALL_WINDOWS(usable_win_ptr) if (usable_win_ptr->w_llist == ll_ref - && usable_win_ptr->w_buffer->b_p_bt[0] != 'q') + && !bt_quickfix(usable_win_ptr->w_buffer)) { usable_win = 1; break; @@ -3450,64 +3450,6 @@ qf_fill_buffer(qf_info_T *qi, buf_T *buf #endif /* FEAT_WINDOWS */ /* - * Return TRUE if "buf" is the quickfix buffer. - */ - int -bt_quickfix(buf_T *buf) -{ - return buf != NULL && buf->b_p_bt[0] == 'q'; -} - -/* - * Return TRUE if "buf" is a "nofile" or "acwrite" buffer. - * This means the buffer name is not a file name. - */ - int -bt_nofile(buf_T *buf) -{ - return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') - || buf->b_p_bt[0] == 'a'); -} - -/* - * Return TRUE if "buf" is a "nowrite" or "nofile" buffer. - */ - int -bt_dontwrite(buf_T *buf) -{ - return buf != NULL && buf->b_p_bt[0] == 'n'; -} - - int -bt_dontwrite_msg(buf_T *buf) -{ - if (bt_dontwrite(buf)) - { - EMSG(_("E382: Cannot write, 'buftype' option is set")); - return TRUE; - } - return FALSE; -} - -/* - * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" - * and 'bufhidden'. - */ - int -buf_hide(buf_T *buf) -{ - /* 'bufhidden' overrules 'hidden' and ":hide", check it first */ - switch (buf->b_p_bh[0]) - { - case 'u': /* "unload" */ - case 'w': /* "wipe" */ - case 'd': return FALSE; /* "delete" */ - case 'h': return TRUE; /* "hide" */ - } - return (p_hid || cmdmod.hide); -} - -/* * Return TRUE when using ":vimgrep" for ":grep". */ int @@ -5584,3 +5526,72 @@ ex_helpgrep(exarg_T *eap) } #endif /* FEAT_QUICKFIX */ + +/* + * Return TRUE if "buf" is the quickfix buffer. + */ + int +bt_quickfix(buf_T *buf) +{ + return buf != NULL && buf->b_p_bt[0] == 'q'; +} + +/* + * Return TRUE if "buf" is a terminal buffer. + */ + int +bt_terminal(buf_T *buf) +{ + return buf != NULL && buf->b_p_bt[0] == 't'; +} + +/* + * Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer. + * This means the buffer name is not a file name. + */ + int +bt_nofile(buf_T *buf) +{ + return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') + || buf->b_p_bt[0] == 'a' + || buf->b_p_bt[0] == 't'); +} + +/* + * Return TRUE if "buf" is a "nowrite", "nofile" or "terminal" buffer. + */ + int +bt_dontwrite(buf_T *buf) +{ + return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->b_p_bt[0] == 't'); +} + + int +bt_dontwrite_msg(buf_T *buf) +{ + if (bt_dontwrite(buf)) + { + EMSG(_("E382: Cannot write, 'buftype' option is set")); + return TRUE; + } + return FALSE; +} + +/* + * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" + * and 'bufhidden'. + */ + int +buf_hide(buf_T *buf) +{ + /* 'bufhidden' overrules 'hidden' and ":hide", check it first */ + switch (buf->b_p_bh[0]) + { + case 'u': /* "unload" */ + case 'w': /* "wipe" */ + case 'd': return FALSE; /* "delete" */ + case 'h': return TRUE; /* "hide" */ + } + return (p_hid || cmdmod.hide); +} +