Add statusline option

Fixes #105
This commit is contained in:
Zachary Yedidia
2016-05-15 13:44:07 -04:00
parent e2efc963b7
commit aa8944304b
4 changed files with 21 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -78,6 +78,7 @@ func DefaultSettings() map[string]interface{} {
"syntax": true,
"tabsToSpaces": false,
"ruler": true,
"statusline": true,
}
}
@@ -117,6 +118,10 @@ func SetOption(view *View, args []string) {
view.Buf.UpdateRules()
}
if option == "statusline" {
view.Resize(screen.Size())
}
err := WriteSettings(filename)
if err != nil {
messenger.Error("Error writing to settings.json: " + err.Error())

View File

@@ -110,7 +110,11 @@ func (v *View) Resize(w, h int) {
h--
v.width = int(float32(w) * float32(v.widthPercent) / 100)
// We subtract 1 for the statusline
v.height = int(float32(h)*float32(v.heightPercent)/100) - 1
v.height = int(float32(h) * float32(v.heightPercent) / 100)
if settings["statusline"].(bool) {
// Make room for the status line if it is enabled
v.height--
}
}
// ScrollUp scrolls the view up n lines (if possible)
@@ -581,5 +585,7 @@ func (v *View) DisplayView() {
func (v *View) Display() {
v.DisplayView()
v.Cursor.Display()
v.sline.Display()
if settings["statusline"].(bool) {
v.sline.Display()
}
}

View File

@@ -195,6 +195,10 @@ Here are the options that you can set:
default value: `on`
* `statusline`: display the status line at the bottom of the screen
default value: `on`
---
Default plugin options: