Mercurial > vim
comparison src/misc1.c @ 2328:15379284e55a vim73
Add the 'L' item to 'cinoptions'. (Manuel Konig)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 17 Jul 2010 17:12:06 +0200 |
parents | 70be008dff4f |
children | f4440cdd59ae |
comparison
equal
deleted
inserted
replaced
2327:02cf6d461e3f | 2328:15379284e55a |
---|---|
6060 * column is imagined to be | 6060 * column is imagined to be |
6061 */ | 6061 */ |
6062 int ind_open_left_imag = 0; | 6062 int ind_open_left_imag = 0; |
6063 | 6063 |
6064 /* | 6064 /* |
6065 * Spaces jump labels should be shifted to the left if N is non-negative, | |
6066 * otherwise the jump label will be put to column 1. | |
6067 */ | |
6068 int ind_jump_label = -1; | |
6069 | |
6070 /* | |
6065 * spaces from the switch() indent a "case xx" label should be located | 6071 * spaces from the switch() indent a "case xx" label should be located |
6066 */ | 6072 */ |
6067 int ind_case = curbuf->b_p_sw; | 6073 int ind_case = curbuf->b_p_sw; |
6068 | 6074 |
6069 /* | 6075 /* |
6230 int divider; | 6236 int divider; |
6231 int n; | 6237 int n; |
6232 int iscase; | 6238 int iscase; |
6233 int lookfor_break; | 6239 int lookfor_break; |
6234 int cont_amount = 0; /* amount for continuation line */ | 6240 int cont_amount = 0; /* amount for continuation line */ |
6241 int original_line_islabel; | |
6235 | 6242 |
6236 for (options = curbuf->b_p_cino; *options; ) | 6243 for (options = curbuf->b_p_cino; *options; ) |
6237 { | 6244 { |
6238 l = options++; | 6245 l = options++; |
6239 if (*options == '-') | 6246 if (*options == '-') |
6275 case 'n': ind_no_brace = n; break; | 6282 case 'n': ind_no_brace = n; break; |
6276 case 'f': ind_first_open = n; break; | 6283 case 'f': ind_first_open = n; break; |
6277 case '{': ind_open_extra = n; break; | 6284 case '{': ind_open_extra = n; break; |
6278 case '}': ind_close_extra = n; break; | 6285 case '}': ind_close_extra = n; break; |
6279 case '^': ind_open_left_imag = n; break; | 6286 case '^': ind_open_left_imag = n; break; |
6287 case 'L': ind_jump_label = n; break; | |
6280 case ':': ind_case = n; break; | 6288 case ':': ind_case = n; break; |
6281 case '=': ind_case_code = n; break; | 6289 case '=': ind_case_code = n; break; |
6282 case 'b': ind_case_break = n; break; | 6290 case 'b': ind_case_break = n; break; |
6283 case 'p': ind_param = n; break; | 6291 case 'p': ind_param = n; break; |
6284 case 't': ind_func_type = n; break; | 6292 case 't': ind_func_type = n; break; |
6337 | 6345 |
6338 /* move the cursor to the start of the line */ | 6346 /* move the cursor to the start of the line */ |
6339 | 6347 |
6340 curwin->w_cursor.col = 0; | 6348 curwin->w_cursor.col = 0; |
6341 | 6349 |
6350 original_line_islabel = cin_islabel(ind_maxcomment); /* XXX */ | |
6351 | |
6342 /* | 6352 /* |
6343 * #defines and so on always go at the left when included in 'cinkeys'. | 6353 * #defines and so on always go at the left when included in 'cinkeys'. |
6344 */ | 6354 */ |
6345 if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', TRUE))) | 6355 if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', TRUE))) |
6346 { | 6356 { |
6347 amount = 0; | 6357 amount = 0; |
6348 } | 6358 } |
6349 | 6359 |
6350 /* | 6360 /* |
6351 * Is it a non-case label? Then that goes at the left margin too unless JS flag is set. | 6361 * Is it a non-case label? Then that goes at the left margin too unless: |
6362 * - JS flag is set. | |
6363 * - 'L' item has a positive value. | |
6352 */ | 6364 */ |
6353 else if (!ind_js && cin_islabel(ind_maxcomment)) /* XXX */ | 6365 else if (original_line_islabel && !ind_js && ind_jump_label < 0) |
6354 { | 6366 { |
6355 amount = 0; | 6367 amount = 0; |
6356 } | 6368 } |
6357 | 6369 |
6358 /* | 6370 /* |
7741 } | 7753 } |
7742 | 7754 |
7743 /* add extra indent for a comment */ | 7755 /* add extra indent for a comment */ |
7744 if (cin_iscomment(theline)) | 7756 if (cin_iscomment(theline)) |
7745 amount += ind_comment; | 7757 amount += ind_comment; |
7758 | |
7759 /* subtract extra left-shift for jump labels */ | |
7760 if (ind_jump_label > 0 && original_line_islabel) | |
7761 amount -= ind_jump_label; | |
7746 } | 7762 } |
7747 | 7763 |
7748 /* | 7764 /* |
7749 * ok -- we're not inside any sort of structure at all! | 7765 * ok -- we're not inside any sort of structure at all! |
7750 * | 7766 * |