Bug 352167

Summary: bad indentation for switch in switch (Tool Align)
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: sifourquier
Component: indentationAssignee: KWrite Developers <kwrite-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: bufalo1973, christoph
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description sifourquier 2015-09-02 15:57:19 UTC
Hi
Me kate version are 4.14.2
When i use a switch inside a other switch the tool/Align make a bad indentation

exemple

switch(a)
{
	case 'A':
		switch(b)
		{
			case 'A':
				
				break;
		}
		break;
			case 'B':
				switch(b)
				{
					case 'A':
						
						break;
				}
				break;
}

thanks you for your work

Reproducible: Always

Steps to Reproduce:
1. write
switch(a)
{
case 'A':
switch(b)
{
case 'A':

break;
}
break;
case 'B':
switch(b)
{
case 'A':

break;
}
break;
}

2.presse on Tool/Align


Actual Results:  
switch(a)
{
	case 'A':
		switch(b)
		{
			case 'A':
				
				break;
		}
		break;
			case 'B':
				switch(b)
				{
					case 'A':
						
						break;
				}
				break;
}

Expected Results:  
switch(a)
{
	case 'A':
		switch(b)
		{
			case 'A':
				
				break;
		}
		break;
	case 'B':
		switch(b)
		{
			case 'A':
				
				break;
		}
		break;
}
Comment 1 Dominik Haumann 2015-10-09 11:54:16 UTC
Known issue, unfortunately not easy to fix, since finding the proper context in the cstyle indenter should be fast, and this would take quite some extra work. If you find a patch for cstyle.js, we'd happily accept it, though.
Comment 2 Christoph Cullmann 2022-10-31 18:52:38 UTC
Still happens, but nothing will change if nobody provides at patch.

See on https://kate-editor.org/join-us/ how to contribute.
Comment 3 Igor Kushnir 2025-06-04 08:20:11 UTC
*** Bug 505187 has been marked as a duplicate of this bug. ***