@@ -1389,9 +1389,11 @@ open_line(dir, flags, second_line_indent)
13891389#ifdef FEAT_SMARTINDENT
13901390 if (did_si )
13911391 {
1392+ int sw = (int )get_sw_value ();
1393+
13921394 if (p_sr )
1393- newindent -= newindent % ( int ) curbuf -> b_p_sw ;
1394- newindent += ( int ) curbuf -> b_p_sw ;
1395+ newindent -= newindent % sw ;
1396+ newindent += sw ;
13951397 }
13961398#endif
13971399 /* Copy the indent */
@@ -6461,11 +6463,14 @@ find_last_paren(l, start, end)
64616463 int
64626464get_c_indent ()
64636465{
6466+ int sw = (int )get_sw_value ();
6467+
64646468 /*
64656469 * spaces from a block's opening brace the prevailing indent for that
64666470 * block should be
64676471 */
6468- int ind_level = curbuf -> b_p_sw ;
6472+
6473+ int ind_level = sw ;
64696474
64706475 /*
64716476 * spaces from the edge of the line an open brace that's at the end of a
@@ -6512,12 +6517,12 @@ get_c_indent()
65126517 /*
65136518 * spaces from the switch() indent a "case xx" label should be located
65146519 */
6515- int ind_case = curbuf -> b_p_sw ;
6520+ int ind_case = sw ;
65166521
65176522 /*
65186523 * spaces from the "case xx:" code after a switch() should be located
65196524 */
6520- int ind_case_code = curbuf -> b_p_sw ;
6525+ int ind_case_code = sw ;
65216526
65226527 /*
65236528 * lineup break at end of case in switch() with case label
@@ -6528,45 +6533,45 @@ get_c_indent()
65286533 * spaces from the class declaration indent a scope declaration label
65296534 * should be located
65306535 */
6531- int ind_scopedecl = curbuf -> b_p_sw ;
6536+ int ind_scopedecl = sw ;
65326537
65336538 /*
65346539 * spaces from the scope declaration label code should be located
65356540 */
6536- int ind_scopedecl_code = curbuf -> b_p_sw ;
6541+ int ind_scopedecl_code = sw ;
65376542
65386543 /*
65396544 * amount K&R-style parameters should be indented
65406545 */
6541- int ind_param = curbuf -> b_p_sw ;
6546+ int ind_param = sw ;
65426547
65436548 /*
65446549 * amount a function type spec should be indented
65456550 */
6546- int ind_func_type = curbuf -> b_p_sw ;
6551+ int ind_func_type = sw ;
65476552
65486553 /*
65496554 * amount a cpp base class declaration or constructor initialization
65506555 * should be indented
65516556 */
6552- int ind_cpp_baseclass = curbuf -> b_p_sw ;
6557+ int ind_cpp_baseclass = sw ;
65536558
65546559 /*
65556560 * additional spaces beyond the prevailing indent a continuation line
65566561 * should be located
65576562 */
6558- int ind_continuation = curbuf -> b_p_sw ;
6563+ int ind_continuation = sw ;
65596564
65606565 /*
65616566 * spaces from the indent of the line with an unclosed parentheses
65626567 */
6563- int ind_unclosed = curbuf -> b_p_sw * 2 ;
6568+ int ind_unclosed = sw * 2 ;
65646569
65656570 /*
65666571 * spaces from the indent of the line with an unclosed parentheses, which
65676572 * itself is also unclosed
65686573 */
6569- int ind_unclosed2 = curbuf -> b_p_sw ;
6574+ int ind_unclosed2 = sw ;
65706575
65716576 /*
65726577 * suppress ignoring spaces from the indent of a line starting with an
@@ -6719,12 +6724,12 @@ get_c_indent()
67196724 if (* options == 's' ) /* "2s" means two times 'shiftwidth' */
67206725 {
67216726 if (options == digits )
6722- n = curbuf -> b_p_sw ; /* just "s" is one 'shiftwidth' */
6727+ n = sw ; /* just "s" is one 'shiftwidth' */
67236728 else
67246729 {
6725- n *= curbuf -> b_p_sw ;
6730+ n *= sw ;
67266731 if (divider )
6727- n += (curbuf -> b_p_sw * fraction + divider / 2 ) / divider ;
6732+ n += (sw * fraction + divider / 2 ) / divider ;
67286733 }
67296734 ++ options ;
67306735 }
0 commit comments