Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$5
Editing theme/plugin files adds extra blank extra lines
normally I edit plugin and theme files via Dreamweaver. When I have to do a quick change, I sometimes also use the built in editor to edit plugin or theme files.
If I open these changed files afterwards via Dreamweaver (or simply by downloading them via ftp and opening them via editor or notepad), extra blank lines were added after each line:
before:
<table>
<tr>
<td>
hello
...
after:
<table>
<tr>
<td>
hello
...This is very annoying as it bloats up my files, makes them developer-unfriendly to read and each time before I commit my changes to github for example, I have to replace those extra lines by running the following find/replace query via a regular expression:
find [\r\n]{2,}
replace with \n
I already searched official WordPress trac once and found a ticket (which I couldnt find again :-/) where a user reported a similar problem and developers said that this should be fixed - which is definitely NOT fixed.
Does anyone know how to solve this problem? I dont want to run the regular expression each time before commiting to github as it takes a lot of time to remove those extra lines on large files.
Thanks for any help!
This question has been answered.
Robert Harm | 08/11/12 at 4:34am
Edit
(3) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
08/11/12
4:53amDbranes says:Here is a patch
http://core.trac.wordpress.org/attachment/ticket/9716/9716.2.patch
there are some discussions about this problem here:
http://core.trac.wordpress.org/ticket/9716- 08/11/12 4:58am
Dbranes says:ps: you can also use external editors like Ace/Codemirror when editing plugins/themes
Here is a plugin to use the Ace editor
http://wordpress.org/extend/plugins/ace-edit/
I can't check if such a plugin solves the problem, since I don't get these extra lines ;-)
Hope this helps - 08/11/12 5:05am
Dbranes says:Another solution would be to try to change the
Edit->Preferences->Code Format->Line Break Type
in Dreamweaver - 08/11/12 5:15am
Dbranes says:Here is a note from the documentation:
Line Break Type Specifies the type of remote server (Windows, Macintosh, or UNIX) that hosts your remote site. Choosing the correct type of line break characters ensures that your HTML source code appears correctly when viewed on the remote server. This setting is also useful when you are working with an external text editor that recognizes only certain kinds of line breaks. For example, use CR LF (Windows) if Notepad is your external editor, and use CR (Macintosh) if SimpleText is your external editor.
Note: For servers that you connect to using FTP, this option applies only to binary transfer mode; the ASCII transfer mode in Dreamweaver ignores this option. If you download files using ASCII mode, Dreamweaver sets line breaks based on the operating system of your computer; if you upload files using ASCII mode, the line breaks are all set to CR LF.
- 08/11/12 3:29pm
Robert Harm says:thanks - that was the right approach. I tested some plugins and finally decided to use "Advanced Code Editor" which was the most current one.
- 08/11/12 4:58am
-

Last edited:
08/11/12
7:29amDaniel Yoen says:try Edit > Preferences > Code Format > Line break type: LF (Unix) in your dreamweaver
-

Last edited:
08/11/12
7:35amAsad Iqbal says:Did you use this editor ever: http://notepad-plus-plus.org/
I'm not sure because I've not the same problem. Also can you please tell which OS you are currently using?
This question has expired.
Gabriel Reguly, Hai Bui, Arnav Joy, Robert Harm, Martin Pham voted on this question.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
