moveLeft example

                $r = [$inputStream];
            }
            $c = fread($inputStream, 1);

            // as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false.             if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
                shell_exec('stty '.$sttyMode);
                throw new MissingInputException('Aborted.');
            } elseif ("\177" === $c) { // Backspace Character                 if (0 === $numMatches && 0 !== $i) {
                    --$i;
                    $cursor->moveLeft(s($fullChoice)->slice(-1)->width(false));

                    $fullChoice = self::substr($fullChoice, 0, $i);
                }

                if (0 === $i) {
                    $ofs = -1;
                    $matches = $autocomplete($ret);
                    $numMatches = \count($matches);
                } else {
                    $numMatches = 0;
                }

                
$cursor = new Cursor($output = $this->getOutputStream());

        $cursor->moveDown(12);

        $this->assertEquals("\x1b[12B", $this->getOutputContent($output));
    }

    public function testMoveLeftOneLine()
    {
        $cursor = new Cursor($output = $this->getOutputStream());

        $cursor->moveLeft();

        $this->assertEquals("\x1b[1D", $this->getOutputContent($output));
    }

    public function testMoveLeftMultipleLines()
    {
        $cursor = new Cursor($output = $this->getOutputStream());

        $cursor->moveLeft(12);

        $this->assertEquals("\x1b[12D", $this->getOutputContent($output));
    }
                $r = [$inputStream];
            }
            $c = fread($inputStream, 1);

            // as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false.             if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
                shell_exec('stty '.$sttyMode);
                throw new MissingInputException('Aborted.');
            } elseif ("\177" === $c) { // Backspace Character                 if (0 === $numMatches && 0 !== $i) {
                    --$i;
                    $cursor->moveLeft(s($fullChoice)->slice(-1)->width(false));

                    $fullChoice = self::substr($fullChoice, 0, $i);
                }

                if (0 === $i) {
                    $ofs = -1;
                    $matches = $autocomplete($ret);
                    $numMatches = \count($matches);
                } else {
                    $numMatches = 0;
                }

                
Home | Imprint | This part of the site doesn't use cookies.