Mercurial > vim
comparison src/screen.c @ 29:ac33b7c03fac v7.0018
updated for version 7.0018
author | vimboss |
---|---|
date | Mon, 11 Oct 2004 10:16:09 +0000 |
parents | 404aac550f35 |
children | f6033dcbaf31 |
comparison
equal
deleted
inserted
replaced
28:726bdc53fa49 | 29:ac33b7c03fac |
---|---|
2018 char_u buf[51]; | 2018 char_u buf[51]; |
2019 pos_T *top, *bot; | 2019 pos_T *top, *bot; |
2020 linenr_T lnume = lnum + fold_count - 1; | 2020 linenr_T lnume = lnum + fold_count - 1; |
2021 int len; | 2021 int len; |
2022 char_u *p; | 2022 char_u *p; |
2023 char_u *text = NULL; | 2023 char_u *text; |
2024 int fdc; | 2024 int fdc; |
2025 int level; | |
2026 int col; | 2025 int col; |
2027 int txtcol; | 2026 int txtcol; |
2028 int off = (int)(current_ScreenLine - ScreenLines); | 2027 int off = (int)(current_ScreenLine - ScreenLines); |
2029 | 2028 |
2030 /* Build the fold line: | 2029 /* Build the fold line: |
2137 } | 2136 } |
2138 | 2137 |
2139 /* | 2138 /* |
2140 * 4. Compose the folded-line string with 'foldtext', if set. | 2139 * 4. Compose the folded-line string with 'foldtext', if set. |
2141 */ | 2140 */ |
2142 #ifdef FEAT_EVAL | 2141 text = get_foldtext(wp, lnum, lnume, foldinfo, buf); |
2143 if (*wp->w_p_fdt != NUL) | |
2144 { | |
2145 char_u dashes[51]; | |
2146 win_T *save_curwin; | |
2147 | |
2148 /* Set "v:foldstart" and "v:foldend". */ | |
2149 set_vim_var_nr(VV_FOLDSTART, lnum); | |
2150 set_vim_var_nr(VV_FOLDEND, lnume); | |
2151 | |
2152 /* Set "v:folddashes" to a string of "level" dashes. */ | |
2153 /* Set "v:foldlevel" to "level". */ | |
2154 level = foldinfo->fi_level; | |
2155 if (level > 50) | |
2156 level = 50; | |
2157 vim_memset(dashes, '-', (size_t)level); | |
2158 dashes[level] = NUL; | |
2159 set_vim_var_string(VV_FOLDDASHES, dashes, -1); | |
2160 set_vim_var_nr(VV_FOLDLEVEL, (long)level); | |
2161 save_curwin = curwin; | |
2162 curwin = wp; | |
2163 curbuf = wp->w_buffer; | |
2164 | |
2165 ++emsg_off; | |
2166 text = eval_to_string_safe(wp->w_p_fdt, NULL); | |
2167 --emsg_off; | |
2168 | |
2169 curwin = save_curwin; | |
2170 curbuf = curwin->w_buffer; | |
2171 set_vim_var_string(VV_FOLDDASHES, NULL, -1); | |
2172 | |
2173 if (text != NULL) | |
2174 { | |
2175 /* Replace unprintable characters, if there are any. But | |
2176 * replace a TAB with a space. */ | |
2177 for (p = text; *p != NUL; ++p) | |
2178 { | |
2179 #ifdef FEAT_MBYTE | |
2180 if (has_mbyte && (len = (*mb_ptr2len_check)(p)) > 1) | |
2181 { | |
2182 if (!vim_isprintc((*mb_ptr2char)(p))) | |
2183 break; | |
2184 p += len - 1; | |
2185 } | |
2186 else | |
2187 #endif | |
2188 if (*p == TAB) | |
2189 *p = ' '; | |
2190 else if (ptr2cells(p) > 1) | |
2191 break; | |
2192 } | |
2193 if (*p != NUL) | |
2194 { | |
2195 p = transstr(text); | |
2196 vim_free(text); | |
2197 text = p; | |
2198 } | |
2199 } | |
2200 } | |
2201 if (text == NULL) | |
2202 #endif | |
2203 { | |
2204 sprintf((char *)buf, _("+--%3ld lines folded "), fold_count); | |
2205 text = buf; | |
2206 } | |
2207 | 2142 |
2208 txtcol = col; /* remember where text starts */ | 2143 txtcol = col; /* remember where text starts */ |
2209 | 2144 |
2210 /* | 2145 /* |
2211 * 5. move the text to current_ScreenLine. Fill up with "fill_fold". | 2146 * 5. move the text to current_ScreenLine. Fill up with "fill_fold". |