changeset 3578:c0c935956ac3 v7.3.549

updated for version 7.3.549 Problem: In 'cinoptions' "0s" is interpreted as one shiftwidth. (David Pineau) Solution: Use the zero as zero. (Lech Lorens)
author Bram Moolenaar <bram@vim.org>
date Wed, 13 Jun 2012 13:40:48 +0200
parents bda6f7203606
children eabf1a91c2e4
files src/misc1.c src/testdir/test3.in src/testdir/test3.ok src/version.c
diffstat 4 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -6635,6 +6635,7 @@ get_c_indent()
     int		whilelevel;
     linenr_T	lnum;
     char_u	*options;
+    char_u	*digits;
     int		fraction = 0;	    /* init for GCC */
     int		divider;
     int		n;
@@ -6650,6 +6651,7 @@ get_c_indent()
 	l = options++;
 	if (*options == '-')
 	    ++options;
+	digits = options;	    /* remember where the digits start */
 	n = getdigits(&options);
 	divider = 0;
 	if (*options == '.')	    /* ".5s" means a fraction */
@@ -6666,7 +6668,7 @@ get_c_indent()
 	}
 	if (*options == 's')	    /* "2s" means two times 'shiftwidth' */
 	{
-	    if (n == 0 && fraction == 0)
+	    if (options == digits)
 		n = curbuf->b_p_sw;	/* just "s" is one 'shiftwidth' */
 	    else
 	    {
--- a/src/testdir/test3.in
+++ b/src/testdir/test3.in
@@ -977,6 +977,24 @@ main ( int first_par, /*
 
 STARTTEST
 :set cin
+:set cino=es,n0s
+/main
+=][
+ENDTEST
+
+main(void)
+{
+	/* Make sure that cino=X0s is not parsed like cino=Xs. */
+	if (cond)
+		foo();
+	else
+	{
+		bar();
+	}
+}
+
+STARTTEST
+:set cin
 :set cino=
 ]]=][
 ENDTEST
--- a/src/testdir/test3.ok
+++ b/src/testdir/test3.ok
@@ -940,6 +940,18 @@ main ( int first_par, /*
 }
 
 
+main(void)
+{
+	/* Make sure that cino=X0s is not parsed like cino=Xs. */
+	if (cond)
+		foo();
+	else
+	{
+		bar();
+	}
+}
+
+
 {
 	do
 	{
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    549,
+/**/
     548,
 /**/
     547,