mirror of
https://github.com/vim/vim.git
synced 2025-11-14 23:04:02 -05:00
patch 9.1.1877: cindent: wrong indentation after an array declaration
Problem: cindent: wrong indentation after an array declaration
Solution: check if the filetype if javascript before matching the syntax
(Anttoni Erkkilä)
cindent matches a javascript syntax for C files causing wrong
indentation in the following case:
```
void foo() {
float a[5],
b;
}
```
closes: #18631
Signed-off-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
c8eeda9b15
commit
61ef8a3db9
@@ -3476,7 +3476,7 @@ get_c_indent(void)
|
|||||||
amount = cur_amount;
|
amount = cur_amount;
|
||||||
|
|
||||||
n = (int)STRLEN(l);
|
n = (int)STRLEN(l);
|
||||||
if (terminated == ',' && (*skipwhite(l) == ']'
|
if (curbuf->b_ind_js && terminated == ',' && (*skipwhite(l) == ']'
|
||||||
|| (n >=2 && l[n - 2] == ']')))
|
|| (n >=2 && l[n - 2] == ']')))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1106,6 +1106,11 @@ def Test_cindent_1()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void foo() {
|
||||||
|
float a[5],
|
||||||
|
b;
|
||||||
|
}
|
||||||
|
|
||||||
/* end of AUTO */
|
/* end of AUTO */
|
||||||
[CODE]
|
[CODE]
|
||||||
|
|
||||||
@@ -2083,6 +2088,11 @@ def Test_cindent_1()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void foo() {
|
||||||
|
float a[5],
|
||||||
|
b;
|
||||||
|
}
|
||||||
|
|
||||||
/* end of AUTO */
|
/* end of AUTO */
|
||||||
|
|
||||||
[CODE]
|
[CODE]
|
||||||
|
|||||||
@@ -729,6 +729,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 */
|
||||||
|
/**/
|
||||||
|
1877,
|
||||||
/**/
|
/**/
|
||||||
1876,
|
1876,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user