Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gedit adds line at end of file

The answer to this must be somewhere but I'm not finding it -- can anyone help me understand why in Gedit, if I have a page of code there is no extra trailing blank line, but then when I do a file comparison for my svn commit it shows an extra line being added at the end of the file?

I have a feeling that Gedit is automatically adding an ending line break. But why, I have no idea...

like image 521
Sam Avatar asked Jun 16 '10 19:06

Sam


2 Answers

Reality finally won and it's been fixed, but the broken behavior is still the default; enable the WYSIWYG behavior in a terminal with

gsettings set org.gnome.gedit.preferences.editor ensure-trailing-newline false
like image 200
blargg Avatar answered Oct 13 '22 16:10

blargg


It's a feature. I don't think it can easily be disabled.

this is intentional: text files should always be terminated by \n, otherwise tools like 'cat', 'sed' etc may have problems. However there is no reason to always show an empty line at the bottom of the text view, that's why we do not show the last \n

paolo borelli [gedit developer]

like image 38
Mark Byers Avatar answered Oct 13 '22 15:10

Mark Byers