Advances the cursor position ot the left hand side, and to the next
        line. If the cursor is on the lowest line, the displayed contents are
        scrolled, causing the top line to be lost.
771456
def newline(self):
        
        self.carriage_return()

        if self._cy + (2 * self._ch) >= self._device.height:
            # Simulate a vertical scroll
            copy = self._backing_image.crop((0, self._ch, self._device.width,
                self._device.height))
            self._backing_image.paste(copy, (0, 0))
            self._canvas.rectangle((0, copy.height, self._device.width,
                self._device.height), fill=self.default_bgcolor)
        else:
            self._cy += self._ch

        self.flush()
        if self.animate:
            time.sleep(0.2)
606504
def _index(self):
        

        if self.y + 1 >= self.size[0]:
            # If the cursor is currently on the last row, then spawn another
            # and scroll down (removing the top row).
            self.display = self.display[1:] + [u" " * self.size[1]]
        else:
            # If the cursor is anywhere else, then just move it to the 
            # next line.
            self.y += 1
1359365
def cursor_up(self, count=1):
        
        original_column = self.preferred_column or self.document.cursor_position_col
        self.cursor_position += self.document.get_cursor_up_position(
            count=count, preferred_column=original_column)

        # Remember the original column for the next up/down movement.
        self.preferred_column = original_column
496862
def first_visible_line(self, after_scroll_offset=False):
        
        if after_scroll_offset:
            return self.displayed_lines[self.applied_scroll_offsets.top]
        else:
            return self.displayed_lines[0]
869243
function() {
        if (this.drawing) {
        this.ctx.beginPath();
        this.ctx.moveTo(this.lastPos.x, this.lastPos.y);
        this.ctx.lineTo(this.currentPos.x, this.currentPos.y);
        this.ctx.stroke();
        this.lastPos = this.currentPos;
      }
    }
61989
void updateCurrentLine () {
		int index = calculateCurrentLineIndex(cursor);
		int line = index / 2;
		// Special case when cursor moves to the beginning of the line from the end of another and a word
		// wider than the box
		if (index % 2 == 0 || index + 1 >= linesBreak.size || cursor != linesBreak.items[index]
				|| linesBreak.items[index + 1] != linesBreak.items[index]) {
			if (line < linesBreak.size / 2 || text.length() == 0 || text.charAt(text.length() - 1) == ENTER_ANDROID
					|| text.charAt(text.length() - 1) == ENTER_DESKTOP) {
				cursorLine = line;
			}
		}
	}
1053101
public synchronized void moveCursor(Cursor cursor)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "moveCursor", new Object[] { cursor });
    
    checkEntryParent();
      
    synchronized(parentList)
    {
      //make sure that the cursor is pointing to an entry in the same list
      if(cursor != null && cursor.parentList == parentList)
      {
        //if we are already pointing to the same entry, we may not have to
        //do anything
        if(cursor.current != current)
        {
          if(cursor.atTop)
          {
            //if the new cursor is at the top, move this one to the top
            moveToTop();
          }
          else if(cursor.atBottom)
          {
            //if the new cursor is at the bottom, move this one to the bottom
            moveToBottom();
          }
          else
          {
            //otherwise just move this cursor to point to the same entry as the
            //one pointed to by the given cursor
            moveCursor(cursor.current);
          }
        }
        else //it is possible that the current entries are both null if they are both
        {    //at the top or bottom on the list
          if(cursor.current == null)
          {
            if(cursor.atTop && atBottom)
            {
              //if the given cursor is at the top but we are at the bottom, move to the top
              moveToTop();
            }
            else if(cursor.atBottom && atTop)
            {
              //if the given cursor is at the bottom but we are at the top, move to the bottom
              moveToBottom();
            }
          }
        }
      }
      else //if the new entry is not in this list, throw a runtime exception
      {
        SIErrorException e = new SIErrorException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0002",
            new Object[] {
              "com.ibm.ws.sib.processor.utils.linkedlist.Cursor",
              "1:541:1.15" },
           null));
  
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.utils.linkedlist.Cursor.moveCursor",
          "1:547:1.15",
          this);
  
        SibTr.exception(tc, e);      
  
        if (tc.isEntryEnabled())
          SibTr.exit(tc, "moveCursor", e);
  
        throw e;
      }
    }        
  
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "moveCursor");
  }
