Add hidehelp support

This commit is contained in:
Zachary Yedidia
2019-06-15 16:13:04 -04:00
parent 995e1dc704
commit c93d7a1b35
4 changed files with 26 additions and 16 deletions

View File

@@ -107,6 +107,9 @@ type Buffer struct {
CurSuggestion int
Messages []*Message
StatusFormatLeft string
StatusFormatRight string
}
// NewBufferFromFile opens a new buffer using the given path
@@ -236,11 +239,25 @@ func NewBuffer(r io.Reader, size int64, path string, cursorPosition []string, bt
screen.TermMessage(err)
}
b.SetStatusFormat()
OpenBuffers = append(OpenBuffers, b)
return b
}
// SetStatusFormat will correctly set the format string for the
// status line
func (b *Buffer) SetStatusFormat() {
if b.Settings["hidehelp"].(bool) {
b.StatusFormatLeft = "$(filename) $(modified)($(line),$(col)) $(opt:filetype) $(opt:fileformat) $(opt:encoding)"
b.StatusFormatRight = ""
} else {
b.StatusFormatLeft = "$(filename) $(modified)($(line),$(col)) $(opt:filetype) $(opt:fileformat) $(opt:encoding)"
b.StatusFormatRight = "$(bind:ToggleKeyMenu): show bindings, $(bind:ToggleHelp): toggle help"
}
}
// Close removes this buffer from the list of open buffers
func (b *Buffer) Close() {
for i, buf := range OpenBuffers {