Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336647 - Insert Spaces for Tabs / Tab Policy constantly inserts the configured number of spaces
Summary: Insert Spaces for Tabs / Tab Policy constantly inserts the configured number ...
Status: REOPENED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact: Ilina Stefanova CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-08 14:59 EST by Jens G CLA
Modified: 2020-05-14 10:16 EDT (History)
5 users (show)

See Also:


Attachments
Adds logic for calculating the indent size, for spaces, so that the "tab" visually lines up with the literal tab character. (1.28 KB, patch)
2012-04-06 18:33 EDT, Ken Stanley CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jens G CLA 2011-02-08 14:59:00 EST
Build Identifier: 20100917-0705 (PDT 2.2.1.v20101001-2300-53184QAN4JBQgLYPWMLcXn6Na9Od)

Insert Spaces for Tabs should calculate the number of spaces to the next tab column and only insert that amount. But the PHP Editor doesn't wants to and is always inserting, as in my case, 4 spaces.

Reproducible: Always

Steps to Reproduce:
1. Configure PHP Code Style Formatter to Tab Policy = Spaces
2. Try to e.g. align some assignments, using tab key
Comment 1 Vlad Mu CLA 2011-02-26 07:02:32 EST
Voted for this bug. It seems that PDT formatter calculates the number of spaces to the next tab only for intendation (from begining of line), but not inside the line (e.g. in array('a'=>[TAB]'b') the [TAB] will always constantly). It would be more useful to calculate the number of spaces to the next tab always in any place of line.
Comment 2 Vlad Mu CLA 2011-02-26 07:12:08 EST
It seems the plugin from https://bugs.eclipse.org/bugs/show_bug.cgi?id=326250#c9 fixes this problem completely, it would by nice to embed that plugin as oficial fix to the next PDT update. Thanks
Comment 3 Zhongwei Zhao CLA 2011-06-29 03:56:49 EDT
duplicate of 326250

*** This bug has been marked as a duplicate of bug 326250 ***
Comment 4 Ilina Stefanova CLA 2011-07-26 04:32:03 EDT
Verified.
Comment 5 Jens G CLA 2011-11-29 05:07:05 EST
I don't see how this may be a duplicate of #326250, but maybe an internal technical relationship.

Nevertheless, THIS bug still occurs in the current (I guess it's a release) version (3.0.2.v2011102768).

Perhaps this was misconception. I meant the number of spaces, that is inserted when pressing the tab key, is constant. There is no tab character inserted, as described in the other bug.
Comment 6 Zhongwei Zhao CLA 2011-11-29 16:14:22 EST
Hi Jens,

I do not understand you,can you show some examples?
Comment 7 Jens G CLA 2011-11-30 03:31:35 EST
With pleasure :)

Code before trying to align with tab key:

<?php
class NewTestClass
{
    public function __construct()
    {
        // real tab position before //
        $letsSee = 'some string';
        $dfgd = 'another string';
    }
}
?>

Code after:

<?php
class NewTestClass
{
    public function __construct()
    {
                    // real tab position before //
        $letsSee     = 'some string';
        $dfgd     = 'another string';
    }
}
?>

You see, the tab position is completely ignored, the editor just inserts 4 spaces.
Comment 8 Vlad Mu CLA 2011-11-30 04:28:36 EST
I have used last PDT 3.0.2 and can confirm that this problem still exists and I continue using 3th party plugin as I wrote before.
Comment 9 Ken Stanley CLA 2012-04-06 18:33:32 EDT
Created attachment 213720 [details]
Adds logic for calculating the indent size, for spaces, so that the "tab" visually lines up with the literal tab character.