Add infobar option to disable the message line

Fixes #257
This commit is contained in:
Zachary Yedidia
2016-08-31 11:16:22 -04:00
parent 3105205ab8
commit b70db77c29
7 changed files with 31 additions and 8 deletions

View File

@@ -347,6 +347,9 @@ func (m *Messenger) DisplaySuggestions(suggestions []string) {
func (m *Messenger) Display() {
_, h := screen.Size()
if m.hasMessage {
if !m.hasPrompt {
return
}
runes := []rune(m.message + m.response)
for x := 0; x < len(runes); x++ {
screen.SetContent(x, h-1, runes[x], nil, m.style)

File diff suppressed because one or more lines are too long

View File

@@ -169,6 +169,7 @@ func DefaultGlobalSettings() map[string]interface{} {
"cursorline": true,
"ignorecase": false,
"indentchar": " ",
"infobar": true,
"ruler": true,
"savecursor": false,
"saveundo": false,
@@ -244,6 +245,12 @@ func SetOption(option, value string) error {
}
}
if option == "infobar" {
for _, tab := range tabs {
tab.Resize()
}
}
if _, ok := CurView().Buf.Settings[option]; ok {
for _, tab := range tabs {
for _, view := range tab.views {

View File

@@ -146,9 +146,7 @@ func (s *SplitTree) ResizeSplits() {
n.view.y = s.y + n.view.height*i
n.view.x = s.x
}
// n.view.ToggleStatusLine()
_, screenH := screen.Size()
if n.view.Buf.Settings["statusline"].(bool) || (n.view.y+n.view.height) != screenH-1 {
if n.view.Buf.Settings["statusline"].(bool) {
n.view.height--
}

View File

@@ -31,7 +31,12 @@ func NewTabFromView(v *View) *Tab {
w, h := screen.Size()
t.tree.width = w
t.tree.height = h - 1
t.tree.height = h
if globalSettings["infobar"].(bool) {
t.tree.height--
}
return t
}
@@ -49,7 +54,12 @@ func (t *Tab) Cleanup() {
func (t *Tab) Resize() {
w, h := screen.Size()
t.tree.width = w
t.tree.height = h - 1
t.tree.height = h
if globalSettings["infobar"].(bool) {
t.tree.height--
}
t.tree.ResizeSplits()
}

View File

@@ -84,7 +84,7 @@ type View struct {
// NewView returns a new fullscreen view
func NewView(buf *Buffer) *View {
screenW, screenH := screen.Size()
return NewViewWidthHeight(buf, screenW, screenH-1)
return NewViewWidthHeight(buf, screenW, screenH)
}
// NewViewWidthHeight returns a new view with the specified width and height

View File

@@ -31,6 +31,11 @@ Here are the options that you can set:
default value: ` `
* `infobar`: enables the line at the bottom of the editor where messages are printed.
This option is `global only`.
default value: `on`
* `filetype`: sets the filetype for the current buffer. This setting is `local only`
default value: this will be automatically set depending on the file you have open