Logo Search packages:      
Sourcecode: jline version File versions  Download package

final int jline::ConsoleReader::moveCursor ( final int  num  )  throws IOException [inline, private]

Move the cursor where characters.

Parameters:
where if less than 0, move abs(where) to the left, otherwise move where to the right.
Returns:
the number of spaces we moved

Definition at line 1345 of file ConsoleReader.java.

References moveInternal().

Referenced by backspace(), readLine(), and setCursorPosition().

      {
            int where = num;
            if (buf.cursor == 0 && where < 0)
                  return 0;

            if (buf.cursor == buf.buffer.length () && where > 0)
                  return 0;

            if (buf.cursor + where < 0)
                  where = -buf.cursor;
            else if (buf.cursor + where > buf.buffer.length ())
                  where = buf.buffer.length () - buf.cursor;

            moveInternal (where);
            return where;
      }


Generated by  Doxygen 1.6.0   Back to index