]> git.lizzy.rs Git - micro.git/commitdiff
fix eofnewline not running on files with 1 rune (#1535)
authorjosh <josh@jrl.ninja>
Tue, 25 Feb 2020 03:26:51 +0000 (03:26 +0000)
committerGitHub <noreply@github.com>
Tue, 25 Feb 2020 03:26:51 +0000 (22:26 -0500)
internal/buffer/save.go

index 2fb410bdcb97b3a86476242d8545c7fbfba3b278..74b890ebbddaca4a225fd9505056f6f5ff44f8b8 100644 (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")
                }
        }