if(newCaret < 0 || newCaret > buffer.getLength()) { throw new IllegalArgumentException("caret out of bounds: " + newCaret); }    blink = true; caretTimer.restart();  if(caret == newCaret) {    scrollToCaret(doElectricScroll); return; }  int newCaretLine = getLineOfOffset(newCaret);  magicCaret = -1;  if(!foldVisibilityManager.isLineVisible(newCaretLine)) { if(foldVisibilityManager.isNarrowed()) { int collapseFolds = buffer.getIntegerProperty( "collapseFolds",0); if(collapseFolds != 0) foldVisibilityManager.expandFolds(collapseFolds); else foldVisibilityManager.expandAllFolds(); } else foldVisibilityManager.expandFold(newCaretLine,false); }  invalidateLineRange(caretLine,newCaretLine);  caret = newCaret; caretLine = newCaretLine;  if(focusedComponent == this) scrollToCaret(doElectricScroll);  updateBracketHighlight();  fireCaretEvent();
moveCaretPosition(newCaret,true);
	public void moveCaretPosition(int newCaret, boolean doElectricScroll)	{		if(newCaret < 0 || newCaret > buffer.getLength())		{			throw new IllegalArgumentException("caret out of bounds: "				+ newCaret);		}		// When the user is typing, etc, we don't want the caret		// to blink		blink = true;		caretTimer.restart();		if(caret == newCaret)		{			// so that C+y <marker>, for example, will return			// to the saved location even if the caret was			// never moved but the user scrolled instead			scrollToCaret(doElectricScroll);			return;		}		int newCaretLine = getLineOfOffset(newCaret);		magicCaret = -1;		if(!foldVisibilityManager.isLineVisible(newCaretLine))		{			if(foldVisibilityManager.isNarrowed())			{				int collapseFolds = buffer.getIntegerProperty(					"collapseFolds",0);				if(collapseFolds != 0)					foldVisibilityManager.expandFolds(collapseFolds);				else					foldVisibilityManager.expandAllFolds();			}			else				foldVisibilityManager.expandFold(newCaretLine,false);		}		invalidateLineRange(caretLine,newCaretLine);		caret = newCaret;		caretLine = newCaretLine;		if(focusedComponent == this)			scrollToCaret(doElectricScroll);		updateBracketHighlight();		fireCaretEvent();	} //}}}