Bug 437016 - [formatter] there is no wrap settings for for statement.
Summary: [formatter] there is no wrap settings for for statement.
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.3.0   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-10 02:36 EDT by shawn peng CLA
Modified: 2020-09-04 15:26 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shawn peng CLA 2014-06-10 02:36:27 EDT
This is an extreme condition, but the condition will be similar in very long statements.
// line width = 20 characters
for ( int i =
		0;
		i
				< 10;
		i++ )
{
}

// I want to make it seems like this:
for ( int i =
			0;
	i
			< 10;
	i++ )
{
}

That is to adjust the indentation for the wrapped statements. (Actually the default behavior, indent 2, is what I want.) And another problem is to sum both for wrap indent and assignment wrap indent together to indent the "0;" at the second line. This is actually what is needed.
Comment 1 shawn peng CLA 2014-06-10 02:43:03 EDT
I also found another problem if you add a new line before "int i ="
// After formatted
// line width = 20 characters
for (
int i =
		0;
		i
				< 10;
		i++ )
{
}
// what would be wise
for (
		int i =
				0;
		i
				< 10;
		i++ )
{
}

The first line isn't indented. Maybe this why the "0;" isn't indented to wise position.