comparison src/buffer.c @ 675:51794dc170f7

updated for version 7.0202
author vimboss
date Mon, 20 Feb 2006 21:27:21 +0000
parents db58b9066b21
children 93a1bf1cb633
comparison
equal deleted inserted replaced
674:4b8583e82cb8 675:51794dc170f7
3016 3016
3017 t_str = buf; 3017 t_str = buf;
3018 if (*p_titlestring != NUL) 3018 if (*p_titlestring != NUL)
3019 { 3019 {
3020 #ifdef FEAT_STL_OPT 3020 #ifdef FEAT_STL_OPT
3021 int use_sandbox = FALSE;
3022
3023 # ifdef FEAT_EVAL
3024 use_sandbox = was_set_insecurely((char_u *)"titlestring");
3025 # endif
3021 if (stl_syntax & STL_IN_TITLE) 3026 if (stl_syntax & STL_IN_TITLE)
3022 build_stl_str_hl(curwin, t_str, sizeof(buf), 3027 build_stl_str_hl(curwin, t_str, sizeof(buf),
3023 p_titlestring, 0, maxlen, NULL); 3028 p_titlestring, use_sandbox,
3029 0, maxlen, NULL);
3024 else 3030 else
3025 #endif 3031 #endif
3026 t_str = p_titlestring; 3032 t_str = p_titlestring;
3027 } 3033 }
3028 else 3034 else
3107 { 3113 {
3108 i_str = buf; 3114 i_str = buf;
3109 if (*p_iconstring != NUL) 3115 if (*p_iconstring != NUL)
3110 { 3116 {
3111 #ifdef FEAT_STL_OPT 3117 #ifdef FEAT_STL_OPT
3118 int use_sandbox = FALSE;
3119
3120 # ifdef FEAT_EVAL
3121 use_sandbox = was_set_insecurely((char_u *)"iconstring");
3122 # endif
3112 if (stl_syntax & STL_IN_ICON) 3123 if (stl_syntax & STL_IN_ICON)
3113 build_stl_str_hl(curwin, i_str, sizeof(buf), 3124 build_stl_str_hl(curwin, i_str, sizeof(buf),
3114 p_iconstring, 0, 0, NULL); 3125 p_iconstring, use_sandbox,
3126 0, 0, NULL);
3115 else 3127 else
3116 #endif 3128 #endif
3117 i_str = p_iconstring; 3129 i_str = p_iconstring;
3118 } 3130 }
3119 else 3131 else
3188 3200
3189 #endif /* FEAT_TITLE */ 3201 #endif /* FEAT_TITLE */
3190 3202
3191 #if defined(FEAT_STL_OPT) || defined(PROTO) 3203 #if defined(FEAT_STL_OPT) || defined(PROTO)
3192 /* 3204 /*
3193 * Build a string from the status line items in fmt. 3205 * Build a string from the status line items in "fmt".
3194 * Return length of string in screen cells. 3206 * Return length of string in screen cells.
3207 *
3208 * Normally works for window "wp", except when working for 'tabline' then it
3209 * is "curwin".
3195 * 3210 *
3196 * Items are drawn interspersed with the text that surrounds it 3211 * Items are drawn interspersed with the text that surrounds it
3197 * Specials: %-<wid>(xxx%) => group, %= => middle marker, %< => truncation 3212 * Specials: %-<wid>(xxx%) => group, %= => middle marker, %< => truncation
3198 * Item: %-<minwid>.<maxwid><itemch> All but <itemch> are optional 3213 * Item: %-<minwid>.<maxwid><itemch> All but <itemch> are optional
3199 * 3214 *
3200 * If maxwidth is not zero, the string will be filled at any middle marker 3215 * If maxwidth is not zero, the string will be filled at any middle marker
3201 * or truncated if too long, fillchar is used for all whitespace. 3216 * or truncated if too long, fillchar is used for all whitespace.
3202 */ 3217 */
3203 int 3218 int
3204 build_stl_str_hl(wp, out, outlen, fmt, fillchar, maxwidth, hl) 3219 build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hl)
3205 win_T *wp; 3220 win_T *wp;
3206 char_u *out; /* buffer to write into */ 3221 char_u *out; /* buffer to write into */
3207 size_t outlen; /* length of out[] */ 3222 size_t outlen; /* length of out[] */
3208 char_u *fmt; 3223 char_u *fmt;
3224 int use_sandbox; /* "fmt" was set insecurely, use sandbox */
3209 int fillchar; 3225 int fillchar;
3210 int maxwidth; 3226 int maxwidth;
3211 struct stl_hlrec *hl; 3227 struct stl_hlrec *hl;
3212 { 3228 {
3213 char_u *p; 3229 char_u *p;
3499 o_curbuf = curbuf; 3515 o_curbuf = curbuf;
3500 o_curwin = curwin; 3516 o_curwin = curwin;
3501 curwin = wp; 3517 curwin = wp;
3502 curbuf = wp->w_buffer; 3518 curbuf = wp->w_buffer;
3503 3519
3504 str = eval_to_string_safe(p, &t, 3520 str = eval_to_string_safe(p, &t, use_sandbox);
3505 was_set_insecurely((char_u *)"statusline"));
3506 3521
3507 curwin = o_curwin; 3522 curwin = o_curwin;
3508 curbuf = o_curbuf; 3523 curbuf = o_curbuf;
3509 do_unlet((char_u *)"g:actual_curbuf", TRUE); 3524 do_unlet((char_u *)"g:actual_curbuf", TRUE);
3510 3525