Mercurial > vim
comparison src/option.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 | 7e8a467acd6e |
children | b82dad3fa176 |
comparison
equal
deleted
inserted
replaced
11756:e3e89d6460d0 | 11757:74abb6c84984 |
---|---|
285 static int p_ai; | 285 static int p_ai; |
286 static int p_bin; | 286 static int p_bin; |
287 #ifdef FEAT_MBYTE | 287 #ifdef FEAT_MBYTE |
288 static int p_bomb; | 288 static int p_bomb; |
289 #endif | 289 #endif |
290 #if defined(FEAT_QUICKFIX) | |
291 static char_u *p_bh; | 290 static char_u *p_bh; |
292 static char_u *p_bt; | 291 static char_u *p_bt; |
293 #endif | |
294 static int p_bl; | 292 static int p_bl; |
295 static int p_ci; | 293 static int p_ci; |
296 #ifdef FEAT_CINDENT | 294 #ifdef FEAT_CINDENT |
297 static int p_cin; | 295 static int p_cin; |
298 static char_u *p_cink; | 296 static char_u *p_cink; |
718 (char_u *)NULL, PV_NONE, | 716 (char_u *)NULL, PV_NONE, |
719 {(char_u *)0L, (char_u *)0L} | 717 {(char_u *)0L, (char_u *)0L} |
720 #endif | 718 #endif |
721 SCRIPTID_INIT}, | 719 SCRIPTID_INIT}, |
722 {"bufhidden", "bh", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, | 720 {"bufhidden", "bh", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, |
723 #if defined(FEAT_QUICKFIX) | |
724 (char_u *)&p_bh, PV_BH, | 721 (char_u *)&p_bh, PV_BH, |
725 {(char_u *)"", (char_u *)0L} | 722 {(char_u *)"", (char_u *)0L} |
726 #else | |
727 (char_u *)NULL, PV_NONE, | |
728 {(char_u *)0L, (char_u *)0L} | |
729 #endif | |
730 SCRIPTID_INIT}, | 723 SCRIPTID_INIT}, |
731 {"buflisted", "bl", P_BOOL|P_VI_DEF|P_NOGLOB, | 724 {"buflisted", "bl", P_BOOL|P_VI_DEF|P_NOGLOB, |
732 (char_u *)&p_bl, PV_BL, | 725 (char_u *)&p_bl, PV_BL, |
733 {(char_u *)1L, (char_u *)0L} | 726 {(char_u *)1L, (char_u *)0L} |
734 SCRIPTID_INIT}, | 727 SCRIPTID_INIT}, |
735 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, | 728 {"buftype", "bt", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB, |
736 #if defined(FEAT_QUICKFIX) | |
737 (char_u *)&p_bt, PV_BT, | 729 (char_u *)&p_bt, PV_BT, |
738 {(char_u *)"", (char_u *)0L} | 730 {(char_u *)"", (char_u *)0L} |
739 #else | |
740 (char_u *)NULL, PV_NONE, | |
741 {(char_u *)0L, (char_u *)0L} | |
742 #endif | |
743 SCRIPTID_INIT}, | 731 SCRIPTID_INIT}, |
744 {"casemap", "cmp", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, | 732 {"casemap", "cmp", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, |
745 #ifdef FEAT_MBYTE | 733 #ifdef FEAT_MBYTE |
746 (char_u *)&p_cmp, PV_NONE, | 734 (char_u *)&p_cmp, PV_NONE, |
747 {(char_u *)"internal,keepascii", (char_u *)0L} | 735 {(char_u *)"internal,keepascii", (char_u *)0L} |
3252 #endif | 3240 #endif |
3253 static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; | 3241 static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; |
3254 #ifdef FEAT_WINDOWS | 3242 #ifdef FEAT_WINDOWS |
3255 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; | 3243 static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; |
3256 #endif | 3244 #endif |
3257 #if defined(FEAT_QUICKFIX) | 3245 #ifdef FEAT_AUTOCMD |
3258 # ifdef FEAT_AUTOCMD | 3246 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", NULL}; |
3259 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "acwrite", NULL}; | 3247 #else |
3260 # else | 3248 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", NULL}; |
3261 static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", NULL}; | 3249 #endif |
3262 # endif | |
3263 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL}; | 3250 static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL}; |
3264 #endif | |
3265 static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; | 3251 static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; |
3266 #ifdef FEAT_FOLDING | 3252 #ifdef FEAT_FOLDING |
3267 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax", | 3253 static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax", |
3268 # ifdef FEAT_DIFF | 3254 # ifdef FEAT_DIFF |
3269 "diff", | 3255 "diff", |
5647 * Check string options in a buffer for NULL value. | 5633 * Check string options in a buffer for NULL value. |
5648 */ | 5634 */ |
5649 void | 5635 void |
5650 check_buf_options(buf_T *buf) | 5636 check_buf_options(buf_T *buf) |
5651 { | 5637 { |
5652 #if defined(FEAT_QUICKFIX) | |
5653 check_string_option(&buf->b_p_bh); | 5638 check_string_option(&buf->b_p_bh); |
5654 check_string_option(&buf->b_p_bt); | 5639 check_string_option(&buf->b_p_bt); |
5655 #endif | |
5656 #ifdef FEAT_MBYTE | 5640 #ifdef FEAT_MBYTE |
5657 check_string_option(&buf->b_p_fenc); | 5641 check_string_option(&buf->b_p_fenc); |
5658 #endif | 5642 #endif |
5659 check_string_option(&buf->b_p_ff); | 5643 check_string_option(&buf->b_p_ff); |
5660 #ifdef FEAT_FIND_ID | 5644 #ifdef FEAT_FIND_ID |
7113 if (spell_check_msm() != OK) | 7097 if (spell_check_msm() != OK) |
7114 errmsg = e_invarg; | 7098 errmsg = e_invarg; |
7115 } | 7099 } |
7116 #endif | 7100 #endif |
7117 | 7101 |
7118 #ifdef FEAT_QUICKFIX | |
7119 /* When 'bufhidden' is set, check for valid value. */ | 7102 /* When 'bufhidden' is set, check for valid value. */ |
7120 else if (gvarp == &p_bh) | 7103 else if (gvarp == &p_bh) |
7121 { | 7104 { |
7122 if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE) != OK) | 7105 if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, FALSE) != OK) |
7123 errmsg = e_invarg; | 7106 errmsg = e_invarg; |
7128 { | 7111 { |
7129 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK) | 7112 if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK) |
7130 errmsg = e_invarg; | 7113 errmsg = e_invarg; |
7131 else | 7114 else |
7132 { | 7115 { |
7133 # ifdef FEAT_WINDOWS | 7116 #ifdef FEAT_WINDOWS |
7134 if (curwin->w_status_height) | 7117 if (curwin->w_status_height) |
7135 { | 7118 { |
7136 curwin->w_redr_status = TRUE; | 7119 curwin->w_redr_status = TRUE; |
7137 redraw_later(VALID); | 7120 redraw_later(VALID); |
7138 } | 7121 } |
7139 # endif | 7122 #endif |
7140 curbuf->b_help = (curbuf->b_p_bt[0] == 'h'); | 7123 curbuf->b_help = (curbuf->b_p_bt[0] == 'h'); |
7141 # ifdef FEAT_TITLE | 7124 #ifdef FEAT_TITLE |
7142 redraw_titles(); | 7125 redraw_titles(); |
7143 # endif | 7126 #endif |
7144 } | 7127 } |
7145 } | 7128 } |
7146 #endif | |
7147 | 7129 |
7148 #ifdef FEAT_STL_OPT | 7130 #ifdef FEAT_STL_OPT |
7149 /* 'statusline' or 'rulerformat' */ | 7131 /* 'statusline' or 'rulerformat' */ |
7150 else if (gvarp == &p_stl || varp == &p_ruf) | 7132 else if (gvarp == &p_stl || varp == &p_ruf) |
7151 { | 7133 { |
10720 case PV_AI: return (char_u *)&(curbuf->b_p_ai); | 10702 case PV_AI: return (char_u *)&(curbuf->b_p_ai); |
10721 case PV_BIN: return (char_u *)&(curbuf->b_p_bin); | 10703 case PV_BIN: return (char_u *)&(curbuf->b_p_bin); |
10722 #ifdef FEAT_MBYTE | 10704 #ifdef FEAT_MBYTE |
10723 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb); | 10705 case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb); |
10724 #endif | 10706 #endif |
10725 #if defined(FEAT_QUICKFIX) | |
10726 case PV_BH: return (char_u *)&(curbuf->b_p_bh); | 10707 case PV_BH: return (char_u *)&(curbuf->b_p_bh); |
10727 case PV_BT: return (char_u *)&(curbuf->b_p_bt); | 10708 case PV_BT: return (char_u *)&(curbuf->b_p_bt); |
10728 #endif | |
10729 case PV_BL: return (char_u *)&(curbuf->b_p_bl); | 10709 case PV_BL: return (char_u *)&(curbuf->b_p_bl); |
10730 case PV_CI: return (char_u *)&(curbuf->b_p_ci); | 10710 case PV_CI: return (char_u *)&(curbuf->b_p_ci); |
10731 #ifdef FEAT_CINDENT | 10711 #ifdef FEAT_CINDENT |
10732 case PV_CIN: return (char_u *)&(curbuf->b_p_cin); | 10712 case PV_CIN: return (char_u *)&(curbuf->b_p_cin); |
10733 case PV_CINK: return (char_u *)&(curbuf->b_p_cink); | 10713 case PV_CINK: return (char_u *)&(curbuf->b_p_cink); |
11117 default: | 11097 default: |
11118 buf->b_p_ff = vim_strsave(p_ff); | 11098 buf->b_p_ff = vim_strsave(p_ff); |
11119 } | 11099 } |
11120 if (buf->b_p_ff != NULL) | 11100 if (buf->b_p_ff != NULL) |
11121 buf->b_start_ffc = *buf->b_p_ff; | 11101 buf->b_start_ffc = *buf->b_p_ff; |
11122 #if defined(FEAT_QUICKFIX) | |
11123 buf->b_p_bh = empty_option; | 11102 buf->b_p_bh = empty_option; |
11124 buf->b_p_bt = empty_option; | 11103 buf->b_p_bt = empty_option; |
11125 #endif | |
11126 } | 11104 } |
11127 else | 11105 else |
11128 free_buf_options(buf, FALSE); | 11106 free_buf_options(buf, FALSE); |
11129 | 11107 |
11130 buf->b_p_ai = p_ai; | 11108 buf->b_p_ai = p_ai; |
11282 { | 11260 { |
11283 buf->b_p_isk = vim_strsave(p_isk); | 11261 buf->b_p_isk = vim_strsave(p_isk); |
11284 did_isk = TRUE; | 11262 did_isk = TRUE; |
11285 buf->b_p_ts = p_ts; | 11263 buf->b_p_ts = p_ts; |
11286 buf->b_help = FALSE; | 11264 buf->b_help = FALSE; |
11287 #ifdef FEAT_QUICKFIX | |
11288 if (buf->b_p_bt[0] == 'h') | 11265 if (buf->b_p_bt[0] == 'h') |
11289 clear_string_option(&buf->b_p_bt); | 11266 clear_string_option(&buf->b_p_bt); |
11290 #endif | |
11291 buf->b_p_ma = p_ma; | 11267 buf->b_p_ma = p_ma; |
11292 } | 11268 } |
11293 } | 11269 } |
11294 | 11270 |
11295 /* | 11271 /* |