After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658891 - gedit doesn't display an empty last line
gedit doesn't display an empty last line
Status: RESOLVED DUPLICATE of bug 324942
Product: gedit
Classification: Applications
Component: general
3.1.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
: 658890 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-09-13 09:06 UTC by Jean-Philippe Fleury
Modified: 2011-09-13 17:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jean-Philippe Fleury 2011-09-13 09:06:33 UTC
1) Create a file in a terminal:

$ echo a > test.txt

The command `echo` automatically adds an newline, so the file size is 2 bytes:

$ stat -c %s test.txt 
2
$ cat test.txt
a
$

See the newline displayed by `cat` after the character "a".

2) Open "test.txt" with gedit.

Actual result: gedit displays only 1 line:

1 a

Expected result: gedit should display 2 lines:

1 a
2

Note that the editors Geany and Leafpad display 2 lines.
Comment 1 Jean-Philippe Fleury 2011-09-13 09:07:03 UTC
May be related to bug 658890
Comment 2 Ignacio Casal Quinteiro (nacho) 2011-09-13 09:28:06 UTC
*** Bug 658890 has been marked as a duplicate of this bug. ***
Comment 3 Ignacio Casal Quinteiro (nacho) 2011-09-13 09:31:29 UTC
I'm pretty sure this is also a dup but I can't find the bug. Anyway this behavior is on purpose. The reason for this is that without it apps like cat would break. Other text editors do this too so it is the less problematic way to deal with this.
Comment 4 Jean-Philippe Fleury 2011-09-13 17:32:45 UTC
(In reply to comment #3)
> I'm pretty sure this is also a dup but I can't find the bug.

I think you refer to bug 324942

gedit automatically adds an empty last line (to don't have problem with some command line tools), so it doesn't display it because even if the user removes it, the empty last line will be added again when saving.

I understand why gedit behaves like this, even if I don't feel very comfortable with the fact that gedit hides me something. IMHO, if there's an empty last line, gedit should display it, because it's part of the content.

Regards.

*** This bug has been marked as a duplicate of bug 324942 ***