summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-05-18 22:25:09 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-05-18 22:25:09 +0900
commitc62fc5e75c09262a384e703800fefa6850afa2e8 (patch)
tree3581185044fc958efec239e98b5873cee5da5378 /src
parent70245ad98cb3fa8d2c13b882e615317488ccbdc0 (diff)
More named keys: F5 ~ F10, ALT-/
Diffstat (limited to 'src')
-rw-r--r--src/curses/curses.go33
-rw-r--r--src/options.go6
2 files changed, 38 insertions, 1 deletions
diff --git a/src/curses/curses.go b/src/curses/curses.go
index 0ad382bd..a0240da9 100644
--- a/src/curses/curses.go
+++ b/src/curses/curses.go
@@ -80,9 +80,16 @@ const (
F2
F3
F4
+ F5
+ F6
+ F7
+ F8
+ F9
+ F10
AltEnter
AltSpace
+ AltSlash
AltBS
AltA
AltB
@@ -423,6 +430,8 @@ func escSequence(sz *int) Event {
return Event{AltEnter, 0, nil}
case 32:
return Event{AltSpace, 0, nil}
+ case 47:
+ return Event{AltSlash, 0, nil}
case 98:
return Event{AltB, 0, nil}
case 100:
@@ -468,6 +477,15 @@ func escSequence(sz *int) Event {
*sz = 4
switch _buf[2] {
case 50:
+ if len(_buf) == 5 && _buf[4] == 126 {
+ *sz = 5
+ switch _buf[3] {
+ case 48:
+ return Event{F9, 0, nil}
+ case 49:
+ return Event{F10, 0, nil}
+ }
+ }
return Event{Invalid, 0, nil} // INS
case 51:
return Event{Del, 0, nil}
@@ -481,6 +499,21 @@ func escSequence(sz *int) Event {
switch _buf[3] {
case 126:
return Event{Home, 0, nil}
+ case 53, 55, 56, 57:
+ if len(_buf) == 5 && _buf[4] == 126 {
+ *sz = 5
+ switch _buf[3] {
+ case 53:
+ return Event{F5, 0, nil}
+ case 55:
+ return Event{F6, 0, nil}
+ case 56:
+ return Event{F7, 0, nil}
+ case 57:
+ return Event{F8, 0, nil}
+ }
+ }
+ return Event{Invalid, 0, nil}
case 59:
if len(_buf) != 6 {
return Event{Invalid, 0, nil}
diff --git a/src/options.go b/src/options.go
index 089b4c2f..10a22287 100644
--- a/src/options.go
+++ b/src/options.go
@@ -322,6 +322,8 @@ func parseKeyChords(str string, message string) map[int]string {
chord = curses.AltEnter
case "alt-space":
chord = curses.AltSpace
+ case "alt-/":
+ chord = curses.AltSlash
case "alt-bs", "alt-bspace":
chord = curses.AltBS
case "tab":
@@ -346,12 +348,14 @@ func parseKeyChords(str string, message string) map[int]string {
chord = curses.SRight
case "double-click":
chord = curses.DoubleClick
+ case "f10":
+ chord = curses.F10
default:
if len(key) == 6 && strings.HasPrefix(lkey, "ctrl-") && isAlphabet(lkey[5]) {
chord = curses.CtrlA + int(lkey[5]) - 'a'
} else if len(key) == 5 && strings.HasPrefix(lkey, "alt-") && isAlphabet(lkey[4]) {
chord = curses.AltA + int(lkey[4]) - 'a'
- } else if len(key) == 2 && strings.HasPrefix(lkey, "f") && key[1] >= '1' && key[1] <= '4' {
+ } else if len(key) == 2 && strings.HasPrefix(lkey, "f") && key[1] >= '1' && key[1] <= '9' {
chord = curses.F1 + int(key[1]) - '1'
} else if utf8.RuneCountInString(key) == 1 {
chord = curses.AltZ + int([]rune(key)[0])