Fix modifier keys on ncurses

I think we really need to read terminfo instead...
This commit is contained in:
Alexandre Bury 2017-11-19 11:08:52 -08:00
parent b6cfd43556
commit 42dbe40e3f

View File

@ -162,65 +162,68 @@ impl Concrete {
// Values 512 and above are probably extensions // Values 512 and above are probably extensions
// Those keys don't seem to be documented... // Those keys don't seem to be documented...
520 => Event::Alt(Key::Del), // They often come in block of 5 bindings (A, AS, C, CS, CA)
521 => Event::AltShift(Key::Del), 522 => Event::Alt(Key::Del),
522 => Event::Ctrl(Key::Del), 523 => Event::AltShift(Key::Del),
523 => Event::CtrlShift(Key::Del), 524 => Event::Ctrl(Key::Del),
// 525 => Event::CtrlShift(Key::Del),
// 524? 526 => Event::CtrlAlt(Key::Del),
526 => Event::Alt(Key::Down), // 527?
527 => Event::AltShift(Key::Down), 528 => Event::Alt(Key::Down),
528 => Event::Ctrl(Key::Down), 529 => Event::AltShift(Key::Down),
529 => Event::CtrlShift(Key::Down), 530 => Event::Ctrl(Key::Down),
530 => Event::CtrlAlt(Key::Down), 531 => Event::CtrlShift(Key::Down),
532 => Event::CtrlAlt(Key::Down),
531 => Event::Alt(Key::End), 533 => Event::Alt(Key::End),
532 => Event::AltShift(Key::End), 534 => Event::AltShift(Key::End),
533 => Event::Ctrl(Key::End), 535 => Event::Ctrl(Key::End),
534 => Event::CtrlShift(Key::End), 536 => Event::CtrlShift(Key::End),
535 => Event::CtrlAlt(Key::End), 537 => Event::CtrlAlt(Key::End),
// 538?
536 => Event::Alt(Key::Home), 539 => Event::Alt(Key::Home),
537 => Event::AltShift(Key::Home), 540 => Event::AltShift(Key::Home),
538 => Event::Ctrl(Key::Home), 541 => Event::Ctrl(Key::Home),
539 => Event::CtrlShift(Key::Home), 542 => Event::CtrlShift(Key::Home),
540 => Event::CtrlAlt(Key::Home), 543 => Event::CtrlAlt(Key::Home),
// 544?
541 => Event::Alt(Key::Ins), 545 => Event::Alt(Key::Ins),
542 => Event::AltShift(Key::Ins), 546 => Event::AltShift(Key::Ins),
543 => Event::Ctrl(Key::Ins), 547 => Event::Ctrl(Key::Ins),
// 544: CtrlShiftIns? 548 => Event::CtrlShift(Key::Ins),
545 => Event::CtrlAlt(Key::Ins), 549 => Event::CtrlAlt(Key::Ins),
546 => Event::Alt(Key::Left), 550 => Event::Alt(Key::Left),
547 => Event::AltShift(Key::Left), 551 => Event::AltShift(Key::Left),
548 => Event::Ctrl(Key::Left), 552 => Event::Ctrl(Key::Left),
549 => Event::CtrlShift(Key::Left), 553 => Event::CtrlShift(Key::Left),
550 => Event::CtrlAlt(Key::Left), 554 => Event::CtrlAlt(Key::Left),
551 => Event::Alt(Key::PageDown), 555 => Event::Alt(Key::PageDown),
552 => Event::AltShift(Key::PageDown), 556 => Event::AltShift(Key::PageDown),
553 => Event::Ctrl(Key::PageDown), 557 => Event::Ctrl(Key::PageDown),
554 => Event::CtrlShift(Key::PageDown), 558 => Event::CtrlShift(Key::PageDown),
555 => Event::CtrlAlt(Key::PageDown), 559 => Event::CtrlAlt(Key::PageDown),
556 => Event::Alt(Key::PageUp), 560 => Event::Alt(Key::PageUp),
557 => Event::AltShift(Key::PageUp), 561 => Event::AltShift(Key::PageUp),
558 => Event::Ctrl(Key::PageUp), 562 => Event::Ctrl(Key::PageUp),
559 => Event::CtrlShift(Key::PageUp), 563 => Event::CtrlShift(Key::PageUp),
560 => Event::CtrlAlt(Key::PageUp), 564 => Event::CtrlAlt(Key::PageUp),
561 => Event::Alt(Key::Right), 565 => Event::Alt(Key::Right),
562 => Event::AltShift(Key::Right), 566 => Event::AltShift(Key::Right),
563 => Event::Ctrl(Key::Right), 567 => Event::Ctrl(Key::Right),
564 => Event::CtrlShift(Key::Right), 568 => Event::CtrlShift(Key::Right),
565 => Event::CtrlAlt(Key::Right), 569 => Event::CtrlAlt(Key::Right),
// 566? // 570?
567 => Event::Alt(Key::Up), 571 => Event::Alt(Key::Up),
568 => Event::AltShift(Key::Up), 572 => Event::AltShift(Key::Up),
569 => Event::Ctrl(Key::Up), 573 => Event::Ctrl(Key::Up),
570 => Event::CtrlShift(Key::Up), 574 => Event::CtrlShift(Key::Up),
571 => Event::CtrlAlt(Key::Up), 575 => Event::CtrlAlt(Key::Up),
ncurses::KEY_MOUSE => self.parse_mouse_event(), ncurses::KEY_MOUSE => self.parse_mouse_event(),
ncurses::KEY_B2 => Event::Key(Key::NumpadCenter), ncurses::KEY_B2 => Event::Key(Key::NumpadCenter),