Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320929

Summary: [Indentation] broken formatting and unnecessary trailing spaces/tabs during editing
Product: z_Archived Reporter: Mark Kirchner <eclipse-bugs>
Component: PDTAssignee: PHP Core <php.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: gadi
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Example PHP-file none

Description Mark Kirchner CLA 2010-07-26 12:38:41 EDT
Build Identifier: I20100608-0911

Using the latest PDT-build from hudson (#368, N201007260312), the PHP-editor automatically inserts trailing spaces (or tabs, depending on the chosen indentation-policy) after pressing the Enter-key (== at the end of the line).

Additionally, there are some other strange and hard-to-describe effects which result in quite broken formatting, see examples below.

Not sure, but the problems might have been introduced in build #367 which contains changes for bug 245815 and bug 201979 (which both deal with indentation).

Reproducible: Always

Steps to Reproduce:
1. Settings:
"PHP" -> "Code Style" -> "Formatter": policy "Spaces", size "4".
"General" -> "Editors" -> "Text Editors": Make sure "Insert spaces for tabs" and "Show whitespace characters" are checked.

2. Open the PHP-file I'll attach to this bug, which has the following content:
<?php
class Foo{
    public function bar()
    {
        $baz = array(
            'somekey'       => 'somevalue',
            'anotherkey'    => 'anothervalue',
        );
    }
}

3.1. Adding more code to the method: Place the cursor (for example) on line 8 after the semicolon and press Enter. Observe the (unwanted) spaces after the semicolon.

3.2. Changing indentation: Place the cursor infront of one of the "=>"-operators and press Tab. Expected result: 4 additional spaces. Actual result: 8 additional spaces.

3.3. Adding another method: Place the cursor after the closing brace of foo() and press enter (observe the unnecessary spaces here as well). Type "public function someFunc()" followed by "Enter"; result looks ok (apart from the spaces). Now type the opening brace of the method. Observe how the "{"-char jumps up one line.
Comment 1 Mark Kirchner CLA 2010-07-26 12:40:23 EDT
Created attachment 175240 [details]
Example PHP-file
Comment 2 Mark Kirchner CLA 2010-07-26 12:42:33 EDT
(In reply to comment #0)
> 3.3. Adding another method: Place the cursor after the closing brace of foo()

That should read "after the closing brace of bar()" of course.
Comment 3 Zhongwei Zhao CLA 2010-08-02 03:48:53 EDT
fixed in head,thanks for your reporting!
Comment 4 Gadi Goldbarg CLA 2010-08-23 10:12:39 EDT
Verified fixed.
Kalin Yanev
kalin.a@zend.com