Mercurial > vim
diff src/buffer.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 | ce434212d682 |
children | f33b9375ba03 |
line wrap: on
line diff
--- a/src/buffer.c +++ b/src/buffer.c @@ -468,7 +468,6 @@ close_buffer( int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE); int wipe_buf = (action == DOBUF_WIPE); -#ifdef FEAT_QUICKFIX /* * Force unloading or deleting when 'bufhidden' says so. * The caller must take care of NOT deleting/freeing when 'bufhidden' is @@ -487,7 +486,6 @@ close_buffer( } else if (buf->b_p_bh[0] == 'u') /* 'bufhidden' == "unload" */ unload_buf = TRUE; -#endif #ifdef FEAT_AUTOCMD /* Disallow deleting the buffer when it is locked (already being closed or @@ -1982,16 +1980,14 @@ buflist_new( return NULL; # endif #endif -#ifdef FEAT_QUICKFIX -# ifdef FEAT_AUTOCMD +#ifdef FEAT_AUTOCMD if (buf == curbuf) -# endif +#endif { /* Make sure 'bufhidden' and 'buftype' are empty */ clear_string_option(&buf->b_p_bh); clear_string_option(&buf->b_p_bt); } -#endif } if (buf != curbuf || curbuf == NULL) { @@ -2165,10 +2161,8 @@ free_buf_options( clear_string_option(&buf->b_p_fenc); #endif clear_string_option(&buf->b_p_ff); -#ifdef FEAT_QUICKFIX clear_string_option(&buf->b_p_bh); clear_string_option(&buf->b_p_bt); -#endif } #ifdef FEAT_FIND_ID clear_string_option(&buf->b_p_def); @@ -3668,9 +3662,21 @@ maketitle(void) /* remove the file name */ p = gettail_sep(buf + off); if (p == buf + off) - /* must be a help buffer */ - vim_strncpy(buf + off, (char_u *)_("help"), + { + char *txt; + +#ifdef FEAT_TERMINAL + if (curbuf->b_term != NULL) + txt = term_job_running(curbuf) + ? _("running") : _("finished"); + else +#endif + txt = _("help"); + + /* must be a help or terminal buffer */ + vim_strncpy(buf + off, (char_u *)txt, (size_t)(SPACE_FOR_DIR - off - 1)); + } else *p = NUL;