633972
def change_scroll(self, position):
        

        self.stream.write(self.hide_cursor)
        self.stream.write(self.csr(0, position))
        self.stream.write(self.move(position, 0))
499638
def scroll_to(self, line):
        
        self._buffer.scroll(line - self._start_line)
        self._start_line = line
659572
def advance(self):
        """"""
        self.cursor += 1
        if self.cursor >= len(self.raw):
            self.char = None
        else:
            self.char = self.raw[self.cursor]
896991
def advance(self, length):
        """"""
        new_position = self._position + length
        if new_position < 0 or new_position > len(self._data):
            raise Exception('Invalid advance amount (%s) for cursor.  '
                            'Position=%s' % (length, new_position))
        self._position = new_position
814735
public synchronized void moveToTop()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "moveToTop");

    checkEntryParent();

    //record the reference to the parent list because the call to forceRemove
    //will nullify it.
    LinkedList list = parentList;
    synchronized(list)
    {
      //remove the cursor from it's current postion
      forceRemove();
      //reset the parent list reference
      parentList = list;
      //mark this cursor as being at the top
      atTop = true;
      
      //link this cursor to the first cursor in the list's list of cursors
      //which are currently at the top
      next = list.firstTopCursor;
      //link the old first cursor to this one 
      if(next != null) next.previous = this;
      //mark this one as the first cursor in the list
      list.firstTopCursor = this;
    }
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "moveToTop");
  }
93695
private void onScrollPositionChanged(int oldScrollPosition, int newScrollPosition) {
		int newScrollDirection;

		if (newScrollPosition < oldScrollPosition) {
			newScrollDirection = SCROLL_TO_TOP;
		} else {
			newScrollDirection = SCROLL_TO_BOTTOM;
		}

		if (directionHasChanged(newScrollDirection)) {
			translateYAnimatedView(newScrollDirection);
		}
	}
1153290
def advance(self, height, ignore_overflow=False):
        """"""
        if height <= self.remaining_height:
            self._self_cursor.grow(height)
        elif ignore_overflow:
            self._self_cursor.grow(float(self.remaining_height))
        else:
            raise ContainerOverflow(self.page.number)
270200
def cursor_to_line(self, line=None):
        
        self.cursor.y = (line or 1) - 1

        # If origin mode (DECOM) is set, line number are relative to
        # the top scrolling margin.
        if mo.DECOM in self.mode:
            self.cursor.y += self.margins.top

            # FIXME: should we also restrict the cursor to the scrolling
            # region?

        self.ensure_vbounds()
851453
public void moveCursorLine (int line) {
		if (line < 0) {
			cursorLine = 0;
			cursor = 0;
			moveOffset = -1;
		} else if (line >= getLines()) {
			int newLine = getLines() - 1;
			cursor = text.length();
			if (line > getLines() || newLine == cursorLine) {
				moveOffset = -1;
			}
			cursorLine = newLine;
		} else if (line != cursorLine) {
			if (moveOffset < 0) {
				moveOffset = linesBreak.size <= cursorLine * 2 ? 0
						: glyphPositions.get(cursor) - glyphPositions.get(linesBreak.get(cursorLine * 2));
			}
			cursorLine = line;
			cursor = cursorLine * 2 >= linesBreak.size ? text.length() : linesBreak.get(cursorLine * 2);
			while (cursor < text.length() && cursor <= linesBreak.get(cursorLine * 2 + 1) - 1
					&& glyphPositions.get(cursor) - glyphPositions.get(linesBreak.get(cursorLine * 2)) < moveOffset) {
				cursor++;
			}
			showCursor();
		}
	}
282143
def join_next_line(self, separator=' '):
        
        if not self.document.on_last_line:
            self.cursor_position += self.document.get_end_of_line_position()
            self.delete()

            # Remove spaces.
            self.text = (self.document.text_before_cursor + separator +
                         self.document.text_after_cursor.lstrip(' '))