Bug 352167 - bad indentation for switch in switch (Tool Align)
Summary: bad indentation for switch in switch (Tool Align)
Status: CONFIRMED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: indentation (other bugs)
Version First Reported In: unspecified
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 505187 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-09-02 15:57 UTC by sifourquier
Modified: 2025-06-04 08:20 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***