Example #1
0
 /**
  * Moves the cursor down. The current column position is remembered in {@link #lastCol} and, if
  * possible, restored.
  *
  * @param l number of lines to move cursor
  * @param mark mark flag
  */
 private void down(final int l, final boolean mark) {
   if (!mark) text.noMark();
   final int x = text.bol(mark);
   if (lastCol == -1) lastCol = x;
   for (int i = 0; i < l; ++i) {
     text.eol(mark);
     text.next(mark);
   }
   text.forward(lastCol, mark);
   if (text.pos() == text.size()) lastCol = -1;
 }
Example #2
0
 /**
  * Moves the cursor up.
  *
  * @param l number of lines to move cursor
  * @param mark mark flag
  */
 private void up(final int l, final boolean mark) {
   if (!mark) text.noMark();
   final int x = text.bol(mark);
   if (lastCol == -1) lastCol = x;
   if (text.pos() == 0) {
     lastCol = -1;
     return;
   }
   for (int i = 0; i < l; ++i) {
     text.prev(mark);
     text.bol(mark);
   }
   text.forward(lastCol, mark);
 }