WordPress.org

Ready to get started?Download WordPress

Forums

Editing theme/plugin files via built-in editor adds extra blank extra lines (4 posts)

  1. RobertHarm
    Member
    Posted 1 year ago #

    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 [\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!

  2. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Make sure the plain text file is saved as UTF-8 on local edit. The default now for Notepad is ANSI (which inserts the breaks) and may even add a BOM.

    Fix

  3. RobertHarm
    Member
    Posted 1 year ago #

    The problem already exists when I open the file and I havent made any changes through Dreamweaver or Notepad++ (not the Windows notepad)

  4. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Check defaults for each of those.

Topic Closed

This topic has been closed to new replies.

About this Topic