Wrong indentions of a simple if-clause #29

Closed
OlofT opened this Issue Jan 4, 2013 · 7 comments

4 participants

@OlofT

The indentions of a simple if-clause gets wrong:

<?php
if (true)
        {
                some code
        }
?>

It should of-course look like this:

<?php
if (true)
{
        some code
}
?>
@sorbits
textmate member

Works correctly here either if I type the if line-by-line or select it and choose Text → Indent Selection.

Are you in PHP mode (status bar) and are you using the stock PHP bundle w/o modifications?

@sorbits sorbits closed this Jan 4, 2013
@OlofT

100% sure (otherwise there wouldn't be a need for posting, right?)

@sorbits
textmate member

Well, knowing that you are 100% sure doesn’t help me troubleshoot your issue.

Can you provide steps to reproduce? Can you test this both by typing line-by-line and by selecting the code and select Text → Indent Selection and let me know if both behave wrong. And when you select the code, be sure to not include the surrounding <? and ?> tags (as that might make it use HTML indent patterns).

@miken32

I see the same behaviour. As soon as I hit return at the end of the first line, it sticks a tab in there. Doing the indent from the Text menu works correctly. I don't care about this for the if clause, but the same behaviour happens with function and class declarations.

<?php

function foo($bar)
    {
        baz();
    }

?>
@sorbits
textmate member

@miken32 Could be that something has overloaded the return key. You can use Bundles → Select Bundle Item… (⌃⌘T) to find the potential culprit (switch to key equivalent search / ⌘4).

@miken32

Just went into preferences and unchecked every bundle except the PHP bundle and things broke bad. So I unchecked PHP and re-checked it, which installed a bunch of other dependencies as well. So now running on the bare minimum and it still isn't working properly.

<?php
function foo($bar)
    {
    baz();
}
?>

(As an aside, I got an error when typing the initial <?php tag and hitting enter -- "exit_insert_snippet: command not found.")

@sorbits
textmate member

Remove these two folders:

~/Library/Application Support/Avian
~/Library/Application Support/TextMate

That will remove any potential customizations and also ensure you get the default bundles back (that should fix the error you get).

As for the issue in this ticket, turns out there is actually a problem and it was introduced with commit a23d870@infininight why was this change made?

@sorbits sorbits reopened this Jan 21, 2013
@infininight infininight added a commit that closed this issue Jan 22, 2013
@infininight infininight Revert “Check for a following } even without a space after {“
This change caused an indentation glitch after an if clause when putting the braces on the line following the if statement. Original commit was the prevent `{}` from increasing the indent, will have to revisit that in another fashion.

Fixes #29
bb576b5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment