mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 14:40:20 +09:00
Indicate correct help binding in status line
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
var bindings map[Key]func(*View) bool
|
||||
var helpBinding string
|
||||
|
||||
// The Key struct holds the data for a keypress (keycode + modifiers)
|
||||
type Key struct {
|
||||
@@ -251,14 +252,20 @@ func InitBindings() {
|
||||
} else {
|
||||
bindings[keys[k]] = actions[v]
|
||||
}
|
||||
if v == "ToggleHelp" {
|
||||
helpBinding = k
|
||||
}
|
||||
}
|
||||
for k, v := range parsed {
|
||||
if strings.Contains(k, "Alt-") {
|
||||
key := Key{tcell.KeyRune, tcell.ModAlt, rune(k[len(k)])}
|
||||
key := Key{tcell.KeyRune, tcell.ModAlt, rune(k[len(k)-1])}
|
||||
bindings[key] = actions[v]
|
||||
} else {
|
||||
bindings[keys[k]] = actions[v]
|
||||
}
|
||||
if v == "ToggleHelp" {
|
||||
helpBinding = k
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ func (sline *Statusline) Display() {
|
||||
// Add the filetype
|
||||
file += " " + sline.view.Buf.FileType
|
||||
|
||||
rightText := "Ctrl-g for help "
|
||||
rightText := helpBinding + " for help "
|
||||
if sline.view.helpOpen {
|
||||
rightText = "Ctrl-g to close help "
|
||||
rightText = helpBinding + " to close help "
|
||||
}
|
||||
|
||||
statusLineStyle := defStyle.Reverse(true)
|
||||
|
||||
Reference in New Issue
Block a user