patch 9.2.0007: cindent: recognizing labels within commented lines

Commit: 
https://github.com/vim/vim/commit/9af18686c7842c8002268d861e37f6ad46a9b641
Author: Anttoni Erkkilä <[email protected]>
Date:   Sun Feb 15 16:21:15 2026 +0000

    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: #19397
    
    Signed-off-by: Anttoni Erkkilä <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/cindent.c b/src/cindent.c
index 12d7e694d..1e24975b9 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -652,6 +652,9 @@ cin_islabel(void)           // XXX
     if (!cin_islabel_skip(&s))
        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;
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index 4b6fcb870..bc973415b 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -1132,6 +1132,12 @@ def Test_cindent_1()
   a();
   }
 
+  void func() {
+  /* aaaaaa
+  bbbbb:
+  ccccccc */
+  }
+
   /* end of AUTO */
   [CODE]
 
@@ -2135,6 +2141,12 @@ def Test_cindent_1()
                a();
   }
 
+  void func() {
+       /* aaaaaa
+          bbbbb:
+          ccccccc */
+  }
+
   /* end of AUTO */
 
   [CODE]
diff --git a/src/version.c b/src/version.c
index 8c18d1c3e..0b693e562 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    7,
 /**/
     6,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vrf0X-00Di41-ID%40256bit.org.

Raspunde prin e-mail lui