comparison src/option.c @ 5438:878ed73c7070 v7.4.069

updated for version 7.4.069 Problem: Cannot right shift lines starting with #. Solution: Allow the right shift when 'cino' contains #N with N > 0. (Christian Brabandt) Refactor parsing 'cino', store the values in the buffer.
author Bram Moolenaar <bram@vim.org>
date Tue, 05 Nov 2013 07:13:41 +0100
parents 8c6615a30951
children d0595545e98a
comparison
equal deleted inserted replaced
5437:7772f379c73d 5438:878ed73c7070
5370 check_string_option(&buf->b_p_sua); 5370 check_string_option(&buf->b_p_sua);
5371 #endif 5371 #endif
5372 #ifdef FEAT_CINDENT 5372 #ifdef FEAT_CINDENT
5373 check_string_option(&buf->b_p_cink); 5373 check_string_option(&buf->b_p_cink);
5374 check_string_option(&buf->b_p_cino); 5374 check_string_option(&buf->b_p_cino);
5375 parse_cino(buf);
5375 #endif 5376 #endif
5376 #ifdef FEAT_AUTOCMD 5377 #ifdef FEAT_AUTOCMD
5377 check_string_option(&buf->b_p_ft); 5378 check_string_option(&buf->b_p_ft);
5378 #endif 5379 #endif
5379 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) 5380 #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
6988 } 6989 }
6989 } 6990 }
6990 } 6991 }
6991 #endif 6992 #endif
6992 6993
6994 #ifdef FEAT_CINDENT
6995 /* 'cinoptions' */
6996 else if (gvarp == &p_cino)
6997 {
6998 /* TODO: recognize errors */
6999 parse_cino(curbuf);
7000 }
7001 #endif
7002
6993 /* Options that are a list of flags. */ 7003 /* Options that are a list of flags. */
6994 else 7004 else
6995 { 7005 {
6996 p = NULL; 7006 p = NULL;
6997 if (varp == &p_ww) 7007 if (varp == &p_ww)
8336 { 8346 {
8337 errmsg = e_invarg; 8347 errmsg = e_invarg;
8338 curwin->w_p_fdc = 12; 8348 curwin->w_p_fdc = 12;
8339 } 8349 }
8340 } 8350 }
8341 8351 #endif /* FEAT_FOLDING */
8352
8353 #if defined(FEAT_FOLDING) || defined(FEAT_CINDENT)
8342 /* 'shiftwidth' or 'tabstop' */ 8354 /* 'shiftwidth' or 'tabstop' */
8343 else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts) 8355 else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
8344 { 8356 {
8357 # ifdef FEAT_FOLDING
8345 if (foldmethodIsIndent(curwin)) 8358 if (foldmethodIsIndent(curwin))
8346 foldUpdateAll(curwin); 8359 foldUpdateAll(curwin);
8347 } 8360 # endif
8348 #endif /* FEAT_FOLDING */ 8361 # ifdef FEAT_CINDENT
8362 /* When 'shiftwidth' changes, or it's zero and 'tabstop' changes:
8363 * parse 'cinoptions'. */
8364 if (pp == &curbuf->b_p_sw || curbuf->b_p_sw == 0)
8365 parse_cino(curbuf);
8366 # endif
8367 }
8368 #endif
8349 8369
8350 #ifdef FEAT_MBYTE 8370 #ifdef FEAT_MBYTE
8351 /* 'maxcombine' */ 8371 /* 'maxcombine' */
8352 else if (pp == &p_mco) 8372 else if (pp == &p_mco)
8353 { 8373 {
11727 /* 11747 /*
11728 * Return the effective shiftwidth value for current buffer, using the 11748 * Return the effective shiftwidth value for current buffer, using the
11729 * 'tabstop' value when 'shiftwidth' is zero. 11749 * 'tabstop' value when 'shiftwidth' is zero.
11730 */ 11750 */
11731 long 11751 long
11732 get_sw_value() 11752 get_sw_value(buf)
11753 buf_T *buf;
11733 { 11754 {
11734 return curbuf->b_p_sw ? curbuf->b_p_sw : curbuf->b_p_ts; 11755 return buf->b_p_sw ? buf->b_p_sw : buf->b_p_ts;
11735 } 11756 }
11736 11757
11737 /* 11758 /*
11738 * Return the effective softtabstop value for the current buffer, using the 11759 * Return the effective softtabstop value for the current buffer, using the
11739 * 'tabstop' value when 'softtabstop' is negative. 11760 * 'tabstop' value when 'softtabstop' is negative.
11740 */ 11761 */
11741 long 11762 long
11742 get_sts_value() 11763 get_sts_value()
11743 { 11764 {
11744 return curbuf->b_p_sts < 0 ? get_sw_value() : curbuf->b_p_sts; 11765 return curbuf->b_p_sts < 0 ? get_sw_value(curbuf) : curbuf->b_p_sts;
11745 } 11766 }
11746 11767
11747 /* 11768 /*
11748 * Check matchpairs option for "*initc". 11769 * Check matchpairs option for "*initc".
11749 * If there is a match set "*initc" to the matching character and "*findc" to 11770 * If there is a match set "*initc" to the matching character and "*findc" to