lalitmetkar / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

a bug of c code indent #46

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.input these codes:
    if (!c) {
        // 当字符为 # 时 ...
        if (c=='#') {
            // 当字符为 { 时 ...
        } else if(c=='{') {
            // 当字符为其他
        }
    }
2. "=gg"
3. the result:
    if (!c) {
        // 当字符为 # 时 ...
        if (c=='#') {
            // 当字符为 { 时 ...
        } else if(c=='{') {
            // 当字符为其他
        }
        }

What is the expected output? What do you see instead?
expected:
    if (!c) {
        // 当字符为 # 时 ...
        if (c=='#') {
            // 当字符为 { 时 ...
        } else if(c=='{') {
            // 当字符为其他
        }
    }
instead:
    if (!c) {
        // 当字符为 # 时 ...
        if (c=='#') {
            // 当字符为 { 时 ...
        } else if(c=='{') {
            // 当字符为其他
        }
        }

What version of the product are you using? On what operating system?
Ver: VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 6 2011 10:20:05)
OS : xubuntu 11.10

Please provide any additional information below.
it's a bug of c code indent.

Original issue reported on code.google.com by fy0748 on 4 Jan 2012 at 5:43

GoogleCodeExporter commented 9 years ago
This happens because of the unmatched { in the middle comment.  Remove it or 
add a } in that line.

Ignoring } and { in a comment is in the todo list somewhere.  It won't be fixed 
soon.

Original comment by brammool...@gmail.com on 4 Jan 2012 at 9:59