Пример #1
0
 /**
  * Control-F binding.
  * Move cursor forward one word.
  *
  * @access  public
  * @param   \Hoa\Console\Readline  $self    Self.
  * @return  int
  */
 public function _bindControlF(Readline $self)
 {
     $current = $self->getLineCurrent();
     if ($self->getLineLength() === $current) {
         return static::STATE_CONTINUE;
     }
     $words = preg_split('#\\b#u', $self->getLine(), -1, PREG_SPLIT_OFFSET_CAPTURE | PREG_SPLIT_NO_EMPTY);
     for ($i = 0, $max = count($words) - 1; $i < $max && $words[$i][1] < $current; ++$i) {
     }
     if (!isset($words[$i + 1])) {
         $words[$i + 1] = array(1 => $self->getLineLength());
     }
     for ($j = $words[$i + 1][1]; $j > $current; --$j) {
         $self->_bindArrowRight($self);
     }
     return static::STATE_CONTINUE;
 }