@Override public List<? extends SoftWrap> getRegisteredSoftWraps() { if (!isSoftWrappingEnabled()) { return Collections.emptyList(); } return myStorage.getSoftWraps(); }
@NotNull @Override public List<? extends SoftWrap> getSoftWrapsForRange(int start, int end) { if (!isSoftWrappingEnabled() || end < start) { return Collections.emptyList(); } List<? extends SoftWrap> softWraps = myStorage.getSoftWraps(); int startIndex = myStorage.getSoftWrapIndex(start); if (startIndex < 0) { startIndex = -startIndex - 1; if (startIndex >= softWraps.size() || softWraps.get(startIndex).getStart() > end) { return Collections.emptyList(); } } int endIndex = myStorage.getSoftWrapIndex(end); if (endIndex >= 0) { return softWraps.subList(startIndex, endIndex + 1); } else { endIndex = -endIndex - 1; return softWraps.subList(startIndex, endIndex); } }
/** @return total number of soft wrap-introduced new visual lines */ public int getSoftWrapsIntroducedLinesNumber() { if (!isSoftWrappingEnabled()) { return 0; } int result = 0; FoldingModel foldingModel = myEditor.getFoldingModel(); for (SoftWrap softWrap : myStorage.getSoftWraps()) { if (!foldingModel.isOffsetCollapsed(softWrap.getStart())) { result++; // Assuming that soft wrap has single line feed all the time } } return result; }
@Override public List<? extends SoftWrap> getRegisteredSoftWraps() { if (!isSoftWrappingEnabled()) { return Collections.emptyList(); } List<SoftWrapImpl> softWraps = myStorage.getSoftWraps(); if (!softWraps.isEmpty() && softWraps.get(softWraps.size() - 1).getStart() >= myEditor.getDocument().getTextLength()) { LOG.error( "Unexpected soft wrap location", new Attachment("editorState.txt", myEditor.dumpState())); } return softWraps; }
/** @return total number of soft wrap-introduced new visual lines */ public int getSoftWrapsIntroducedLinesNumber() { return myStorage .getSoftWraps() .size(); // Assuming that soft wrap has single line feed all the time }