diff options
author | Bram Moolenaar <bram@vim.org> | 2012-06-13 13:40:48 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2012-06-13 13:40:48 +0200 |
commit | 73d6a1616ef0ca7ba65685594c4236b438bf5146 (patch) | |
tree | b7aee1bdb85deae95952fcd24305fab9fd7d1f3d | |
parent | d23a6110b311d64a0b4923a6e9e6b7f3704546f4 (diff) | |
download | vim-73d6a1616ef0ca7ba65685594c4236b438bf5146.tar.gz |
Problem: In 'cinoptions' "0s" is interpreted as one shiftwidth. (David
Pineau)
Solution: Use the zero as zero. (Lech Lorens)
-rw-r--r-- | src/misc1.c | 4 | ||||
-rw-r--r-- | src/testdir/test3.in | 18 | ||||
-rw-r--r-- | src/testdir/test3.ok | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 35 insertions, 1 deletions
diff --git a/src/misc1.c b/src/misc1.c index 7ba39727..988e368d 100644 --- 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 { diff --git a/src/testdir/test3.in b/src/testdir/test3.in index 67fc131d..abb7750f 100644 --- 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 diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index 72cb75f1..011751be 100644 --- 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 { diff --git a/src/version.c b/src/version.c index e9f16079..1e5d5cdb 100644 --- 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, |