summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-11-05 07:13:41 +0100
committerBram Moolenaar <Bram@vim.org>2013-11-05 07:13:41 +0100
commit6bcbcc59be58d0c3b3cd53ac105c6eb7d0b87f06 (patch)
tree3027528e1aeb2edb9e7efe94f67e1cb1821d185f /src/option.c
parent0958e0fbe7307f0b46b8f692cbd097fbf93c90f6 (diff)
downloadvim-git-6bcbcc59be58d0c3b3cd53ac105c6eb7d0b87f06.tar.gz
updated for version 7.4.069v7.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.
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/option.c b/src/option.c
index bf655560a..a02d5c491 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5372,6 +5372,7 @@ check_buf_options(buf)
#ifdef FEAT_CINDENT
check_string_option(&buf->b_p_cink);
check_string_option(&buf->b_p_cino);
+ parse_cino(buf);
#endif
#ifdef FEAT_AUTOCMD
check_string_option(&buf->b_p_ft);
@@ -6990,6 +6991,15 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
}
#endif
+#ifdef FEAT_CINDENT
+ /* 'cinoptions' */
+ else if (gvarp == &p_cino)
+ {
+ /* TODO: recognize errors */
+ parse_cino(curbuf);
+ }
+#endif
+
/* Options that are a list of flags. */
else
{
@@ -8338,14 +8348,24 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
curwin->w_p_fdc = 12;
}
}
+#endif /* FEAT_FOLDING */
+#if defined(FEAT_FOLDING) || defined(FEAT_CINDENT)
/* 'shiftwidth' or 'tabstop' */
else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts)
{
+# ifdef FEAT_FOLDING
if (foldmethodIsIndent(curwin))
foldUpdateAll(curwin);
+# endif
+# ifdef FEAT_CINDENT
+ /* When 'shiftwidth' changes, or it's zero and 'tabstop' changes:
+ * parse 'cinoptions'. */
+ if (pp == &curbuf->b_p_sw || curbuf->b_p_sw == 0)
+ parse_cino(curbuf);
+# endif
}
-#endif /* FEAT_FOLDING */
+#endif
#ifdef FEAT_MBYTE
/* 'maxcombine' */
@@ -11729,9 +11749,10 @@ check_ff_value(p)
* 'tabstop' value when 'shiftwidth' is zero.
*/
long
-get_sw_value()
+get_sw_value(buf)
+ buf_T *buf;
{
- return curbuf->b_p_sw ? curbuf->b_p_sw : curbuf->b_p_ts;
+ return buf->b_p_sw ? buf->b_p_sw : buf->b_p_ts;
}
/*
@@ -11741,7 +11762,7 @@ get_sw_value()
long
get_sts_value()
{
- return curbuf->b_p_sts < 0 ? get_sw_value() : curbuf->b_p_sts;
+ return curbuf->b_p_sts < 0 ? get_sw_value(curbuf) : curbuf->b_p_sts;
}
/*