/** * @return The number of chars a tab advances in the document. Default is 4. * @since 2.4.0 */ public int getTabAdvance() { return tabAvanceProperty().get(); }
/** * Set the number of chars a tab advances in the document. Default is 4. * * @param advance * the number of chars * @since 2.4.0 */ public void setTabAdvance(int advance) { tabAvanceProperty().set(advance); }
public void scrollOffsetIntoView(int offset, int verticalOffset, int horizontalOffset) { if( offset >= 0 ) { int lineIdx = getSkinnable().getContent().getLineAtOffset(offset); Range<Integer> visibleLines = this.content.getVisibleLines(); if( ! visibleLines.contains(Integer.valueOf(lineIdx)) ) { int linesVisible = visibleLines.upperEndpoint().intValue(); int delta = linesVisible - verticalOffset; int scrollLine = Math.min(lineIdx+delta, getSkinnable().getContent().getLineCount()-1); scrollLineIntoView(scrollLine); } int colIdx = offset - getSkinnable().getContent().getOffsetAtLine(lineIdx); String line = getSkinnable().getContent().getLine(lineIdx).substring(0, colIdx); int tabCount = (int)line.chars().filter(c -> c == '\t').count(); scrollColumnIntoView(colIdx + tabCount * (getSkinnable().tabAvanceProperty().get() - 1), horizontalOffset); } else { scrollLineIntoView(0); scrollColumnIntoView(0, 0); } }
scrollColumnIntoView(colIdx + tabCount * (styledText.tabAvanceProperty().get() - 1), 12); scrollLineIntoView(lineIdx); });
public ContentView(LineHelper lineHelper, StyledTextArea area) { this.lineLayer = new LineLayer(()->new LineNode(area.tabAvanceProperty()), (n, m)->{ n.caretLayerVisibleProperty().bind(area.focusedProperty()); n.setLineHelper(getLineHelper());