summaryrefslogtreecommitdiff
path: root/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap
diff options
context:
space:
mode:
Diffstat (limited to 'platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap')
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java11
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java16
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CachingSoftWrapDataMapper.java21
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java35
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java8
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java11
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java21
-rw-r--r--platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java10
8 files changed, 54 insertions, 79 deletions
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java
index 26c8086beb72..bccdf4c59336 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/AbstractMappingStrategy.java
@@ -15,12 +15,10 @@
*/
package com.intellij.openapi.editor.impl.softwrap.mapping;
-import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.FoldRegion;
import com.intellij.openapi.editor.LogicalPosition;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -39,10 +37,7 @@ import java.util.List;
*/
abstract class AbstractMappingStrategy<T> implements MappingStrategy<T> {
- private static final Logger LOG = Logger.getInstance("#" + AbstractMappingStrategy.class.getName());
-
protected final Editor myEditor;
- protected final EditorTextRepresentationHelper myRepresentationHelper;
protected final SoftWrapsStorage myStorage;
protected final List<CacheEntry> myCache;
@@ -53,13 +48,11 @@ abstract class AbstractMappingStrategy<T> implements MappingStrategy<T> {
AbstractMappingStrategy(@NotNull Editor editor,
@NotNull SoftWrapsStorage storage,
- @NotNull List<CacheEntry> cache,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ @NotNull List<CacheEntry> cache)
{
myEditor = editor;
myStorage = storage;
myCache = cache;
- myRepresentationHelper = representationHelper;
}
@Nullable
@@ -73,7 +66,7 @@ abstract class AbstractMappingStrategy<T> implements MappingStrategy<T> {
}
protected void setFirstInitialPosition() {
- myInitialPosition = new EditorPosition(new LogicalPosition(0, 0), 0, myEditor, myRepresentationHelper);
+ myInitialPosition = new EditorPosition(new LogicalPosition(0, 0), 0, myEditor);
}
@Nullable
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java
index 57ef56c178e9..27362b52527a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/CacheEntry.java
@@ -17,7 +17,6 @@ package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.FoldRegion;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
import com.intellij.openapi.util.Ref;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TIntObjectProcedure;
@@ -25,7 +24,10 @@ import gnu.trove.TObjectProcedure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
/**
* Encapsulates information to cache for the single visual line.
@@ -59,7 +61,6 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
public boolean locked;
private final Editor myEditor;
- private final EditorTextRepresentationHelper myRepresentationHelper;
/** Holds positions for the tabulation symbols on a target visual line sorted by offset in ascending order. */
private List<TabData> myTabPositions = Collections.EMPTY_LIST;
@@ -67,10 +68,9 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
/** Holds information about single line fold regions representation data. */
private TIntObjectHashMap<FoldingData> myFoldingData = DUMMY;
- CacheEntry(int visualLine, @NotNull Editor editor, @NotNull EditorTextRepresentationHelper representationHelper) {
+ CacheEntry(int visualLine, @NotNull Editor editor) {
this.visualLine = visualLine;
myEditor = editor;
- myRepresentationHelper = representationHelper;
}
public void setLineStartPosition(@NotNull EditorPosition context) {
@@ -99,7 +99,7 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
}
public EditorPosition buildStartLinePosition() {
- EditorPosition result = new EditorPosition(myEditor, myRepresentationHelper);
+ EditorPosition result = new EditorPosition(myEditor);
result.logicalLine = startLogicalLine;
result.logicalColumn = startLogicalColumn;
result.offset = startOffset;
@@ -114,7 +114,7 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
}
public EditorPosition buildEndLinePosition() {
- EditorPosition result = new EditorPosition(myEditor, myRepresentationHelper);
+ EditorPosition result = new EditorPosition(myEditor);
result.logicalLine = endLogicalLine;
result.logicalColumn = endLogicalColumn;
result.offset = endOffset;
@@ -246,7 +246,7 @@ class CacheEntry implements Comparable<CacheEntry>, Cloneable {
@Override
protected CacheEntry clone() {
- final CacheEntry result = new CacheEntry(visualLine, myEditor, myRepresentationHelper);
+ final CacheEntry result = new CacheEntry(visualLine, myEditor);
result.startLogicalLine = startLogicalLine;
result.startLogicalColumn = startLogicalColumn;
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;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java
index 903243cfa766..1097f2824445 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/EditorPosition.java
@@ -16,7 +16,7 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
import org.jetbrains.annotations.NotNull;
/**
@@ -46,29 +46,24 @@ class EditorPosition implements Cloneable {
public int symbolWidthInPixels;
private final Editor myEditor;
- private final EditorTextRepresentationHelper myRepresentationHelper;
- EditorPosition(@NotNull Editor editor, @NotNull EditorTextRepresentationHelper representationHelper) {
+ EditorPosition(@NotNull Editor editor) {
myEditor = editor;
- myRepresentationHelper = representationHelper;
}
EditorPosition(@NotNull LogicalPosition logical,
int offset,
- @NotNull Editor editor,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ @NotNull Editor editor)
{
- this(logical, logical.toVisualPosition(), offset, editor, representationHelper);
+ this(logical, logical.toVisualPosition(), offset, editor);
}
EditorPosition(@NotNull LogicalPosition logical,
@NotNull VisualPosition visual,
int offset,
- @NotNull Editor editor,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ @NotNull Editor editor)
{
myEditor = editor;
- myRepresentationHelper = representationHelper;
logicalLine = logical.line;
logicalColumn = logical.column;
softWrapLinesBefore = logical.softWrapLinesBeforeCurrentLogicalLine;
@@ -148,10 +143,11 @@ class EditorPosition implements Cloneable {
if (logicalLine == endOffsetLogicalLine) {
// Single-line fold region.
if (collapsedSymbolsWidthInColumns < 0) {
- collapsedSymbolsWidthInColumns = myRepresentationHelper.toVisualColumnSymbolsNumber(document.getCharsSequence(),
- foldRegion.getStartOffset(),
- foldRegion.getEndOffset(),
- x);
+ collapsedSymbolsWidthInColumns = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor)
+ .toVisualColumnSymbolsNumber(document.getCharsSequence(),
+ foldRegion.getStartOffset(),
+ foldRegion.getEndOffset(),
+ x);
}
logicalColumn += collapsedSymbolsWidthInColumns;
foldingColumnDiff += placeholder.length() - collapsedSymbolsWidthInColumns;
@@ -159,10 +155,11 @@ class EditorPosition implements Cloneable {
else {
// Multi-line fold region.
if (collapsedSymbolsWidthInColumns < 0) {
- collapsedSymbolsWidthInColumns = myRepresentationHelper.toVisualColumnSymbolsNumber(document.getCharsSequence(),
- foldRegion.getStartOffset(),
- foldRegion.getEndOffset(),
- 0);
+ collapsedSymbolsWidthInColumns = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor)
+ .toVisualColumnSymbolsNumber(document.getCharsSequence(),
+ foldRegion.getStartOffset(),
+ foldRegion.getEndOffset(),
+ 0);
}
int linesDiff = endOffsetLogicalLine - logicalLine;
logicalLine += linesDiff;
@@ -191,7 +188,7 @@ class EditorPosition implements Cloneable {
@Override
protected EditorPosition clone() {
- EditorPosition result = new EditorPosition(myEditor, myRepresentationHelper);
+ EditorPosition result = new EditorPosition(myEditor);
result.logicalLine = logicalLine;
result.logicalColumn = logicalColumn;
result.visualLine = visualLine;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java
index 773d4fdc4d82..6ed904624fa6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/LogicalToVisualMappingStrategy.java
@@ -16,7 +16,7 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
@@ -32,10 +32,10 @@ class LogicalToVisualMappingStrategy extends AbstractMappingStrategy<VisualPosit
private LogicalPosition myTargetLogical;
LogicalToVisualMappingStrategy(@NotNull LogicalPosition logical, @NotNull Editor editor, @NotNull SoftWrapsStorage storage,
- @NotNull EditorTextRepresentationHelper representationHelper, @NotNull List<CacheEntry> cache)
+ @NotNull List<CacheEntry> cache)
throws IllegalStateException
{
- super(editor, storage, cache, representationHelper);
+ super(editor, storage, cache);
myTargetLogical = logical;
}
@@ -121,7 +121,7 @@ class LogicalToVisualMappingStrategy extends AbstractMappingStrategy<VisualPosit
int foldEndColumn;
if (data == null) {
int xStart = myEditor.getDocument().getLineNumber(foldRegion.getStartOffset()) == foldEndLine ? context.x : 0;
- foldEndColumn = myRepresentationHelper.toVisualColumnSymbolsNumber(
+ foldEndColumn = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber(
myEditor.getDocument().getCharsSequence(), foldRegion.getStartOffset(), foldRegion.getEndOffset(), xStart
);
} else {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java
index 39fe252ec623..399406f2db32 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/OffsetToLogicalCalculationStrategy.java
@@ -16,7 +16,7 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,10 +31,9 @@ class OffsetToLogicalCalculationStrategy extends AbstractMappingStrategy<Logical
private int myTargetOffset;
- OffsetToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ OffsetToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache)
{
- super(editor, storage, cache, representationHelper);
+ super(editor, storage, cache);
}
public void init(final int targetOffset, final List<CacheEntry> cache) {
@@ -157,13 +156,13 @@ class OffsetToLogicalCalculationStrategy extends AbstractMappingStrategy<Logical
int targetLogicalLine = document.getLineNumber(myTargetOffset);
if (targetLogicalLine == position.logicalLine) {
// Target offset is located on the same logical line as folding start.
- position.logicalColumn += myRepresentationHelper.toVisualColumnSymbolsNumber(
+ position.logicalColumn += SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber(
document.getCharsSequence(), foldRegion.getStartOffset(), myTargetOffset, position.x
);
}
else {
// Target offset is located on a different line with folding start.
- position.logicalColumn = myRepresentationHelper.toVisualColumnSymbolsNumber(
+ position.logicalColumn = SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).toVisualColumnSymbolsNumber(
document.getCharsSequence(), foldRegion.getStartOffset(), myTargetOffset, 0
);
position.softWrapColumnDiff = 0;
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
index 549cd1833779..3a819d88a370 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
@@ -28,10 +28,7 @@ import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.ScrollingModelEx;
import com.intellij.openapi.editor.ex.util.EditorUtil;
-import com.intellij.openapi.editor.impl.EditorImpl;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
-import com.intellij.openapi.editor.impl.IterationState;
-import com.intellij.openapi.editor.impl.TextChangeImpl;
+import com.intellij.openapi.editor.impl.*;
import com.intellij.openapi.editor.impl.softwrap.*;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.text.StringUtil;
@@ -99,7 +96,6 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
private int myVerticalScrollBarWidth = -1;
private VisibleAreaWidthProvider myWidthProvider;
- private EditorTextRepresentationHelper myRepresentationHelper;
private LineWrapPositionStrategy myLineWrapPositionStrategy;
private IncrementalCacheUpdateEvent myEventBeingProcessed;
private boolean myVisualAreaListenerAttached;
@@ -112,12 +108,11 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
public SoftWrapApplianceManager(@NotNull SoftWrapsStorage storage,
@NotNull EditorEx editor,
@NotNull SoftWrapPainter painter,
- @NotNull EditorTextRepresentationHelper representationHelper, SoftWrapDataMapper dataMapper)
+ SoftWrapDataMapper dataMapper)
{
myStorage = storage;
myEditor = editor;
myPainter = painter;
- myRepresentationHelper = representationHelper;
myDataMapper = dataMapper;
myWidthProvider = new DefaultVisibleAreaWidthProvider(editor);
}
@@ -272,7 +267,7 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
myContext.fontType = attributes.getFontType();
myContext.rangeEndOffset = event.getNewEndOffset();
- EditorPosition position = new EditorPosition(logical, start, myEditor, myRepresentationHelper);
+ EditorPosition position = new EditorPosition(logical, start, myEditor);
position.x = point.x;
int spaceWidth = EditorUtil.getSpaceWidth(myContext.fontType, myEditor);
@@ -333,7 +328,8 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
}
int placeholderWidthInPixels = 0;
for (int i = 0; i < placeholder.length(); i++) {
- placeholderWidthInPixels += myRepresentationHelper.charWidth(placeholder.charAt(i), myContext.fontType);
+ placeholderWidthInPixels += SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor)
+ .charWidth(placeholder.charAt(i), myContext.fontType);
}
int newX = myContext.currentPosition.x + placeholderWidthInPixels;
@@ -617,7 +613,7 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
return EditorUtil.nextTabStop(myContext.currentPosition.x, myEditor);
}
else {
- return myContext.currentPosition.x + myRepresentationHelper.charWidth(c, myContext.fontType);
+ return myContext.currentPosition.x + SoftWrapModelImpl.getEditorTextRepresentationHelper(myEditor).charWidth(c, myContext.fontType);
//FontInfo fontInfo = EditorUtil.fontForChar(c, myContext.fontType, myEditor);
//return myContext.currentPosition.x + fontInfo.charWidth(c, myContext.contentComponent);
}
@@ -1009,11 +1005,6 @@ public class SoftWrapApplianceManager implements DocumentListener, Dumpable {
reset();
}
- public void setRepresentationHelper(@NotNull EditorTextRepresentationHelper representationHelper) {
- myRepresentationHelper = representationHelper;
- reset();
- }
-
@NotNull
@Override
public String dumpState() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java
index d79e3bff8f63..7c7c6e475a4f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/VisualToLogicalCalculationStrategy.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.openapi.editor.*;
-import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapsStorage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -33,11 +32,10 @@ class VisualToLogicalCalculationStrategy extends AbstractMappingStrategy<Logical
private final CacheEntry mySearchKey;
private VisualPosition myTargetVisual;
- VisualToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache,
- @NotNull EditorTextRepresentationHelper representationHelper)
+ VisualToLogicalCalculationStrategy(@NotNull Editor editor, @NotNull SoftWrapsStorage storage, @NotNull List<CacheEntry> cache)
{
- super(editor, storage, cache, representationHelper);
- mySearchKey = new CacheEntry(0, editor, representationHelper);
+ super(editor, storage, cache);
+ mySearchKey = new CacheEntry(0, editor);
}
public void init(@NotNull final VisualPosition targetVisual, @NotNull final List<CacheEntry> cache) {