From f1f28018a6b60007cff235861afefb5c36ea302f Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Fri, 4 Sep 2020 23:59:20 +0300 Subject: [PATCH] add missing keys for push command Related #445 --- ui.go | 176 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 120 insertions(+), 56 deletions(-) diff --git a/ui.go b/ui.go index 9065cb4..451a4fd 100644 --- a/ui.go +++ b/ui.go @@ -22,62 +22,124 @@ import ( const gEscapeCode = 27 var gKeyVal = map[tcell.Key]string{ - tcell.KeyF1: "", - tcell.KeyF2: "", - tcell.KeyF3: "", - tcell.KeyF4: "", - tcell.KeyF5: "", - tcell.KeyF6: "", - tcell.KeyF7: "", - tcell.KeyF8: "", - tcell.KeyF9: "", - tcell.KeyF10: "", - tcell.KeyF11: "", - tcell.KeyF12: "", - tcell.KeyInsert: "", - tcell.KeyDelete: "", - tcell.KeyHome: "", - tcell.KeyEnd: "", - tcell.KeyPgUp: "", - tcell.KeyPgDn: "", - tcell.KeyUp: "", - tcell.KeyDown: "", - tcell.KeyLeft: "", - tcell.KeyRight: "", - tcell.KeyCtrlSpace: "", - tcell.KeyCtrlA: "", - tcell.KeyCtrlB: "", - tcell.KeyCtrlC: "", - tcell.KeyCtrlD: "", - tcell.KeyCtrlE: "", - tcell.KeyCtrlF: "", - tcell.KeyCtrlG: "", - tcell.KeyBackspace: "", - tcell.KeyTab: "", - tcell.KeyCtrlJ: "", - tcell.KeyCtrlK: "", - tcell.KeyCtrlL: "", - tcell.KeyEnter: "", - tcell.KeyCtrlN: "", - tcell.KeyCtrlO: "", - tcell.KeyCtrlP: "", - tcell.KeyCtrlQ: "", - tcell.KeyCtrlR: "", - tcell.KeyCtrlS: "", - tcell.KeyCtrlT: "", - tcell.KeyCtrlU: "", - tcell.KeyCtrlV: "", - tcell.KeyCtrlW: "", - tcell.KeyCtrlX: "", - tcell.KeyCtrlY: "", - tcell.KeyCtrlZ: "", - tcell.KeyEsc: "", - tcell.KeyCtrlBackslash: "", - tcell.KeyCtrlRightSq: "", - // TODO: compatability only, they are discouraged - tcell.KeyCtrlCarat: "", - tcell.KeyCtrlUnderscore: "", - tcell.KeyBackspace2: "", + tcell.KeyEnter: "", + tcell.KeyBackspace: "", + tcell.KeyTab: "", + tcell.KeyBacktab: "", + tcell.KeyEsc: "", + tcell.KeyBackspace2: "", + tcell.KeyDelete: "", + tcell.KeyInsert: "", + tcell.KeyUp: "", + tcell.KeyDown: "", + tcell.KeyLeft: "", + tcell.KeyRight: "", + tcell.KeyHome: "", + tcell.KeyEnd: "", + tcell.KeyUpLeft: "", + tcell.KeyUpRight: "", + tcell.KeyDownLeft: "", + tcell.KeyDownRight: "", + tcell.KeyCenter: "
", + tcell.KeyPgDn: "", + tcell.KeyPgUp: "", + tcell.KeyClear: "", + tcell.KeyExit: "", + tcell.KeyCancel: "", + tcell.KeyPause: "", + tcell.KeyPrint: "", + tcell.KeyF1: "", + tcell.KeyF2: "", + tcell.KeyF3: "", + tcell.KeyF4: "", + tcell.KeyF5: "", + tcell.KeyF6: "", + tcell.KeyF7: "", + tcell.KeyF8: "", + tcell.KeyF9: "", + tcell.KeyF10: "", + tcell.KeyF11: "", + tcell.KeyF12: "", + tcell.KeyF13: "", + tcell.KeyF14: "", + tcell.KeyF15: "", + tcell.KeyF16: "", + tcell.KeyF17: "", + tcell.KeyF18: "", + tcell.KeyF19: "", + tcell.KeyF20: "", + tcell.KeyF21: "", + tcell.KeyF22: "", + tcell.KeyF23: "", + tcell.KeyF24: "", + tcell.KeyF25: "", + tcell.KeyF26: "", + tcell.KeyF27: "", + tcell.KeyF28: "", + tcell.KeyF29: "", + tcell.KeyF30: "", + tcell.KeyF31: "", + tcell.KeyF32: "", + tcell.KeyF33: "", + tcell.KeyF34: "", + tcell.KeyF35: "", + tcell.KeyF36: "", + tcell.KeyF37: "", + tcell.KeyF38: "", + tcell.KeyF39: "", + tcell.KeyF40: "", + tcell.KeyF41: "", + tcell.KeyF42: "", + tcell.KeyF43: "", + tcell.KeyF44: "", + tcell.KeyF45: "", + tcell.KeyF46: "", + tcell.KeyF47: "", + tcell.KeyF48: "", + tcell.KeyF49: "", + tcell.KeyF50: "", + tcell.KeyF51: "", + tcell.KeyF52: "", + tcell.KeyF53: "", + tcell.KeyF54: "", + tcell.KeyF55: "", + tcell.KeyF56: "", + tcell.KeyF57: "", + tcell.KeyF58: "", + tcell.KeyF59: "", + tcell.KeyF60: "", + tcell.KeyF61: "", + tcell.KeyF62: "", + tcell.KeyF63: "", + tcell.KeyF64: "", + tcell.KeyCtrlA: "", + tcell.KeyCtrlB: "", + tcell.KeyCtrlC: "", + tcell.KeyCtrlD: "", + tcell.KeyCtrlE: "", + tcell.KeyCtrlF: "", + tcell.KeyCtrlG: "", + tcell.KeyCtrlJ: "", + tcell.KeyCtrlK: "", + tcell.KeyCtrlL: "", + tcell.KeyCtrlN: "", + tcell.KeyCtrlO: "", + tcell.KeyCtrlP: "", + tcell.KeyCtrlQ: "", + tcell.KeyCtrlR: "", + tcell.KeyCtrlS: "", + tcell.KeyCtrlT: "", + tcell.KeyCtrlU: "", + tcell.KeyCtrlV: "", + tcell.KeyCtrlW: "", + tcell.KeyCtrlX: "", + tcell.KeyCtrlY: "", + tcell.KeyCtrlZ: "", + tcell.KeyCtrlSpace: "", + tcell.KeyCtrlUnderscore: "", + tcell.KeyCtrlRightSq: "", + tcell.KeyCtrlBackslash: "", + tcell.KeyCtrlCarat: "", } var gValKey map[string]tcell.Key @@ -822,6 +884,8 @@ func (ui *ui) pollEvent() tcell.Event { ch = '<' case val == "": ch = '>' + case val == "": + ch = ' ' case reAltKey.MatchString(val): match := reAltKey.FindStringSubmatch(val)[1] ch, _ = utf8.DecodeRuneInString(match)