~ghost08/libphoton

4b6ea95b57ad66f20e94d5c2db6f440250fa7350 — VladimĂ­r Magyar 2 years ago eba352a
Add special keys to keybindings
1 files changed, 12 insertions(+), 1 deletions(-)

M keybindings/keybindings.go
M keybindings/keybindings.go => keybindings/keybindings.go +12 -1
@@ 18,7 18,18 @@ type KeyEvent struct {
}

func (s KeyEvent) String() string {
	return s.Modifiers.String() + string(s.Key)
	k := string(s.Key)
	switch s.Key {
	case '\u0008':
		k = "<backspace>"
	case '\t':
		k = "<tab>"
	case '\u00b1':
		k = "<esc>"
	case '\n':
		k = "<enter>"
	}
	return s.Modifiers.String() + k
}

type KeyEvents []KeyEvent