/** * Key press event handler * @param int $keyCode code of the pressed key * @return boolean true if a resize is needed, false otherwise */ public function onKeyPress($keyCode) { switch ($keyCode) { // enter key case 13: // expand/collapse element if (array_key_exists($this->cursorPositionY, $this->expandablePosList)) { $idProfiler = $this->expandablePosList[$this->cursorPositionY]; $this->expandableElementList[$idProfiler] = !$this->expandableElementList[$idProfiler]; } break; // up arrow // up arrow case NCURSES_KEY_UP: $this->cursorPositionY = max(0, $this->cursorPositionY - 1); if ($this->cursorPositionY < $this->getDecY()) { $decY = $this->cursorPositionY; $this->setDecY($decY); } break; // down arrow // down arrow case NCURSES_KEY_DOWN: $this->cursorPositionY = min($this->maxY, $this->cursorPositionY + 1); if ($this->cursorPositionY > $this->getPadHeight() + $this->getDecY() - 1) { $decY = $this->cursorPositionY - ($this->getPadHeight() - 1); $this->setDecY($decY); } break; // page up // page up case NCURSES_KEY_PPAGE: $this->cursorPositionY = max(0, $this->cursorPositionY - $this->getPadHeight()); if ($this->cursorPositionY < $this->getDecY()) { $decY = $this->cursorPositionY; $this->setDecY($decY); } break; // page down // page down case NCURSES_KEY_NPAGE: $this->cursorPositionY = min($this->maxY, $this->cursorPositionY + $this->getPadHeight()); if ($this->cursorPositionY > $this->getPadHeight() + $this->getDecY() - 1) { $decY = min($this->cursorPositionY, $this->maxY - $this->getPadHeight() + 1); $this->setDecY($decY); } break; // right arrow // left arrow // end key // home key // ctrl + right arrow // ctrl + left arrow // right arrow // left arrow // end key // home key // ctrl + right arrow // ctrl + left arrow case NCURSES_KEY_END: case NCURSES_KEY_RIGHT: case NCURSES_KEY_LEFT: case NCURSES_KEY_HOME: case 555: case 540: parent::onKeyPress($keyCode); break; } return false; }