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:
zeertzjq
2026-02-16 07:39:02 +08:00
parent 7d8653575f
commit b59eba3ada
2 changed files with 15 additions and 0 deletions

View File

@@ -370,6 +370,9 @@ static bool cin_islabel(void) // XXX
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
// label.
pos_T cursor_save;