Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Strange auto formatting bug
Strange auto formatting bug [message #7546] Mon, 19 March 2007 19:42 Go to next message
Adam Randall is currently offline Adam RandallFriend
Messages: 19
Registered: July 2009
Junior Member
I've found a strange bug, but I'm not sure if it's been reported yet, or if
there is a work around (I've found nothing). It seems that when pasting
text into Eclipse w/PDT, it triggers Eclipse to reformat the code. My
favorite is when it reformats an HTML element into multiple lines, but
that's a different story. Anyway, when pasting in, and it reformats, if you
undo (Cmd-Z) it will undo without taking into consideration the reformatting
it had done, and text ends up in multiple places, out of order, completely
corrupting the original code.

Here is an example. Please note that the <img> tag is all one line, and is
intended to be long:

<html>
<head>
<title>Test File</title>
</head>
<body>
<img src="/this/is/a/test/path/that/is/kind/of/long.jpg width="1500"
height="1000" title="this is the title of the image tag" label="this is the
label of the image tag" border="0">
</body>
</html>

Now, I'm going to paste [$_border] in place of the 0 in the border="0"
attribute. What results is this:

<html>
<head>
<title>Test File</title>
</head>
<body>
<img
src="/this/is/a/test/path/that/is/kind/of/long.jpg width="
1500" height="1000" title="this is the title of the image tag"
label="this is the label of the image tag" border="[$_border]">
</body>
</html>

If the above did not translate correctly, it has formatted the <img tag to
the begging of the line (ignoring original tabbing), it hard returned right
after width=", thus adding a return and tab character to the value of the
width attribute. It also added a return after the title attribute/value,
starting label on the next line and indented. Now, if I undo the paste, I
get:

<html>
<head>
<title>Test File</title>
</head>
<body>
<img
src="/this/is/a/test/path/that/is/kind/of/long.jpg width="
1500" height="1000" title="this is the title of the image tag"
label="this is the label of the image tag" border0r]">
</body>
</html>

The undo did not undo the reformatting, and at this point, there's no more
levels of undo available. Note that the border attribute has been completely
mangled being formed into border0r]"

When this happens, there's nothing that you can do to safely recover. Even
if you wanted to restore the change, by using cmd-Y, this is what results:

<html>
<head>
<title>Test File</title>
</head>
<body>
<img
src="/this/is/a/test/path/that/is/kind/of/long.jpg width="
1500" height="1000" title="this is the title of the image tag"
label="this is the label of the image tag" border[$_border]r]">
</body>
</html>

[$_border] is being repopulated, but in the middle of the border attribute.

Another example of incorrect formatting is this:

<?php

if(true)
echo "hello world";
else
echo "never happen";

?>

If we paste " should", sans the quotes but with the leading space,
immediately after the r in never, the result is:

<?php

if(true)
echo "hello world";
else
echo "never should happen";

?>

The echo has been brought back one level of indenting, which it shouldn't.
Having it in the { } braces resolves this problem, but they aren't necessary
here. Additionally, when trying to undo the paste, it correctly does the
job, but does not restore the indentation.

Should I create a bug on this? Is it PDT that's doing this reformatting? If
it's not, where should I look to resolve the issue?

The version of PDT that I'm running is 0.7.0.v20070221----------9FhPQOPhhd,
which was installed using the download URL
http://download.eclipse.org/tools/pdt/updates/ direcly inside of Eclipse.
Eclipse is 3.2.2. Other than the required packages that are required by PDT
only Subclipse is installed.

Regards,

