More named keys: F5 ~ F10, ALT-/
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 70245ad · Browse files · 3 files·+42 added−1 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+42 added−1 removed
- tests:+4 added−0 removed
- other:+38 added−1 removed
Provenance
- Commit
c62fc5e- Tree
3581185- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
70245ad
3 files changed+42 added−1 removed
modified:src/curses/curses.go+33 added
78 unmodified lines79 F180 F281 F382 F483+ F584+ F685+ F786+ F887+ F988+ F1089 90 AltEnter91 AltSpace92+ AltSlash93 AltBS94 AltA95 AltB96 AltC332 unmodified lines429 case 13:430 return Event{AltEnter, 0, nil}431 case 32:432 return Event{AltSpace, 0, nil}433+ case 47:434+ return Event{AltSlash, 0, nil}435 case 98:436 return Event{AltB, 0, nil}437 case 100:438 return Event{AltD, 0, nil}37 unmodified lines476 }477 *sz = 4478 switch _buf[2] {479 case 50:480+ if len(_buf) == 5 && _buf[4] == 126 {481+ *sz = 5482+ switch _buf[3] {483+ case 48:484+ return Event{F9, 0, nil}485+ case 49:486+ return Event{F10, 0, nil}487+ }488+ }489 return Event{Invalid, 0, nil} // INS490 case 51:491 return Event{Del, 0, nil}492 case 52:5 unmodified lines498 case 49:499 switch _buf[3] {500 case 126:501 return Event{Home, 0, nil}502+ case 53, 55, 56, 57:503+ if len(_buf) == 5 && _buf[4] == 126 {504+ *sz = 5505+ switch _buf[3] {506+ case 53:507+ return Event{F5, 0, nil}508+ case 55:509+ return Event{F6, 0, nil}510+ case 56:511+ return Event{F7, 0, nil}512+ case 57:513+ return Event{F8, 0, nil}514+ }515+ }516+ return Event{Invalid, 0, nil}517 case 59:518 if len(_buf) != 6 {519 return Event{Invalid, 0, nil}520 }113 unmodified linesmodified:src/options.go+5 added-1 removed
320 unmodified lines321 case "alt-enter", "alt-return":322 chord = curses.AltEnter323 case "alt-space":324 chord = curses.AltSpace325+ case "alt-/":326+ chord = curses.AltSlash327 case "alt-bs", "alt-bspace":328 chord = curses.AltBS329 case "tab":330 chord = curses.Tab16 unmodified lines347 case "shift-right":348 chord = curses.SRight349 case "double-click":350 chord = curses.DoubleClick351+ case "f10":352+ chord = curses.F10353 default:354 if len(key) == 6 && strings.HasPrefix(lkey, "ctrl-") && isAlphabet(lkey[5]) {355 chord = curses.CtrlA + int(lkey[5]) - 'a'356 } else if len(key) == 5 && strings.HasPrefix(lkey, "alt-") && isAlphabet(lkey[4]) {357 chord = curses.AltA + int(lkey[4]) - 'a'354- } else if len(key) == 2 && strings.HasPrefix(lkey, "f") && key[1] >= '1' && key[1] <= '4' {358+ } else if len(key) == 2 && strings.HasPrefix(lkey, "f") && key[1] >= '1' && key[1] <= '9' {359 chord = curses.F1 + int(key[1]) - '1'360 } else if utf8.RuneCountInString(key) == 1 {361 chord = curses.AltZ + int([]rune(key)[0])362 } else {618 unmodified linesmodified:test/test_go.rb+4 added
428 unmodified lines429 test.call 'f2', 'f2'430 test.call 'f3', 'f3'431 test.call 'f2,f4', 'f2', 'f2'432 test.call 'f2,f4', 'f4', 'f4'433+ test.call 'alt-/', [:Escape, :/]434+ %w[f5 f6 f7 f8 f9 f10].each do |key|435+ test.call 'f5,f6,f7,f8,f9,f10', key, key436+ end437 test.call '@', '@'438 end439 440 def test_expect_print_query1123 unmodified lines