From df968db5a3f8efd789584c241e25c39c5ce57e56 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 15 Jan 2019 17:10:13 -0500 Subject: [PATCH] Proper help toggle --- cmd/micro/action/actions.go | 10 +++++++--- cmd/micro/display/bufwindow.go | 2 ++ cmd/micro/display/statusline.go | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/micro/action/actions.go b/cmd/micro/action/actions.go index e41ad051..ade2f0d5 100644 --- a/cmd/micro/action/actions.go +++ b/cmd/micro/action/actions.go @@ -1001,13 +1001,17 @@ func (h *BufHandler) ClearStatus() bool { // ToggleHelp toggles the help screen func (h *BufHandler) ToggleHelp() bool { - h.openHelp("help") - return true + if h.Buf.Type == buffer.BTHelp { + h.Quit() + } else { + h.openHelp("help") + } + return false } // ToggleKeyMenu toggles the keymenu option and resizes all tabs func (h *BufHandler) ToggleKeyMenu() bool { - return true + return false } // ShellMode opens a terminal to run a shell command diff --git a/cmd/micro/display/bufwindow.go b/cmd/micro/display/bufwindow.go index a5a677db..ef532c56 100644 --- a/cmd/micro/display/bufwindow.go +++ b/cmd/micro/display/bufwindow.go @@ -57,6 +57,8 @@ func (v *View) SetView(view *View) { func (w *BufWindow) Resize(width, height int) { w.Width, w.Height = width, height w.lineHeight = make([]int, height) + // This recalculates lineHeight + w.GetMouseLoc(buffer.Loc{width, height}) } func (w *BufWindow) SetActive(b bool) { diff --git a/cmd/micro/display/statusline.go b/cmd/micro/display/statusline.go index 435b9968..e4a26913 100644 --- a/cmd/micro/display/statusline.go +++ b/cmd/micro/display/statusline.go @@ -32,7 +32,7 @@ func NewStatusLine(win *BufWindow) *StatusLine { s := new(StatusLine) s.FormatLeft = "$(filename) $(modified)($(line),$(col)) $(opt:filetype) $(opt:fileformat)" // s.FormatLeft = "$(filename) $(modified)(line,col) $(opt:filetype) $(opt:fileformat)" - s.FormatRight = "$(bind:ToggleKeyMenu): show bindings, $(bind:ToggleHelp): open help" + s.FormatRight = "$(bind:ToggleKeyMenu): show bindings, $(bind:ToggleHelp): toggle help" s.Info = map[string]func(*buffer.Buffer) string{ "filename": func(b *buffer.Buffer) string { if b.Settings["basename"].(bool) {