Adam.
Re: Strange auto formatting bug [message #7555 is a reply to message #7546] Mon, 19 March 2007 20:01 Go to previous messageGo to next message
Adam Randall is currently offline Adam RandallFriend
Messages: 19
Registered: July 2009
Junior Member
I've found bug #176372 which seems related to this issue:
I have problem with history... when i go back (ctrl+z) eclipse start crazy,
sometimes it does not go back, or it does, but cursor is going to wrong
place,
or eclipse changes wrong line, etc.

I thought that this issue would be solved in release form March, but it is
not.

BR, Lukasz
I'll append a note to that bug and see if it gets anywhere.

Adam.

"Adam Randall" <adam@lockdownnetworks.com> wrote in message
news:etmp2h$5if$1@utils.eclipse.org...
> I've found a strange bug, but I'm not sure if it's been reported yet, or
> if
> there is a work around (I've found nothing). It seems that when pasting
> text into Eclipse w/PDT, it triggers Eclipse to reformat the code. My
> favorite is when it reformats an HTML element into multiple lines, but
> that's a different story. Anyway, when pasting in, and it reformats, if
> you
> undo (Cmd-Z) it will undo without taking into consideration the
> reformatting
> it had done, and text ends up in multiple places, out of order, completely
> corrupting the original code.
>
> Here is an example. Please note that the <img> tag is all one line, and is
> intended to be long:
>
> <html>
> <head>
> <title>Test File</title>
> </head>
> <body>
> <img src="/this/is/a/test/path/that/is/kind/of/long.jpg width="1500"
> height="1000" title="this is the title of the image tag" label="this is
> the label of the image tag" border="0">
> </body>
> </html>
>
> Now, I'm going to paste [$_border] in place of the 0 in the border="0"
> attribute. What results is this:
>
> <html>
> <head>
> <title>Test File</title>
> </head>
> <body>
> <img
> src="/this/is/a/test/path/that/is/kind/of/long.jpg width="
> 1500" height="1000" title="this is the title of the image tag"
> label="this is the label of the image tag" border="[$_border]">
> </body>
> </html>
>
> If the above did not translate correctly, it has formatted the <img tag to
> the begging of the line (ignoring original tabbing), it hard returned
> right after width=", thus adding a return and tab character to the value
> of the width attribute. It also added a return after the title
> attribute/value, starting label on the next line and indented. Now, if I
> undo the paste, I get:
>
> <html>
> <head>
> <title>Test File</title>
> </head>
> <body>
> <img
> src="/this/is/a/test/path/that/is/kind/of/long.jpg width="
> 1500" height="1000" title="this is the title of the image tag"
> label="this is the label of the image tag" border0r]">
> </body>
> </html>
>
> The undo did not undo the reformatting, and at this point, there's no more
> levels of undo available. Note that the border attribute has been
> completely mangled being formed into border0r]"
>
> When this happens, there's nothing that you can do to safely recover. Even
> if you wanted to restore the change, by using cmd-Y, this is what results:
>
> <html>
> <head>
> <title>Test File</title>
> </head>
> <body>
> <img
> src="/this/is/a/test/path/that/is/kind/of/long.jpg width="
> 1500" height="1000" title="this is the title of the image tag"
> label="this is the label of the image tag" border[$_border]r]">
> </body>
> </html>
>
> [$_border] is being repopulated, but in the middle of the border
> attribute.
>
> Another example of incorrect formatting is this:
>
> <?php
>
> if(true)
> echo "hello world";
> else
> echo "never happen";
>
> ?>
>
> If we paste " should", sans the quotes but with the leading space,
> immediately after the r in never, the result is:
>
> <?php
>
> if(true)
> echo "hello world";
> else
> echo "never should happen";
>
> ?>
>
> The echo has been brought back one level of indenting, which it shouldn't.
> Having it in the { } braces resolves this problem, but they aren't
> necessary here. Additionally, when trying to undo the paste, it correctly
> does the job, but does not restore the indentation.
>
> Should I create a bug on this? Is it PDT that's doing this reformatting?
> If it's not, where should I look to resolve the issue?
>
> The version of PDT that I'm running is
> 0.7.0.v20070221----------9FhPQOPhhd, which was installed using the
> download URL http://download.eclipse.org/tools/pdt/updates/ direcly inside
> of Eclipse. Eclipse is 3.2.2. Other than the required packages that are
> required by PDT only Subclipse is installed.
>
> Regards,
>
> Adam.
>
Re: Strange auto formatting bug [message #7575 is a reply to message #7555] Mon, 19 March 2007 22:11 Go to previous messageGo to next message
Andrija Frincic is currently offline Andrija FrincicFriend
Messages: 4
Registered: July 2009
Junior Member
Adam Randall wrote:
> I've found bug #176372 which seems related to this issue:
> I have problem with history... when i go back (ctrl+z) eclipse start crazy,
> sometimes it does not go back, or it does, but cursor is going to wrong

What about 174899 :-) They finally solve that issue i test it with a
latest nightly build.


