diff options
Diffstat (limited to 'platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java')
-rw-r--r-- | platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java index 08bf0211dbc8..2f21b0319af2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java @@ -21,7 +21,7 @@ import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.ex.FoldingModelEx; import com.intellij.openapi.editor.impl.EditorImpl; -import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper; +import com.intellij.openapi.editor.impl.SoftWrapModelImpl; import com.intellij.openapi.editor.impl.softwrap.SoftWrapDataMapper; import com.intellij.openapi.editor.impl.softwrap.SoftWrapImpl; import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage; @@ -71,19 +71,16 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw private final VisualToLogicalCalculationStrategy myVisualToLogicalStrategy; private final EditorEx myEditor; private final SoftWrapsStorage myStorage; - private final EditorTextRepresentationHelper myRepresentationHelper; private final CacheEntry mySearchKey; - public CachingSoftWrapDataMapper(@NotNull EditorEx editor, @NotNull SoftWrapsStorage storage, - @NotNull EditorTextRepresentationHelper representationHelper) + public CachingSoftWrapDataMapper(@NotNull EditorEx editor, @NotNull SoftWrapsStorage storage) { myEditor = editor; myStorage = storage; - myRepresentationHelper = representationHelper; - mySearchKey = new CacheEntry(0, editor, representationHelper); + mySearchKey = new CacheEntry(0, editor); - myOffsetToLogicalStrategy = new OffsetToLogicalCalculationStrategy(editor, storage, myCache, representationHelper); - myVisualToLogicalStrategy = new VisualToLogicalCalculationStrategy(editor, storage, myCache, representationHelper); + myOffsetToLogicalStrategy = new OffsetToLogicalCalculationStrategy(editor, storage, myCache); + myVisualToLogicalStrategy = new VisualToLogicalCalculationStrategy(editor, storage, myCache); } @NotNull @@ -146,7 +143,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw // Count soft wrap column offset only if it's located at the same line as the target offset. if (column < 0 && softWrap.getStart() >= targetLogicalLineStartOffset) { - column = softWrap.getIndentInColumns() + myRepresentationHelper.toVisualColumnSymbolsNumber( + column = softWrap.getIndentInColumns() + SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber( myEditor.getDocument().getCharsSequence(), softWrap.getStart(), maxOffset, softWrap.getIndentInPixels() ); @@ -326,7 +323,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw return lastEntry; } else if (lastEntry.visualLine < visualLine && createIfNecessary) { - CacheEntry result = new CacheEntry(visualLine, myEditor, myRepresentationHelper); + CacheEntry result = new CacheEntry(visualLine, myEditor); myCache.add(result); return result; } @@ -357,7 +354,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw if (cacheEntryIndex < 0) { cacheEntryIndex = start; if (createIfNecessary) { - myCache.add(cacheEntryIndex, result = new CacheEntry(visualLine, myEditor, myRepresentationHelper)); + myCache.add(cacheEntryIndex, result = new CacheEntry(visualLine, myEditor)); } } else { @@ -666,7 +663,7 @@ public class CachingSoftWrapDataMapper implements SoftWrapDataMapper, SoftWrapAw @NotNull List<Pair<Integer, FoldRegion>> foldRegions, @NotNull List<Pair<Integer, Integer>> tabData) { - final CacheEntry entry = new CacheEntry(visualLine, myEditor, myRepresentationHelper); + final CacheEntry entry = new CacheEntry(visualLine, myEditor); entry.startOffset = startOffset; entry.endOffset = endOffset; entry.startLogicalLine = startLogicalLine; |