| 670 | } |
| 671 | |
| 672 | void cmCursesMainForm::HandleInput() |
| 673 | { |
| 674 | int x = 0; |
| 675 | int y = 0; |
| 676 | |
| 677 | if (!this->Form) { |
| 678 | return; |
| 679 | } |
| 680 | |
| 681 | FIELD* currentField; |
| 682 | cmCursesWidget* currentWidget; |
| 683 | |
| 684 | char debugMessage[128]; |
| 685 | |
| 686 | for (;;) { |
| 687 | this->UpdateStatusBar(); |
| 688 | this->PrintKeys(); |
| 689 | if (this->SearchMode) { |
| 690 | std::string searchstr = "Search: " + this->SearchString; |
| 691 | this->UpdateStatusBar(searchstr); |
| 692 | this->PrintKeys(1); |
| 693 | move(y - 5, static_cast<unsigned int>(searchstr.size())); |
| 694 | // move(1,1); |
| 695 | touchwin(stdscr); |
| 696 | refresh(); |
| 697 | } |
| 698 | int key = getch(); |
| 699 | |
| 700 | #ifdef _WIN32 |
| 701 | if (key == KEY_RESIZE) { |
| 702 | HandleResize(); |
| 703 | } |
| 704 | #endif // _WIN32 |
| 705 | |
| 706 | getmaxyx(stdscr, y, x); |
| 707 | // If window too small, handle 'q' only |
| 708 | if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) { |
| 709 | // quit |
| 710 | if (key == 'q') { |
| 711 | break; |
| 712 | } |
| 713 | continue; |
| 714 | } |
| 715 | |
| 716 | currentField = current_field(this->Form); |
| 717 | currentWidget = |
| 718 | reinterpret_cast<cmCursesWidget*>(field_userptr(currentField)); |
| 719 | |
| 720 | bool widgetHandled = false; |
| 721 | |
| 722 | if (this->SearchMode) { |
| 723 | if (key == 10 || key == KEY_ENTER) { |
| 724 | this->SetSearchMode(false); |
| 725 | if (!this->SearchString.empty()) { |
| 726 | this->JumpToCacheEntry(this->SearchString.c_str()); |
| 727 | this->OldSearchString = this->SearchString; |
| 728 | } |
| 729 | this->SearchString.clear(); |
no test coverage detected