Posts Tagged ‘get rid of extra line breaks’

Line Break bug in Dreamweaver

Wednesday, April 13th, 2011

I’ve been using Dreamweaver for a while now since they stopped supporting Homesite. What I don’t like about it is the additional line breaks that appear in the source code after multiple commits/uploads – whether it is via SVN or Contribute.

Now if you’ve already downloaded the file and it has multiple line breaks – here’s how you remove the extra spaces:

  • While the document is open in Dreamweaver, press CTRL+F to load the Find & Replace dialog box. Do the search on the source code view.
  • Check the box “Use regular expression” and uncheck any other boxes.
  • Find: [\r\n]{2,}
  • Replace: \n
  • The hit “replace all”

That will do it! However, take note that this while this will remove any existing white space on your code. When you commit/upload/download the file again, the same thing will happen all over. We need to change the line feed type in the settings to get rid of this problem once and for all.

  • Inside Dreamweaver, click Edit on the menu.
  • Then Preferences.
  • Then Code Format.
  • Then on the “Line Break Type” select “LF (unix)”
  • Click Ok. Done!

Thanks to Jared for the article.