Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 559932

Summary: app-editors/gedit-3.16.3: Final newline in file is not shown
Product: Gentoo Linux Reporter: Raymond Jennings <shentino>
Component: Current packagesAssignee: Gentoo Linux Gnome Desktop Team <gnome>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugzilla.gnome.org/show_bug.cgi?id=625955
Whiteboard:
Package list:
Runtime testing required: ---

Description Raymond Jennings 2015-09-08 05:06:37 UTC
I used gedit on a source code file, and it doesn't appear to distinguish whether or not the file ends in a newline or not.  Both cases show up the same in the editor.

Reproducible: Always

Steps to Reproduce:
1.  Create a file with no newline at the end
2.  Load it with gedit, take a look at the bottom of the editing area
3.  Save without doing any edits (should logically not change it, but a terminating newline gets pasted on the end)
Comment 1 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-09-08 15:05:56 UTC
This is a deliberate design decision by gedit's creators - see https://bugzilla.gnome.org/show_bug.cgi?id=625955

By default, a last newline is always added because gedit's creators assume that's what you usually want (and for C-like languages and common config files, it probably is what most users usually want).

If you are editing php code or some other file type where last newlines are undesirable, you can change gedit's behavior using 2 methods:

* gui: open dconf-editor, disable org → gnome → gedit → preferences → editor → ensure-trailing-newline

* command line: gsettings set org.gnome.gedit.preferences.editor ensure-trailing-newline false

If you think this option should easier to find, or that the default behavior should be different - please tell that to gedit upstream developers.
Comment 2 Raymond Jennings 2015-09-09 03:19:11 UTC
I checked upstream and they already got chewed out by quite a few users.  They stubbornly refused to back down.

Easy workaround so closing.