Bug 244547 - Kate improperly indents nested switch statements
Summary: Kate improperly indents nested switch statements
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: indentation (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2010-07-13 23:11 UTC by Mark Rose
Modified: 2018-10-27 04:03 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rose 2010-07-13 23:11:50 UTC
Version:           unspecified (using Devel) 
OS:                Linux

If you nest a switch statement inside another, Kate will improperly indent the first case statement following the nested switch block. It appears Kate is indenting based off the most recent case statement without regards to scope.

Reproducible: Always




This is in Kate 3.4.5 in KDE 4.4.5. The version options in the bug report system don't yet have these listed. It also applies in older versions going back a while.
Comment 1 Milian Wolff 2010-07-14 13:48:35 UTC
please add some test code that exhibits this behavior, instead of describing it by words.

I need:

- start code (e.g. the nested switches, however they look like)
- what keys you press
- what code (including indentation) you expect to get
- what you actually get
Comment 2 Mark Rose 2010-07-15 00:21:11 UTC
Open any file and save it as  something.php. Then type in this simplified test input (\n for enter):

switch (foo)\n{\ncase 1:\nswitch (bar)\n{\ncase 1:\nbreak;\n}\nbreak;\ncase 2:\nbreak;\n}

What I get:

switch (foo)
{
	case 1:
		switch (bar)
		{
			case 1:
				break;
		}
		break;
			case 2:
				break;
}

What I expected:

switch (foo)
{
	case 1:
		switch (bar)
		{
			case 1:
				break;
		}
		break;
	case 2:
		break;
}

Notice the two extra tabulators before the 'case 2:' and the follow 'break;' lines.

I haven't confirmed it in every case, but it seems to be a bug in the 'C Style' indentation generally, not just in PHP.
Comment 3 Christoph Cullmann 2012-10-28 16:20:55 UTC
Hi,

the indenter is a javascript which you can fix and provide a patch.

For docs see http://kate-editor.org/2009/10/29/extending-kate-with-scripts/

We have not the time nor expertise to maintain the indenters on our own. Please help out ;)
Reopen if a patch is around.
Comment 4 Andrew Crouthamel 2018-09-23 02:33:59 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Andrew Crouthamel 2018-10-27 04:03:01 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!