Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#109 Source formatter does not make tabs 4 column wide

Editor (234)
George Nistorica

When i press [ctrl]+[shift]+[f] (format source), I get 8
columns wide tabs in the source, and not 4 columns,
although i tried to force it to make (the default) 4
columns, by passing -i=4 to perltidy.

If I change -i=4 to for example -i=3, it works, the
sources are formatted using tabs that have only 3

This happens on both E-P-I-C version 0.3.0 and 0.3.8
Eclipse Version: 3.0.1
Perl Version: 5.8.4
PerlTidy Version: 20031021
Using Linux.

Note that if I run perltidy by hand on the same sources, it
formats them good, so I suspect something is wrong
when calling perltidy to format the source from E-P-I-C.


1 2 > >> (Page 1 of 2)
  • LeO

    Logged In: YES

    I think the default column width is 80. You could change it
    with -l=130 to have 130 column width.

    If you change this parameter, does this change the layout as

  • Logged In: YES

    No, it does not work, as it has nothing to do with the
    Not the way the source is showed in the editor is the
    problem, but how it gets formatted by the source formatter.
    This means that, allthough i want it to format the source with
    an identation level of 4 columns, it gets an identation level of
    8 columns.
    This is obvious when doing "cat source.pl" not when editing
    with e-p-i-c which shows 4 column wide tabs.
    What surprises me is that perltidy has a default of 4 columns
    wide per identation level, and even if i try to force e-p-i-c's
    source formatter by adding a parrameter of "-i=4" i get 8
    columns identation level.

  • LeO

    Logged In: YES

    Hm', there wouldn't be quick fix within the next available.
    Nevertheless could you append your file, so it's possible to
    reproduce it?

    Also, what parameter settings did you try in Eclipse, as
    well the command on the shell?

  • Logged In: YES

    You can reproduce with any correct syntactic perl script i

    If you reffer to what parameters I gave to the Source
    Formatter, I haven't given it any parameter first. At a second
    try, I gave it the parameter "-i=4";
    If I got it right these are perltidy's parameters.

    From the shell, I simply run "perltidy -b myscript.pl" as it
    defaults to 4 columns per identation level.

    Please notice that giving in the Source Formatter "-i=4" is
    next to futile. But changing to another integer value, does the
    work. I mean if I put "-i=3" I get 3 columns per identation level
    in my script.

  • LeO

    Logged In: YES

    Sorry, I cannot reproduce this problem. I format and get
    correct tabs, no problem at all.

    So, sample file, what settings in the preferences in
    Source-Formatter, what Tab-Width in the Editor. Otherwise,
    I'll close it, since 'Work's for me'.

  • Logged In: YES

    Settings (any file I can attach that contains configuration

    Window->Preferences->Perl EPIC->Editor
    Displayed Tab Width 4
    Insert spaces/Tabs on ident 0 (this was 1 also and same
    Print Margin Column 80
    All checkboxes checked except "use spaces instead of tabs"

    Window->Preferences->Perl EPIC->Source Formatter
    no checkbox checked
    Additional PerlTidy Options
    Options -i=4
    HMTL Export ....
    Options -toc

  • Logged In: YES

    also, if i set in the source formatter:
    -l=130, i get the following error in the console from where i
    started eclipse:
    "Unhandled event loop exception
    Index out of bounds"

  • Logged In: YES

    Also i could reproduce this bug on w2k using:
    eclipse 3.0.1
    jre 1.4.2_06 from SUN
    epic 0.3.0
    perltidy 20031021
    activestate perl 5.8.4

    The Editor and Source Formatter are using the default settings

  • LeO

    Logged In: YES

    For the last, where does the error occur? i.e. Eclipse-log
    please ATTACH it (resp. snipplet from the exception). The
    rest, I'll test next week.

  • Logged In: YES

    There is no log.

    Ok, i see i haven't succeeded in making me clear, i'll try a
    functional approach:
    step 1) install java
    step 2) install perl
    step 3) install eclipse
    step 4) install epic
    step 5) install perltidy
    step 6) edit a sample script
    step 7) format source
    step 8) save
    step 9) open the saved file with vim (or wordpad if you will)

    You will see that the file is formated wrong and tabs are not 4
    columns, are 8.

    I don't say that tabs don't look like 4 column wide in EPIC's
    editor, i just say that they *do* *not* *contain* 4 column wide

    Impact: a perlstyle formatted source imported from a CVS
    repository gets unformatted upon commiting, thus rendering
    diffs useless.

  • LeO

    Logged In: YES

    Hm', I've tested it once again, and still I'm not able to
    reproduce it.
    To handle further I need the following:

    1) Sample script, which will be formatted the wrong way.
    2) Export of the preferences in Eclipse
    3) for the option -l=130 I need the Eclipse log-file,
    located in workpace/.metadata/.log, since there occurs an

    Please attach all three files to this Bug. I'm only
    interested in EPIC 0.3.8. If below, then I ignore it.

    Also note: the perltidy version used in EPIC is 'built-in'
    and does not use the perltidy-external!!!

  • Sample file that is not properly formatted (open it with any other editor to see)

  • Screenshots of the config. I don't know how to "export" the configuration

  • This is the exception i get when running eclipse. There is no log file in workspace/.metadata , just version.ini

  • log file

  • Logged In: YES

    I partially provided you the info that you requested.
    1) there is a sample script formatted by e-p-i-c. edit it with
    another editor first, to see the actual results.

    2) i don't know how to export the preferences, so i provided you
    screenshots found in an .tar.gz archive of the configuration

    3) i found the log file, i will attach it.

  • LeO

    Logged In: YES

    Sorry, still cannot reproduce it. The file remains with the
    1 resp. 2 tabs, it will not be formatted as 4 tabs. And
    frankly said, do not know where to search for. The export
    preferences is on the Preference-screen. Even on your
    screen-shots you could see it.

    The only thing I could do is about the -l=130 bug - which
    could be really a problem. But here I need more information:

    - Where is the cursor located when you start your
    Source-format? Give me cursor-position of the line
    - Can you somehow interpolate with which l it works and with
    which not? Attach the formated file with the largest working l

    I'm running on a XP, with Perl 5.8.4. Perhaps there is a
    difference between XP and Linux, what I don't believe.
    Especially since you say, it's also reproducable on w2k. So,
    only about the tiny issue with -l=130 I could do something!

  • Logged In: YES

    About the tabs issue. I think there is still a
    _misunderstanding_. I don't say that if I type a [TAB] in the
    editor there is no tab character. It is. But tabs have different
    sizes (4 spaces, 8 spaces and so on.) Here is where perltidy
    comes into play: by default, it makes tabs look like 4 spaces.
    In the E-P-I-C Editor, they look like 4 spaces, but when you
    save the file and open it with any _other_ editor, the tabs look
    like 8 spaces insead of 4. Even if you try to force perltidy to
    format tabs like 4 spaces, it doesn't work.
    Any other number works.

    I will provide you the requested info ASAP.

  • Logged In: YES

    When i am on line 10 (code: sleep 1) i get the exception

    I tried the following values for -l:
    130, 120, 100, 80, 50, 30, 10.
    I get the exception with all of them.

    I will attach the preferences export.

    Note that I upgraded to perl-5.8.5 now, and still the same

  • LeO

    Logged In: YES

    About the looking, I still don't get it:

    You have one tab, which is also seen as one tab. This is
    represented by 4 spaces by default in Eclipse, you could
    change this eg. to 2 spaces as well as to 8 spaces -
    look-out. Next you open the one tab, and see it in another
    editor as 8 spaces, but still one tab?

    If so, then I would say, it's a problem with your external
    editor. Did you try as well in the Editor-option 'uses space
    instead of tabs'. You didn't check it!!!

  • LeO

    • assigned_to: nobody --> leo_forge
  • LeO

    Logged In: YES

    The other issue aobut the -l with following exception:

    I see where the problem is, but do not understand WHY. So,
    you tried this with your enclosed sample? On w2k as well as
    under Linux you get the error?

    I can provide something, but it's more out of the dark, ...

  • tkratz

    Logged In: YES

    I don't want to disturb the argument but:

    There is no such thing as a width of a tab!

    What you see is what the editor/viewer makes of it. Only
    when you replace a tab by a certain amount of spaces, you
    can fix the display of the file.

  • Logged In: YES

    tkratz you have a point.

    indeed, setting E-P-I-C to replace tabs with spaces works.

    but there is still a bug: i can set in source formatter, -i=3 and i
    get 3 spaces for a tab; i can set -i=2 and get 2 spaces for a
    tab; i set -i=4 and get 8 spaces for a tab (don't be fooled by
    what the E-P-I-C editor is showing you, just run cat on the
    saved file).
    this is annoying when working with a team of people over the
    same sources, and everybody is running perltidy on their

    leo_forge: can i open another bug for the "-l" parameter? i think
    the discussion is getting mixed up.
    the tests where run on the provided sample, only on Linux.

1 2 > >> (Page 1 of 2)