0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2012-06-13 13:40:48 +02:00
parent 27ba088549
commit 48d279215f
4 changed files with 35 additions and 1 deletions

View File

@@ -6635,6 +6635,7 @@ get_c_indent()
int whilelevel; int whilelevel;
linenr_T lnum; linenr_T lnum;
char_u *options; char_u *options;
char_u *digits;
int fraction = 0; /* init for GCC */ int fraction = 0; /* init for GCC */
int divider; int divider;
int n; int n;
@@ -6650,6 +6651,7 @@ get_c_indent()
l = options++; l = options++;
if (*options == '-') if (*options == '-')
++options; ++options;
digits = options; /* remember where the digits start */
n = getdigits(&options); n = getdigits(&options);
divider = 0; divider = 0;
if (*options == '.') /* ".5s" means a fraction */ if (*options == '.') /* ".5s" means a fraction */
@@ -6666,7 +6668,7 @@ get_c_indent()
} }
if (*options == 's') /* "2s" means two times 'shiftwidth' */ 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' */ n = curbuf->b_p_sw; /* just "s" is one 'shiftwidth' */
else else
{ {

View File

@@ -975,6 +975,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 STARTTEST
:set cin :set cin
:set cino= :set cino=

View File

@@ -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 do
{ {

View File

@@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
549,
/**/ /**/
548, 548,
/**/ /**/