[vim/vim] cindent wrongly indents after a brace inside a line comment (PR #19581)

2 views
Skip to first unread message

Christian Brabandt

unread,
Mar 5, 2026, 1:48:34 PM (yesterday) Mar 5
to vim/vim, Subscribed

Problem: With cindent, a closing brace inside a comment (e.g. "// }")
causes wrong indentation of the following line, because
findmatchlimit() does not skip single-line comments when
searching backwards for a matching brace.
Solution: When searching backwards for a matching brace, always check
for single-line comments and skip bracket characters found
inside them. The forward search case is not yet handled.

fixes: #19578

Note: supported by AI claude


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19581

Commit Summary

  • 4e57188 cindent wrongly indents after a brace inside a line comment

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19581@github.com>

Christian Brabandt

unread,
Mar 5, 2026, 3:14:05 PM (yesterday) Mar 5
to vim/vim, Push

@chrisbra pushed 1 commit.

  • 12a27e8 cindent wrongly indents after a brace inside a line comment


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19581/before/4455831202e5347926feca4cf2d5e4d7df07cd64/after/12a27e8732e761801b2a93caa6fccf680c7ac9fe@github.com>

zeertzjq

unread,
Mar 5, 2026, 6:43:54 PM (yesterday) Mar 5
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/testdir/test_cindent.vim:

> @@ -5527,4 +5527,194 @@ def Test_find_brace_backwards()
 enddef
 
 

There are two consecutive blank lines between these two functions.

⬇️ Suggested change
-


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19581/review/3900328545@github.com>

Reply all
Reply to author
Forward
0 new messages