diff options
author | Bram Moolenaar <Bram@vim.org> | 2012-08-08 18:01:05 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2012-08-08 18:01:05 +0200 |
commit | 14f247414733b9dafb50e59320f75e8b56ac6ec6 (patch) | |
tree | 3444e7c3c3e666121e317b50e5f7cdd9718dc5f1 /src/misc1.c | |
parent | b02612b6411659b6385aea44fe8abb5a2e16d4d7 (diff) | |
download | vim-git-14f247414733b9dafb50e59320f75e8b56ac6ec6.tar.gz |
updated for version 7.3.629v7.3.629
Problem: There is no way to make 'shiftwidth' follow 'tabstop'.
Solution: When 'shiftwidth' is zero use the value of 'tabstop'. (Christian
Brabandt)
Diffstat (limited to 'src/misc1.c')
-rw-r--r-- | src/misc1.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/misc1.c b/src/misc1.c index 69ede43ff..e11e10e0c 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -1389,9 +1389,11 @@ open_line(dir, flags, second_line_indent) #ifdef FEAT_SMARTINDENT if (did_si) { + int sw = (int)get_sw_value(); + if (p_sr) - newindent -= newindent % (int)curbuf->b_p_sw; - newindent += (int)curbuf->b_p_sw; + newindent -= newindent % sw; + newindent += sw; } #endif /* Copy the indent */ @@ -6461,11 +6463,14 @@ find_last_paren(l, start, end) int get_c_indent() { + int sw = (int)get_sw_value(); + /* * spaces from a block's opening brace the prevailing indent for that * block should be */ - int ind_level = curbuf->b_p_sw; + + int ind_level = sw; /* * spaces from the edge of the line an open brace that's at the end of a @@ -6512,12 +6517,12 @@ get_c_indent() /* * spaces from the switch() indent a "case xx" label should be located */ - int ind_case = curbuf->b_p_sw; + int ind_case = sw; /* * spaces from the "case xx:" code after a switch() should be located */ - int ind_case_code = curbuf->b_p_sw; + int ind_case_code = sw; /* * lineup break at end of case in switch() with case label @@ -6528,45 +6533,45 @@ get_c_indent() * spaces from the class declaration indent a scope declaration label * should be located */ - int ind_scopedecl = curbuf->b_p_sw; + int ind_scopedecl = sw; /* * spaces from the scope declaration label code should be located */ - int ind_scopedecl_code = curbuf->b_p_sw; + int ind_scopedecl_code = sw; /* * amount K&R-style parameters should be indented */ - int ind_param = curbuf->b_p_sw; + int ind_param = sw; /* * amount a function type spec should be indented */ - int ind_func_type = curbuf->b_p_sw; + int ind_func_type = sw; /* * amount a cpp base class declaration or constructor initialization * should be indented */ - int ind_cpp_baseclass = curbuf->b_p_sw; + int ind_cpp_baseclass = sw; /* * additional spaces beyond the prevailing indent a continuation line * should be located */ - int ind_continuation = curbuf->b_p_sw; + int ind_continuation = sw; /* * spaces from the indent of the line with an unclosed parentheses */ - int ind_unclosed = curbuf->b_p_sw * 2; + int ind_unclosed = sw * 2; /* * spaces from the indent of the line with an unclosed parentheses, which * itself is also unclosed */ - int ind_unclosed2 = curbuf->b_p_sw; + int ind_unclosed2 = sw; /* * suppress ignoring spaces from the indent of a line starting with an @@ -6719,12 +6724,12 @@ get_c_indent() if (*options == 's') /* "2s" means two times 'shiftwidth' */ { if (options == digits) - n = curbuf->b_p_sw; /* just "s" is one 'shiftwidth' */ + n = sw; /* just "s" is one 'shiftwidth' */ else { - n *= curbuf->b_p_sw; + n *= sw; if (divider) - n += (curbuf->b_p_sw * fraction + divider / 2) / divider; + n += (sw * fraction + divider / 2) / divider; } ++options; } |