Print Thread
Beautifier creates redundant whitespace on empty lines
#52980 01/26/16 02:48 PM
Joined: Feb 2007
Posts: 134
Bulgaria
braykov Offline OP
Member
OP Offline
Member
Joined: Feb 2007
Posts: 134
Bulgaria
I have a section of code with 3 empty lines. Empty meaning no tabs and no spaces on them.
I have the following setting in the rules: Empty Lines -> Merge into one.
After I beautify the code, my 3 lines have merged into one, but I have tabs added to this empty line.
When I don't have the "Use tab character" set, then the merged line has redundant spaces.
Beautifier should remove all whitespace from empty (blank) lines and should not add such when merging empty lines.

Re: Beautifier creates redundant whitespace on empty lines
braykov #52991 01/27/16 10:01 AM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
I have added this to the list of enhancement requests.


Marco Kalter
Allround Automations
Re: Beautifier creates redundant whitespace on empty lines
braykov #52994 01/27/16 12:00 PM
Joined: Sep 2003
Posts: 387
London, UK
Member
Offline
Member
Joined: Sep 2003
Posts: 387
London, UK
[quote]Beautifier should remove all whitespace from empty (blank) lines and should not add such when merging empty lines.[/quote]

Agreed. Cleaning up stray whitespace is one of the reasons for running the Beautifier.

I would also like to see all options that result in tab characters in source code being permanently removed, as they can only do harm. I think this would be a significant improvement.

Re: Beautifier creates redundant whitespace on empty lines
William Robertson #52995 01/27/16 12:13 PM
Joined: Feb 2007
Posts: 134
Bulgaria
braykov Offline OP
Member
OP Offline
Member
Joined: Feb 2007
Posts: 134
Bulgaria
I consider this a BUG and not an enhancement request. Because the beautifier adds whitespace characters where originally there were none.

Re: Beautifier creates redundant whitespace on empty lines
braykov #53006 01/28/16 09:29 AM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
I assume this is the left margin of the code?


Marco Kalter
Allround Automations
Re: Beautifier creates redundant whitespace on empty lines
Marco Kalter #53009 01/28/16 10:01 AM
Joined: Feb 2007
Posts: 134
Bulgaria
braykov Offline OP
Member
OP Offline
Member
Joined: Feb 2007
Posts: 134
Bulgaria
Exactly

Re: Beautifier creates redundant whitespace on empty lines
braykov #53163 02/23/16 02:39 PM
Joined: Feb 2007
Posts: 134
Bulgaria
braykov Offline OP
Member
OP Offline
Member
Joined: Feb 2007
Posts: 134
Bulgaria
UPDATE:
I just noticed a pattern: the quantity of whitespace entered on empty lines is equal to the number of indentations on the line just above it minus one.
So if the above line is indented 3 times with 3 tabs, the following line would have 2 tabs.
Or if spaces are used and the indentation is set to 4 spaces, then the line with the code has 12 spaces and the "empty" line has 8.

This is the most important bug for us. Because if we beatify all of our code now, when you fix this (later) a subsequent beatify command will introduce a lot of changed lines in our version control.

Re: Beautifier creates redundant whitespace on empty lines
braykov #56078 03/08/17 03:38 PM
Joined: Feb 2007
Posts: 134
Bulgaria
braykov Offline OP
Member
OP Offline
Member
Joined: Feb 2007
Posts: 134
Bulgaria
Any update one year later? This is really bugging with our Git.
PLEASE!!!

Re: Beautifier creates redundant whitespace on empty lines
braykov #62512 04/21/21 11:31 AM
Joined: Apr 2021
Posts: 1
F
Member
Offline
Member
F
Joined: Apr 2021
Posts: 1
We have the same problem with the beautifier rules. Could this be fixed please?

Re: Beautifier creates redundant whitespace on empty lines
braykov #65593 03/29/24 11:58 AM
Joined: Nov 2023
Posts: 1
T
Member
Offline
Member
T
Joined: Nov 2023
Posts: 1
It's 2024, ver.15 and we still have this bug!?


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.126s Queries: 15 (0.067s) Memory: 2.5376 MB (Peak: 3.0395 MB) Data Comp: Off Server Time: 2024-04-27 15:25:49 UTC
Valid HTML 5 and Valid CSS