You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Defaults to CRLF line endings instead of LF on Unix systems #772
I love using edit on Arch as a replacement to nano. However, the one issue I have with it is that when making new files, it will use Windows line endings (CRLF) instead of Unix line endings (LF). This has caused me to make config files and then get weird errors and have to figure out I had to run dos2unix on them to fix them.
The worst offender was when I installed doas and I had no idea why it wasn't working without having a single clue that /etc/doas.conf which I created with edit had CRLF line endings.
A fix would be to either have some sort of config to select which kind of line endings to use, or just default to LF line endings on Unix. Or both.
I have a reproducible scenario. I'm using the msedit package on Arch Linux for context.
I do msedit test.txt and write whatever text inside it. It indeed says [LF] at the bottom. I save and exit with CTRL+Q.
I then do msedit test.txt again and now the bottom bar says [CRLF] instead of [LF]. I add some more text, save and quit again.
Then running file test.txt will say "test.txt: ASCII text, with CRLF, LF line terminators"
Edited because I didn't finish writing the first time lol
Activity
DHowett commentedon Mar 18, 2026
Hmm. It's supposed to default to LF line endings on all non-Windows platforms:
edit/crates/edit/src/buffer/mod.rs
Line 312 in ff45b14
Which matches the behavior I see when I launch it anew on Linux:
On all platforms: If you're opening an existing file, it will follow the dominant newline format it finds in that file.
edit/crates/edit/src/buffer/mod.rs
Lines 789 to 790 in ff45b14
ItzELECTR0 commentedon Mar 18, 2026
Yes if a file is already LF then edit won't overwrite that but for me when making new files they are saved with CRLF by default for some reason.
ItzELECTR0 commentedon Mar 18, 2026
I have a reproducible scenario. I'm using the msedit package on Arch Linux for context.
I do
msedit test.txtand write whatever text inside it. It indeed says [LF] at the bottom. I save and exit with CTRL+Q.I then do
msedit test.txtagain and now the bottom bar says [CRLF] instead of [LF]. I add some more text, save and quit again.Then running
file test.txtwill say "test.txt: ASCII text, with CRLF, LF line terminators"Edited because I didn't finish writing the first time lol
ItzELECTR0 commentedon Mar 18, 2026
Ok I just realized I contradicted myself. Ok so it creates them as LF but overwrites as CRLF.
But that's still an issue.
DHowett commentedon Mar 18, 2026
Uh, horrifyingly, it doesn't reproduce in
mainand it was (according to a bisect) fixed in #741. Leonard Hecker (@lhecker) watItzELECTR0 commentedon Mar 18, 2026
Can confirm it's still going on with the
mseditpackage from theextrarepo on Arch, version being1.2.1-2lhecker commentedon Mar 19, 2026
Is there any particular content you're typing into? Or are you pasting into the editor something particular? I seem unable to reproduce this issue.
DHowett commentedon Mar 19, 2026
LOL, no, my bisect run sucked.
We fixed this in #739.
ItzELECTR0 commentedon Mar 19, 2026
Nope, just about any file. I'm not pasting either, just typing.