Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326250 - Insert spaces for tabs,not working
Summary: Insert spaces for tabs,not working
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P1 normal with 6 votes (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact: Ilina Stefanova CLA
URL:
Whiteboard:
Keywords:
: 336623 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-26 00:33 EDT by Erick CLA
Modified: 2020-05-14 11:08 EDT (History)
13 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erick CLA 2010-09-26 00:33:49 EDT
Build Identifier: 20100917-0705

I have selected the option "Insert spaces for tabs",Preferences->General->Editors->Text Editors。
Some time,it's OK.But,it does not work in a string,when I used the key "tab".
Not insert spaces for tabs.

Reproducible: Always

Steps to Reproduce:
1.as a  string,$str = "SELECT * FROM <tab>"...
2.<tab>,the flag is using tab key
3.tab just tab,not spaces
Comment 1 xu jiaxi CLA 2010-11-03 06:26:18 EDT
I think every input in a string should be treated as it was.

If we change the tab to spaces in a string, then nobody can type a tab in string if he really want a tab.
Comment 2 Ton CLA 2010-11-03 09:12:10 EDT
For tab exist special char "\t". And what differences between editing 2 lines or 1 by pressing tab?
Comment 3 Lech CLA 2010-11-08 04:15:44 EST
(In reply to comment #1)
> I think every input in a string should be treated as it was.
> 
> If we change the tab to spaces in a string, then nobody can type a tab in
> string if he really want a tab.

I'd vote for "\t" to use tabs in strings, but let it be the way it is.

However, the problem I've encountered is not only that tabs are being inserted in strings, but just before strings too, and that's very annoying.

Reproducible cases:

1. <?php $myArray['key']?> -- insert tab just before 'key', like so: <?php $myArray[<TAB>'key']?>
2. <?php array('a', 'b', 'c')?> -- type enter (next line) just after first clause after array and insert tab, like so:

<?php array(
<TAB>'a', 'b', 'c')?>

or insert tab before any of 'a', 'b' or 'c' string -- you'll get <TAB> inserted.
Comment 4 Miha Vrhovnik CLA 2010-12-21 04:03:42 EST
I can confirm this one and is annying as hell.
As said before me. it happens most times when trying to indent a single inteim in anarray. or even when edditing an array like this

$a = array(
 'foo'<tab>=>

or $b = array(
<tab>
Comment 5 Ezra B. Gildesgame CLA 2010-12-29 15:39:12 EST
I'm seeing this behavior as well with build 20100917-0705 on Mac OS 10.6.4.
Comment 6 actra.development CLA 2011-01-01 13:18:28 EST
This bug is absolutely annoying as it worked like a charm in previous versions.
As the configuration gives the option "use spaces for tabs" than it has to use spaces, not tabs, equally if it's a string, an array, the beginning of a line or whatever.
Checking files and replacing tab-chars over and over again is a tedious task.

Please fix this as soon as possible - or add an option where the user can decide if all tabs are spaces or not, whatever you like most.
Comment 7 Toshihiro Izumi CLA 2011-01-02 22:01:11 EST
Try this as a stopgap.
http://sourceforge.jp/projects/pdt-tools/releases/50444/note
Comment 8 actra.development CLA 2011-01-05 16:01:10 EST
(In reply to comment #7)
> Try this as a stopgap.
> http://sourceforge.jp/projects/pdt-tools/releases/50444/note

It would use spaces - but also disables indentation for e.g. blocks of code.
Comment 9 Toshihiro Izumi CLA 2011-01-06 04:19:38 EST
Oops, I see.
Moreover, the plugin doesn't work for Shift+Tab...
I've fixed problems and uploaded new version.
Thanks for your feedback :)

http://sourceforge.jp/projects/pdt-tools/releases/50484/note
Comment 10 Vlad Mu CLA 2011-02-26 06:56:05 EST
I also have this problem and I unsuccessfully wasted a lot of time for finding the decision. I agree with comment #6 and think that it should be fixed. Therefore I Vote for this bug.
So in my opinion when I set "Insert spaces for tabs" I should have only spaces, for ability to insert the TAB symbol in this case I think it would be useful to use hotkey like Ctrl+Tab for example.
Comment 11 Lallement CLA 2011-03-28 05:28:42 EDT
I would like to try the non official fix hosted here:

http://sourceforge.jp/projects/pdt-tools/releases/50484

But there is "No Files Available For This Release". Is it normal?

PHP Editor should works as JAVA Editor. In my case, if I set Space => 4 spaces (for text editor formatter or php editor formatter), there is no effect. Tabs are not changed to spaces.
Comment 12 Toshihiro Izumi CLA 2011-03-28 05:42:41 EDT
(In reply to comment #11)

Sorry about incovenience, new url is
http://sourceforge.jp/projects/pdt-tools/releases/50605
Comment 13 Zhongwei Zhao CLA 2011-04-13 23:35:22 EDT
*** Bug 336623 has been marked as a duplicate of this bug. ***
Comment 14 Zhongwei Zhao CLA 2011-06-29 03:56:49 EDT
*** Bug 336647 has been marked as a duplicate of this bug. ***
Comment 15 Zhongwei Zhao CLA 2011-07-11 04:04:56 EDT
fixed in head
Comment 16 Ilina Stefanova CLA 2011-07-26 04:31:49 EDT
Verified.
Comment 17 Ehsan Azar CLA 2011-09-21 14:55:38 EDT
I see the same bug, Windows7
Eclipse IDE for C/C++ Developers
Version: Indigo Release
Build id: 20110615-0604
My previous version was working fine.

"Window/Prefrences/General/Editors/Text Editors/Insert spaces for Tabs" is checked. I hit Tab, it does not add spaces, to confirm I hit backspace it deletes the whole tab, also if I click with mouse to the tab area the cursor goes only in either beginning or end.
Comment 18 Chris Krahe CLA 2011-09-22 12:38:38 EDT
(In reply to comment #17)
> I see the same bug, Windows7
> Eclipse IDE for C/C++ Developers
> Version: Indigo Release
> Build id: 20110615-0604

It looks like you're running a June build.  From the comments here, the bug wasn't fixed until July.

Note: You can view tab characters by checking "General | Editors | Text Editors | Show whitespace characters" in preferences.
Comment 19 Ehsan Azar CLA 2011-09-22 13:58:34 EDT
It still is present in the Indigo "Developer builds", built in September
Eclipse IDE for C/C++ Developers
Version: Indigo Service Release 1
Build id: 20110909-0630
Maybe the patch was not merged in the CDT-bundled Eclipse, I may have to wait for an update, or get the classic and add CDT

As per your suggestion
I turned on "Window/Prefrences/General/Editors/Text Editors/Show whitespace characters", now it is easier to see the Tab characters :)
Comment 20 Ehsan Azar CLA 2011-09-22 14:47:43 EDT
I also tried Juno and the same bug exists, should I file a new bug?

Version showing the bug:
Eclipse IDE for C/C++ Developers
Version: Juno Release
Build id: 20110818-2043
Comment 21 Ricardo Martins CLA 2011-10-26 14:48:40 EDT
I confirm this bug is also appearing in General Indigo with CDT plugin:

Eclipse SDK
Version: 3.7.1
Build id: M20110909-1335