From 9f40da41fcb7da431efa44c63a70f1de29409ec5 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 7 Jan 2015 11:22:25 +0900 Subject: [PATCH] Add backspace (not tested) --- genkeys.go | 2 ++ internal/ui/keys.go | 1 + internal/ui/keys_glfw.go | 1 + internal/ui/keys_js.go | 1 + keys.go | 1 + 5 files changed, 6 insertions(+) diff --git a/genkeys.go b/genkeys.go index 9a755f037..add2b9daf 100644 --- a/genkeys.go +++ b/genkeys.go @@ -55,6 +55,8 @@ func init() { 0x27: "Right", 0x26: "Up", 0x1B: "Escape", + // The keys not listed in the Mozilla site: + 0x08: "Backspace", } // ASCII: 0 - 9 for c := '0'; c <= '9'; c++ { diff --git a/internal/ui/keys.go b/internal/ui/keys.go index 5a7871b5f..141eb8d06 100644 --- a/internal/ui/keys.go +++ b/internal/ui/keys.go @@ -53,6 +53,7 @@ const ( KeyX KeyY KeyZ + KeyBackspace KeyCapsLock KeyComma KeyDelete diff --git a/internal/ui/keys_glfw.go b/internal/ui/keys_glfw.go index ffbda0165..ea22a8654 100644 --- a/internal/ui/keys_glfw.go +++ b/internal/ui/keys_glfw.go @@ -57,6 +57,7 @@ var glfwKeyCodeToKey = map[glfw.Key]Key{ glfw.KeyX: KeyX, glfw.KeyY: KeyY, glfw.KeyZ: KeyZ, + glfw.KeyBackspace: KeyBackspace, glfw.KeyCapsLock: KeyCapsLock, glfw.KeyComma: KeyComma, glfw.KeyDelete: KeyDelete, diff --git a/internal/ui/keys_js.go b/internal/ui/keys_js.go index e33334de1..e3b006e58 100644 --- a/internal/ui/keys_js.go +++ b/internal/ui/keys_js.go @@ -17,6 +17,7 @@ package ui var keyCodeToKey = map[int]Key{ + 8: KeyBackspace, 9: KeyTab, 13: KeyEnter, 16: KeyLeftShift, diff --git a/keys.go b/keys.go index f07f21ea3..14d668a5b 100644 --- a/keys.go +++ b/keys.go @@ -59,6 +59,7 @@ const ( KeyX = Key(ui.KeyX) KeyY = Key(ui.KeyY) KeyZ = Key(ui.KeyZ) + KeyBackspace = Key(ui.KeyBackspace) KeyCapsLock = Key(ui.KeyCapsLock) KeyComma = Key(ui.KeyComma) KeyDelete = Key(ui.KeyDelete)