mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-11 15:12:47 +09:00
Fixed newline format detection for files not ending with a newline (#2875)
* Fixed newline format detection for files not ending with a newline Files with Windows-style line endings were being converted to Unix-style if the file did not end with a newline * Updated file format detection fix for consistency
This commit is contained in:
@@ -116,12 +116,12 @@ func NewLineArray(size uint64, endings FileFormat, reader io.Reader) *LineArray
|
||||
dlen := len(data)
|
||||
if dlen > 1 && data[dlen-2] == '\r' {
|
||||
data = append(data[:dlen-2], '\n')
|
||||
if endings == FFAuto {
|
||||
if la.Endings == FFAuto {
|
||||
la.Endings = FFDos
|
||||
}
|
||||
dlen = len(data)
|
||||
} else if dlen > 0 {
|
||||
if endings == FFAuto {
|
||||
if la.Endings == FFAuto {
|
||||
la.Endings = FFUnix
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user