Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank line at end-of-file not displayed #61

Open
markfilipak opened this issue Dec 12, 2016 · 20 comments
Open

Blank line at end-of-file not displayed #61

markfilipak opened this issue Dec 12, 2016 · 20 comments
Labels

Comments

@markfilipak
Copy link

When opening a text file, xed is not displaying the ending \x0D\x0A (blank line at the end of the file). The visible cursor cannot be 'pushed' past the end of the last populated line. If I add an end-of-line at the end-of-file, the file winds up with 2 blank lines at the end-of-file.

Please display the entire file as it exists. Don't "beautify" it.

@JosephMcc JosephMcc added the BUG label Dec 12, 2016
@e-james
Copy link

e-james commented Jan 16, 2017

I'm new to xed and I only noticed the bug described above when I discovered that, with one particular file, I couldn't see the last line of text until I started editing. The file is available for examination if requested.

@JosephMcc
Copy link
Contributor

@e-james would you mind sharing the file just so I can try to reproduce?

@e-james
Copy link

e-james commented Jan 19, 2017 via email

@JosephMcc
Copy link
Contributor

I don't see the attached file. I'd like to test this against some recent changes.

@e-james
Copy link

e-james commented Feb 10, 2017 via email

@e-james
Copy link

e-james commented Feb 10, 2017 via email

@markfilipak
Copy link
Author

markfilipak commented Feb 10, 2017

My version: xed version 1.0.6.

I don't see the problem, e-james. I don't know what to make of this
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH HJKKKKKKKKKKKKKKKKKKKKKKK---------PENULTIMATE LINE -----------KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
#HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH HJKKKKKKKKKKKKKKKKKKKKKKKK------- LAST LINE----------KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK-01-2017_0215.mpg-na.avi"

What is it that you experienced?

What I experienced that led me to submit this (as a bug?) was different.

@e-james
Copy link

e-james commented Feb 10, 2017 via email

@markfilipak
Copy link
Author

markfilipak commented Feb 10, 2017

Okay. I reproduced my problem with xed. I took e-james's file and added \x0D\x0A (i.e., end-of-file) to it. Now, the file past the line ending
KKK------- LAST LINE---------
is not visible (see attachment). Further, there should be 10 dashes (-) at the end of the line that I copied (above), not 9 (as shown above) -- so the cursor is not being placed properly either.
virtualbox_mint_10_02_2017_14_32_13
By the way, I captured the '.png' attached using VirtualBox's screen capture because the usual screen capture application (gnome-screenshot) doesn't work in my system.

@markfilipak
Copy link
Author

markfilipak commented Feb 10, 2017

By the way...
Whenever I attempt to overwrite an existing file, I get this (see screenshot -- again, made with VirtualBox screen shot because gnome-screenshot doesn't work ... sigh, so many bugs in Linux...)
virtualbox_mint_10_02_2017_14_48_46

@markfilipak
Copy link
Author

One more comment. From the replies in this thread, it appears that e-james's submittals were via email -- is that right, e-james? If so, it appears that e-james's attachment (via email) didn't wind up as an attachment here. I suggest that, if all that I've written is true, the proprietors of this github project submit it as a bug to the github site-maintainers. (Just trying to be a good net-citizen here, not trying to cast blame. Peace.)

@e-james
Copy link

e-james commented Feb 11, 2017 via email

@eev2
Copy link

eev2 commented Mar 2, 2017

You don't need any special file. In the terminal type

$ cat << EOF > test.txt
1
2
3
EOF

Then open text.txt with xed and with another editor, e.g. emacs. With xed the cursor cannot move beyond the third line because xed is hiding the final new line. With other editors it can also go to the fourth line. This behavior of xed can be frustrating if you are copy/pasting code, it won't copy the final new line. I believe this issue was originated from gedit 2
https://bugzilla.gnome.org/show_bug.cgi?id=625955

@JosephMcc
Copy link
Contributor

@eev2 That problem is solvable now in xed master. There is a gsettings key you can set the same as in gedit. Just turn off ensure-trailing-newline

@InfoLibre
Copy link

InfoLibre commented Oct 31, 2019

I have the same bug with xed 2.2.3. For example, when I open the file version.txt that ends with a CR+LF, the cursor remains just after the last } instead of being one line under }.
CRLF-Xed

The cursor is correctly shown in Geany and mcedit.
CRLF-mcedit
CRLF-Geany

version.txt

@InfoLibre
Copy link

InfoLibre commented Dec 10, 2019

I think Geany solution is the best : showing CR and/or LF as icons at the end of each line and showing the cursor where new typing will go (at the end of the last line or at the end of a new line, as you want). And only CR/LF ICONS are registered, the position of the cursor doesn't matter and is not registered.

Then, you don't need anymore to ask yourself where to place the cursor when the line ends with CR and/or LF.

@InfoLibre
Copy link

InfoLibre commented Dec 10, 2019

By the way, is xed able to use https://editorconfig.org configuration file ?

@jondo
Copy link

jondo commented Dec 4, 2021

I can reproduce this problem in xed 3.0.2 with a file created by

echo "with trailing newline" > test.txt

Note that the issue only appears when prefereces > Save > "Ensure Trailing Newline" is active (which it probably is by default). So I needed to switch this off as a workaround - which is a pity, because I would like to use this 'ensuring' feature at the same time as having the line displayed.

@InfoLibre
Copy link

This bug seems to be solved in xed 3.4.5. Someone else can confirm?

@ergonomicus
Copy link

This bug seems to be solved in xed 3.4.5. Someone else can confirm?

No, still the same on Linux Mint (xed 3.4.5). When "Ensure Trailing Newline" is on, last line (new line) gets deleted on save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants