aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-02-16 07:39:02 +0800
committerzeertzjq <zeertzjq@outlook.com>2026-02-16 08:23:18 +0800
commitb59eba3ada13ee3ceb0f8decebd261e55b2baa2d (patch)
treea8c6bd36e1ff3eabdc549bd99d2356462a63ad3e /src
parent7d8653575f2a1170f0c7651f271c45a15a185d5e (diff)
downloadrneovim-b59eba3ada13ee3ceb0f8decebd261e55b2baa2d.tar.gz
rneovim-b59eba3ada13ee3ceb0f8decebd261e55b2baa2d.tar.bz2
rneovim-b59eba3ada13ee3ceb0f8decebd261e55b2baa2d.zip
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 https://github.com/vim/vim/commit/9af18686c7842c8002268d861e37f6ad46a9b641 Co-authored-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/indent_c.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 2a30573a0b..40e22f8c9a 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -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;