--
Andrija Frincic aka BobRock
mailto:bob.rock.hr@gmail.com
ICQ: 24954606
-
Holly: Emergency. Emergency. There's an emergency going on. It's still
going on. It's still an emergency. This is an emergency announcement.
Red Dwarf, Confidence and Paranoia
Re: Strange auto formatting bug [message #7616 is a reply to message #7575] Mon, 19 March 2007 23:36 Go to previous messageGo to next message
Adam Randall is currently offline Adam RandallFriend
Messages: 19
Registered: July 2009
Junior Member
I checked out the nightly, and while it looks a little better, it appears to
be just as bad as it was before. I have commented on the bug with what I
found, asking that it be reopened.

Adam.

"Andrija Frincic" <bob.rock.hr@gmail.com> wrote in message
news:etn29a$rld$1@utils.eclipse.org...
> Adam Randall wrote:
>> I've found bug #176372 which seems related to this issue:
>> I have problem with history... when i go back (ctrl+z) eclipse start
>> crazy,
>> sometimes it does not go back, or it does, but cursor is going to wrong
>
> What about 174899 :-) They finally solve that issue i test it with a
> latest nightly build.
>
>
> --
> Andrija Frincic aka BobRock
> mailto:bob.rock.hr@gmail.com
> ICQ: 24954606
> -
> Holly: Emergency. Emergency. There's an emergency going on. It's still
> going on. It's still an emergency. This is an emergency announcement.
> Red Dwarf, Confidence and Paranoia
Re: Strange auto formatting bug [message #7659 is a reply to message #7616] Tue, 20 March 2007 08:46 Go to previous messageGo to next message
Andrija Frincic is currently offline Andrija FrincicFriend
Messages: 4
Registered: July 2009
Junior Member
Adam Randall wrote:
> I checked out the nightly, and while it looks a little better, it appears to
> be just as bad as it was before. I have commented on the bug with what I
> found, asking that it be reopened.

I was generally satisfied with a fix, but i have no time for such in
depth testing you performed.. :-(
IMO this issue is a stopper for a 0.7 release, and it should be fixed,
but it is up to PM at Zend.

Regards
--
Andrija Frincic aka BobRock
mailto:bob.rock.hr@gmail.com
ICQ: 24954606
-
Holly: Emergency. Emergency. There's an emergency going on. It's still
going on. It's still an emergency. This is an emergency announcement.
Red Dwarf, Confidence and Paranoia
Re: Strange auto formatting bug [message #7723 is a reply to message #7616] Wed, 21 March 2007 00:34 Go to previous messageGo to next message
Adam Randall is currently offline Adam RandallFriend
Messages: 19
Registered: July 2009
Junior Member
Please disregard my comments. I have just realized that the issue itself is
resolved, and I was not running the nightly, but the stable build from
2/21/2007. When I installed the 3/19/2007 nightly, it installed into a
subfolder within my eclipse directory. After I /properly/ installed the
nightly, and tested again, I can confirm that this is certainly not
occurring
anymore (no format on paste).

Adam."Adam Randall" <adam@lockdownnetworks.com> wrote in message
news:etn6po$j7o$1@utils.eclipse.org...
>I checked out the nightly, and while it looks a little better, it appears
>to be just as bad as it was before. I have commented on the bug with what I
>found, asking that it be reopened.
>
> Adam.
>
> "Andrija Frincic" <bob.rock.hr@gmail.com> wrote in message
> news:etn29a$rld$1@utils.eclipse.org...
>> Adam Randall wrote:
>>> I've found bug #176372 which seems related to this issue:
>>> I have problem with history... when i go back (ctrl+z) eclipse start
>>> crazy,
>>> sometimes it does not go back, or it does, but cursor is going to wrong
>>
>> What about 174899 :-) They finally solve that issue i test it with a
>> latest nightly build.
>>
>>
>> --
>> Andrija Frincic aka BobRock
>> mailto:bob.rock.hr@gmail.com
>> ICQ: 24954606
>> -
>> Holly: Emergency. Emergency. There's an emergency going on. It's still
>> going on. It's still an emergency. This is an emergency announcement.
>> Red Dwarf, Confidence and Paranoia
>
>
Re: Strange auto formatting bug [message #8991 is a reply to message #7659] Fri, 23 March 2007 12:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dominic.clifton.gr-tech.net

> I was generally satisfied with a fix, but i have no time for such in
> depth testing you performed.. :-(

I could not agree more. To let that out the door is quite frankly shocking
and is noticeable very easily.

The undo problem just exasperates it, and the lack of any UI controls to
turn it off is just well, shocking. I mean who are you (the developer of
this feature) to say how I want MY code formatted? Every developer or
development team has their own standard of how they want code formatted and
there's no way your forced default is going to work for us all!

Dom
Re: Strange auto formatting bug [message #9097 is a reply to message #8991] Fri, 23 March 2007 14:58 Go to previous messageGo to next message
Andrija Frincic is currently offline Andrija FrincicFriend
Messages: 4
Registered: July 2009
Junior Member
Dominic Clifton wrote:
> turn it off is just well, shocking. I mean who are you (the developer of
> this feature) to say how I want MY code formatted? Every developer or
> development team has their own standard of how they want code formatted and
> there's no way your forced default is going to work for us all!

I agree with that, and they turned off formating of pasted code.


CU

--
Andrija Frincic aka BobRock
mailto:bob.rock.hr@gmail.com
ICQ: 24954606
-
Holly: Emergency. Emergency. There's an emergency going on. It's still
going on. It's still an emergency. This is an emergency announcement.
Red Dwarf, Confidence and Paranoia
Re: Strange auto formatting bug [message #12023 is a reply to message #8991] Tue, 03 April 2007 23:24 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse.ramster.org

I agree that this is terrible. I have never in all my years of computing
used an editor that corrupted the code on an undo-redo cycle in such a
bad way. It introduced several hard to track down php bugs into my site
before I realised the problem.



Dominic Clifton wrote:
> I could not agree more. To let that out the door is quite frankly shocking
> and is noticeable very easily.
>
> The undo problem just exasperates it, and the lack of any UI controls to
> turn it off is just well, shocking. I mean who are you (the developer of
> this feature) to say how I want MY code formatted? Every developer or
> development team has their own standard of how they want code formatted and
> there's no way your forced default is going to work for us all!
>
> Dom
>
>
Previous Topic:Changing Title of Editor Window
Next Topic:Xdebug: files with same name
Goto Forum:
  


Current Time: Sat Apr 27 04:53:23 GMT 2024

Powered by FUDForum. Page generated in 0.03429 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top