Search in sources :

Example 6 with SoftWrap

use of com.intellij.openapi.editor.SoftWrap in project intellij-community by JetBrains.

the class VisualLineFragmentsIterator method init.

private void init(EditorView view, int startOffset, int startLogicalLine, int currentOrPrevWrapIndex, int nextFoldingIndex, @Nullable Runnable quickEvaluationListener) {
    myQuickEvaluationListener = quickEvaluationListener;
    myView = view;
    EditorImpl editor = view.getEditor();
    myDocument = editor.getDocument();
    FoldingModelEx foldingModel = editor.getFoldingModel();
    FoldRegion[] regions = foldingModel.fetchTopLevel();
    myRegions = regions == null ? FoldRegion.EMPTY_ARRAY : regions;
    SoftWrapModelImpl softWrapModel = editor.getSoftWrapModel();
    List<? extends SoftWrap> softWraps = softWrapModel.getRegisteredSoftWraps();
    SoftWrap currentOrPrevWrap = currentOrPrevWrapIndex < 0 || currentOrPrevWrapIndex >= softWraps.size() ? null : softWraps.get(currentOrPrevWrapIndex);
    SoftWrap followingWrap = (currentOrPrevWrapIndex + 1) < 0 || (currentOrPrevWrapIndex + 1) >= softWraps.size() ? null : softWraps.get(currentOrPrevWrapIndex + 1);
    myVisualLineStartOffset = mySegmentStartOffset = startOffset;
    myCurrentFoldRegionIndex = nextFoldingIndex;
    myCurrentEndLogicalLine = startLogicalLine;
    myCurrentX = myView.getInsets().left;
    if (mySegmentStartOffset == 0) {
        myCurrentX += myView.getPrefixTextWidthInPixels();
    } else if (currentOrPrevWrap != null && mySegmentStartOffset == currentOrPrevWrap.getStart()) {
        myCurrentX += currentOrPrevWrap.getIndentInPixels();
        myCurrentVisualColumn = currentOrPrevWrap.getIndentInColumns();
    }
    myNextWrapOffset = followingWrap == null ? Integer.MAX_VALUE : followingWrap.getStart();
    setInlaysAndFragmentIterator();
}
Also used : EditorImpl(com.intellij.openapi.editor.impl.EditorImpl) FoldRegion(com.intellij.openapi.editor.FoldRegion) SoftWrapModelImpl(com.intellij.openapi.editor.impl.SoftWrapModelImpl) SoftWrap(com.intellij.openapi.editor.SoftWrap) FoldingModelEx(com.intellij.openapi.editor.ex.FoldingModelEx)

Aggregations

SoftWrap (com.intellij.openapi.editor.SoftWrap)6 FoldRegion (com.intellij.openapi.editor.FoldRegion)2 EditorImpl (com.intellij.openapi.editor.impl.EditorImpl)2 SoftWrapModelImpl (com.intellij.openapi.editor.impl.SoftWrapModelImpl)2 Document (com.intellij.openapi.editor.Document)1 SoftWrapModel (com.intellij.openapi.editor.SoftWrapModel)1 VisualPosition (com.intellij.openapi.editor.VisualPosition)1 FoldingModelEx (com.intellij.openapi.editor.ex.FoldingModelEx)1 ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1