Bug 219234 - [Indentation] - Multiple line if statement indentation incorrect
Summary: [Indentation] - Multiple line if statement indentation incorrect
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Zhongwei Zhao CLA
QA Contact: Sylvia Tancheva CLA
URL:
Whiteboard:
Keywords: bugday
: 250718 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-16 12:43 EST by Joshua Ross CLA
Modified: 2020-05-14 13:18 EDT (History)
8 users (show)

See Also:


Attachments
mylyn/context/zip (4.31 KB, application/octet-stream)
2008-05-31 01:50 EDT, Nick Boldt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Ross CLA 2008-02-16 12:43:38 EST
Build ID: M20071023-1652

Steps To Reproduce:
1. Create an if statement with multiple lines
2. Type the opening curly brace
3. hit enter


More information:
The indentation of the closing curly brace is off by one tab as is the cursor location if the if statement is more than one line.

Example of what happens:

if (empty($something) &&
    empty($something_else)) {
        |<-cursor
    }
Comment 1 Nick Boldt CLA 2008-05-30 11:21:31 EDT
Reproducable with PDT 1.1 N20080529 by typing in this:

1: <?php
2: 
3: if (empty($something)&&
4: 	empty($something_else))
5:
6: ?>

then adding the { at the end of line 4.

However, if I type in this:

1: <?php
2: 
3: if (empty($something)&&
4: empty($something_else))
5:
6: ?>

then adding the { on line 4 adds the closing brace at the margin and the cursor one indent in, as expected. Output is:

if (empty($something) &&
empty($something_else)) {
    |<-cursor
}

Comment 2 Nick Boldt CLA 2008-05-31 01:43:58 EDT
Found another bug. Type or paste in this:

1: <?php
2: if (empty($something) && empty($something_else))	
3: ?>	

then go back to line 2 and at the end of the line hit { and enter.
The cursor indents correctly, but there's no closing brace.

1: <?php
2: if (empty($something) && empty($something_else)){
3:	|<-cursor
4: ?>

However, if there's a full blank line between the if line and the ?>, the closing brace DOES appear.

Comment 3 Nick Boldt CLA 2008-05-31 01:50:18 EDT
Created attachment 103008 [details]
mylyn/context/zip
Comment 4 Nir Cohen CLA 2008-09-04 08:27:56 EDT
(In reply to comment #2)
> Found another bug. Type or paste in this:
> 
> 1: <?php
> 2: if (empty($something) && empty($something_else))	
> 3: ?>	
> 
> then go back to line 2 and at the end of the line hit { and enter.
> The cursor indents correctly, but there's no closing brace.
> 
> 1: <?php
> 2: if (empty($something) && empty($something_else)){
> 3:	|<-cursor
> 4: ?>
> 
> However, if there's a full blank line between the if line and the ?>, the 
closing brace DOES appear.

problem (of comment#2) is solved on PDT 2.0 
NirC
Comment 5 Roy Ganor CLA 2008-10-16 12:24:42 EDT
*** Bug 250718 has been marked as a duplicate of this bug. ***
Comment 6 Gadi Goldbarg CLA 2008-12-03 08:32:26 EST
Still relevant - changing version to 2.0.0
[Sylvia Tancheva]
Comment 7 Vadim Punski CLA 2010-01-04 04:02:18 EST
Reproducible on 2.1-SR1
Moving to 2.2.0
Comment 8 Zhongwei Zhao CLA 2010-07-11 23:28:33 EDT
fixed in head
Comment 9 Gadi Goldbarg CLA 2010-08-20 07:47:11 EDT
[Petyo Tanchev]

Version 2.2.0 from 13 Aug. 2010.
The initial issue is still relevant.
The other issue in Comment 2 is fixed.
Comment 10 Zhongwei Zhao CLA 2010-08-20 09:19:52 EDT
fixed
Comment 11 Gadi Goldbarg CLA 2010-08-30 10:32:22 EDT
[Petyo Tanchev]

Tested on 2.2.1.v20100829
Still got the same result

if (empty($something) &&
    empty($something_else)) {
        |<-cursor
    }
Comment 12 Zhongwei Zhao CLA 2011-09-06 11:57:50 EDT
fixed in head
Comment 13 Sylvia Tancheva CLA 2011-09-07 09:00:59 EDT
Verified. 
Ilina Stefanova