I got an annoying problem which has been existing for my blogs at least since v2.9, can be reproduced by me on several hosting providers and for which I hope someone here has a fix:
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 <strong>[\r\n]{2,}</strong>
replace with <strong>\n</strong>
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!
Dbranes answers:
Here is a patch
[[LINK href="http://core.trac.wordpress.org/attachment/ticket/9716/9716.2.patch"]]http://core.trac.wordpress.org/attachment/ticket/9716/9716.2.patch[[/LINK]]
there are some discussions about this problem here:
[[LINK href="http://core.trac.wordpress.org/ticket/9716"]]http://core.trac.wordpress.org/ticket/9716[[/LINK]]
Dbranes comments:
ps: you can also use external editors like Ace/Codemirror when editing plugins/themes
Here is a plugin to use the Ace editor
[[LINK href="http://wordpress.org/extend/plugins/ace-edit/"]]http://wordpress.org/extend/plugins/ace-edit/[[/LINK]]
I can't check if such a plugin solves the problem, since I don't get these extra lines ;-)
Hope this helps
Dbranes comments:
Another solution would be to try to change the
Edit->Preferences->Code Format->Line Break Type
in Dreamweaver
Dbranes comments:
Here is a note from the [[LINK href="http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7be0a.html#WSc78c5058ca073340dcda9110b1f693f21-7bdda"]]documentation[[/LINK]]:
<blockquote>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.</blockquote>
Robert Seyfriedsberger comments:
thanks - that was the right approach. I tested some plugins and finally decided to use "Advanced Code Editor" which was the most current one.
Daniel Yoen answers:
try Edit > Preferences > Code Format > Line break type: LF (Unix) in your dreamweaver
Asad Iqbal answers:
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?