List of usage examples for javafx.scene.control IndexRange getEnd
public int getEnd()
From source file:org.beryx.viewreka.fxapp.codearea.SimpleCodeArea.java
protected void applyTab() { IndexRange selection = getSelection(); Position startPos = offsetToPosition(selection.getStart(), Bias.Forward); if (selection.getLength() == 0) { int spaceCount = tabAdvance - startPos.getMinor() % tabAdvance; replaceSelection(StringUtils.repeat(' ', spaceCount)); } else {//from ww w . j av a 2s . c o m int startParagraph = startPos.getMajor(); Position endPos = offsetToPosition(selection.getEnd(), Bias.Forward); int endParagraph = endPos.getMajor(); String spaces = StringUtils.repeat(' ', tabAdvance); for (int pg = startParagraph; pg <= endParagraph; pg++) { insertText(position(pg, 0).toOffset(), spaces); } int newStartOffset = startPos.offsetBy(tabAdvance, Bias.Forward).toOffset(); int newEndOffset = endPos.offsetBy(tabAdvance, Bias.Forward).toOffset(); selectRange(newStartOffset, newEndOffset); } }