| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.893 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.893 |
| Problem: C indenting is wrong below a "case (foo):" because it is |
| recognized as a C++ base class construct. Issue #38. |
| Solution: Check for the case keyword. |
| Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok |
| |
| |
| |
| |
| |
| *** 6555,6561 **** |
| |
| pos->lnum = lnum; |
| line = ml_get(lnum); |
| ! s = cin_skipcomment(line); |
| for (;;) |
| { |
| if (*s == NUL) |
| --- 6555,6561 ---- |
| |
| pos->lnum = lnum; |
| line = ml_get(lnum); |
| ! s = line; |
| for (;;) |
| { |
| if (*s == NUL) |
| |
| *** 6564,6569 **** |
| --- 6564,6576 ---- |
| break; |
| /* Continue in the cursor line. */ |
| line = ml_get(++lnum); |
| + s = line; |
| + } |
| + if (s == line) |
| + { |
| + /* don't recognize "case (foo):" as a baseclass */ |
| + if (cin_iscase(s, FALSE)) |
| + break; |
| s = cin_skipcomment(line); |
| if (*s == NUL) |
| continue; |
| |
| |
| |
| *** 932,937 **** |
| --- 932,964 ---- |
| a = 1; |
| } |
| |
| + void func() |
| + { |
| + switch (foo) |
| + { |
| + case (bar): |
| + if (baz()) |
| + quux(); |
| + break; |
| + case (shmoo): |
| + if (!bar) |
| + { |
| + } |
| + case (foo1): |
| + switch (bar) |
| + { |
| + case baz: |
| + baz_f(); |
| + break; |
| + } |
| + break; |
| + default: |
| + baz(); |
| + baz(); |
| + break; |
| + } |
| + } |
| + |
| /* end of AUTO */ |
| |
| STARTTEST |
| |
| |
| |
| *** 920,925 **** |
| --- 920,952 ---- |
| a = 1; |
| } |
| |
| + void func() |
| + { |
| + switch (foo) |
| + { |
| + case (bar): |
| + if (baz()) |
| + quux(); |
| + break; |
| + case (shmoo): |
| + if (!bar) |
| + { |
| + } |
| + case (foo1): |
| + switch (bar) |
| + { |
| + case baz: |
| + baz_f(); |
| + break; |
| + } |
| + break; |
| + default: |
| + baz(); |
| + baz(); |
| + break; |
| + } |
| + } |
| + |
| /* end of AUTO */ |
| |
| |
| |
| |
| |
| *** 743,744 **** |
| --- 743,746 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 893, |
| /**/ |
| |
| -- |
| My sister Cecilia opened a computer store in Hawaii. |
| She sells C shells by the seashore. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |