mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-27 11:20:25 +00:00
Fix bug that eofnewline does not work on save
This commit is contained in:
parent
2bc70890f0
commit
5b689a5592
1 changed files with 1 additions and 1 deletions
|
|
@ -283,13 +283,13 @@ func (b *Buffer) SaveAs(filename string) error {
|
|||
b.UpdateRules()
|
||||
dir, _ := homedir.Dir()
|
||||
b.Path = strings.Replace(filename, "~", dir, 1)
|
||||
str := b.String()
|
||||
if b.Settings["eofnewline"].(bool) {
|
||||
end := b.End()
|
||||
if b.RuneAt(Loc{end.X - 1, end.Y}) != '\n' {
|
||||
b.Insert(end, "\n")
|
||||
}
|
||||
}
|
||||
str := b.String()
|
||||
data := []byte(str)
|
||||
err := ioutil.WriteFile(filename, data, 0644)
|
||||
if err == nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue