From 0b871e174f3ce81f934ce0875d7f2b4ee93db788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6ran=20Karl?= <3951388+JoeKar@users.noreply.github.com> Date: Thu, 23 May 2024 23:18:56 +0200 Subject: [PATCH] backup: Store the file with the endings of the buffer --- internal/buffer/backup.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/buffer/backup.go b/internal/buffer/backup.go index 0e254053..62e692db 100644 --- a/internal/buffer/backup.go +++ b/internal/buffer/backup.go @@ -87,7 +87,12 @@ func (b *Buffer) Backup() error { } // end of line - eol := []byte{'\n'} + var eol []byte + if b.Endings == FFDos { + eol = []byte{'\r', '\n'} + } else { + eol = []byte{'\n'} + } // write lines if _, e = file.Write(b.lines[0].data); e != nil {