mirror of
https://github.com/neovim/neovim.git
synced 2026-04-01 05:12:02 +00:00
vim-patch:9.2.0007: cindent: recognizing labels within commented lines
Problem: Comment lines which start like a label are recognized as a
label and indented based on that.
Solution: Check if the position is in a comment after recognizing a label
in cin_islabel (Anttoni Erkkilä)
closes: vim/vim#19397
9af18686c7
Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
This commit is contained in:
@@ -370,6 +370,9 @@ static bool cin_islabel(void) // XXX
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ind_find_start_CORS(NULL)) {
|
||||||
|
return false; // Don't accept a label in a comment or a raw string.
|
||||||
|
}
|
||||||
// Only accept a label if the previous line is terminated or is a case
|
// Only accept a label if the previous line is terminated or is a case
|
||||||
// label.
|
// label.
|
||||||
pos_T cursor_save;
|
pos_T cursor_save;
|
||||||
|
|||||||
@@ -1127,6 +1127,12 @@ func Test_cindent_1()
|
|||||||
a();
|
a();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void func() {
|
||||||
|
/* aaaaaa
|
||||||
|
bbbbb:
|
||||||
|
ccccccc */
|
||||||
|
}
|
||||||
|
|
||||||
/* end of AUTO */
|
/* end of AUTO */
|
||||||
[CODE]
|
[CODE]
|
||||||
|
|
||||||
@@ -2130,6 +2136,12 @@ func Test_cindent_1()
|
|||||||
a();
|
a();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void func() {
|
||||||
|
/* aaaaaa
|
||||||
|
bbbbb:
|
||||||
|
ccccccc */
|
||||||
|
}
|
||||||
|
|
||||||
/* end of AUTO */
|
/* end of AUTO */
|
||||||
|
|
||||||
[CODE]
|
[CODE]
|
||||||
|
|||||||
Reference in New Issue
Block a user