mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 05:47:06 +09:00
line_array insert for eofnewline and make default
Makes the `eofnewline` option enabled by default. Fixes #1525
This commit is contained in:
@@ -112,7 +112,7 @@ func (b *Buffer) saveToFile(filename string, withSudo bool) error {
|
|||||||
if b.Settings["eofnewline"].(bool) {
|
if b.Settings["eofnewline"].(bool) {
|
||||||
end := b.End()
|
end := b.End()
|
||||||
if b.RuneAt(Loc{end.X, end.Y}) != '\n' {
|
if b.RuneAt(Loc{end.X, end.Y}) != '\n' {
|
||||||
b.Insert(end, "\n")
|
b.insert(end, []byte{'\n'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ var defaultCommonSettings = map[string]interface{}{
|
|||||||
"cursorline": true,
|
"cursorline": true,
|
||||||
"diffgutter": false,
|
"diffgutter": false,
|
||||||
"encoding": "utf-8",
|
"encoding": "utf-8",
|
||||||
"eofnewline": false,
|
"eofnewline": true,
|
||||||
"fastdirty": false,
|
"fastdirty": false,
|
||||||
"fileformat": "unix",
|
"fileformat": "unix",
|
||||||
"filetype": "unknown",
|
"filetype": "unknown",
|
||||||
|
|||||||
@@ -85,9 +85,10 @@ Here are the available options:
|
|||||||
|
|
||||||
default value: `utf-8`
|
default value: `utf-8`
|
||||||
|
|
||||||
* `eofnewline`: micro will automatically add a newline to the file.
|
* `eofnewline`: micro will automatically add a newline to the end of the
|
||||||
|
file if one does not exist.
|
||||||
|
|
||||||
default value: `false`
|
default value: `true`
|
||||||
|
|
||||||
* `fastdirty`: this determines what kind of algorithm micro uses to determine
|
* `fastdirty`: this determines what kind of algorithm micro uses to determine
|
||||||
if a buffer is modified or not. When `fastdirty` is on, micro just uses a
|
if a buffer is modified or not. When `fastdirty` is on, micro just uses a
|
||||||
|
|||||||
Reference in New Issue
Block a user