From 265d7e121ad5696fc9837eb98b913398cab6a08c Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sat, 1 Sep 2018 13:06:53 +0200 Subject: [PATCH] use Key if it's a rune, otherwise KeyReadable --- pkg/gui/help_panel.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/gui/help_panel.go b/pkg/gui/help_panel.go index 81cc712b5..f463de624 100644 --- a/pkg/gui/help_panel.go +++ b/pkg/gui/help_panel.go @@ -54,8 +54,17 @@ func (gui *Gui) handleHelp(g *gocui.Gui, v *gocui.View) error { bindings := gui.getKeybindings() for _, binding := range bindings { - if binding.ViewName == v.Name() && binding.Description != "" && binding.KeyReadable != "" { - content += fmt.Sprintf(" %s - %s\n", binding.KeyReadable, binding.Description) + r, ok := binding.Key.(rune) + key := "" + + if ok { + key = string(r) + } else if binding.KeyReadable != "" { + key = binding.KeyReadable + } + + if key != "" && binding.ViewName == v.Name() && binding.Description != "" { + content += fmt.Sprintf(" %s - %s\n", key, binding.Description) keys = append(keys, binding) } }