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