fix eofnewline not running on files with 1 rune (#1535)

This commit is contained in:
josh
2020-02-25 03:26:51 +00:00
committed by GitHub
parent 70bcf9f618
commit 25b9342fbe

View File

@@ -111,7 +111,7 @@ func (b *Buffer) saveToFile(filename string, withSudo bool) error {
if b.Settings["eofnewline"].(bool) {
end := b.End()
if b.RuneAt(Loc{end.X - 1, end.Y}) != '\n' {
if b.RuneAt(Loc{end.X, end.Y}) != '\n' {
b.Insert(end, "\n")
}
}