mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove usages of deprecated LogicalPosition members
This commit is contained in:
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -25,12 +11,7 @@ import java.awt.*;
|
||||
* for example, if the top 10 lines of the document are folded, the 10th line in the document
|
||||
* will have the line number 10 in its logical position.
|
||||
* <p>
|
||||
* Logical position may store additional parameters that define its mapping to {@link VisualPosition}. Rationale is that
|
||||
* single logical {@code (line; column)} pair matches soft wrap-introduced virtual space, i.e. different visual positions
|
||||
* correspond to the same logical position. It's convenient to store exact visual location details within the logical
|
||||
* position in order to relief further {@code 'logical position' -> 'visual position'} mapping.
|
||||
* <p>
|
||||
* Logical position corresponds to a boundary between two characters and can be associated with either a preceding or succeeding character
|
||||
* Logical position corresponds to a boundary between two characters and can be associated with either a preceding or succeeding character
|
||||
* (see {@link #leansForward}). This association makes a difference in a bidirectional text, where a mapping from logical to visual position
|
||||
* is not continuous.
|
||||
* <p>
|
||||
@@ -46,68 +27,58 @@ import java.awt.*;
|
||||
*
|
||||
* @see Editor#xyToLogicalPosition(Point)
|
||||
*/
|
||||
@SuppressWarnings("FieldMayBeStatic") // To be removed after deprecated fields are removed
|
||||
public class LogicalPosition implements Comparable<LogicalPosition> {
|
||||
public final int line;
|
||||
public final int column;
|
||||
|
||||
/**
|
||||
* Identifies if current logical position may be correctly mapped to visual position. E.g. we can define properties like
|
||||
* {@link #softWrapLinesBeforeCurrentLogicalLine}, {@link #softWrapColumnDiff} etc during {@code 'visual position' -> 'logical position'} conversion
|
||||
* in order to be able to easy match it back to visual position.
|
||||
*
|
||||
* @deprecated Always {@code false} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Will be removed in future.
|
||||
* @deprecated Not used by platform code since 2018.2.
|
||||
* Always {@code false} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Always {@code false} since 2018.2.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public final boolean visualPositionAware;
|
||||
public final boolean visualPositionAware = false;
|
||||
|
||||
/**
|
||||
* Number of virtual soft wrap-introduced lines before the current logical line.
|
||||
*
|
||||
* @see #visualPositionAware
|
||||
* @deprecated Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Will be removed in future.
|
||||
* @deprecated Not used by platform code since 2018.2.
|
||||
* Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Always {@code 0} since 2018.2.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public final int softWrapLinesBeforeCurrentLogicalLine;
|
||||
public final int softWrapLinesBeforeCurrentLogicalLine = 0;
|
||||
|
||||
/**
|
||||
* Number of virtual soft wrap introduced lines on a current logical line before the visual position that corresponds
|
||||
* to the current logical position.
|
||||
* <p>
|
||||
* Instead of directly using this value, EditorUtil.getSoftWrapCountAfterLineStart(Editor, LogicalPosition) method can be used,
|
||||
* it will work regardless of whether current {@code LogicalPosition} instance is {@link #visualPositionAware}.
|
||||
*
|
||||
* @see #visualPositionAware
|
||||
* @deprecated Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Will be removed in future.
|
||||
* @deprecated Not used by platform code since 2018.2.
|
||||
* Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Always {@code 0} since 2018.2.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public final int softWrapLinesOnCurrentLogicalLine;
|
||||
public final int softWrapLinesOnCurrentLogicalLine = 0;
|
||||
|
||||
/**
|
||||
* Number to add to the {@link #column logical column} in order to get soft wrap-introduced visual column offset.
|
||||
*
|
||||
* @see #visualPositionAware
|
||||
* @deprecated Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Will be removed in future.
|
||||
* @deprecated Not used by platform code since 2018.2.
|
||||
* Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Always {@code 0} since 2018.2.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public final int softWrapColumnDiff;
|
||||
public final int softWrapColumnDiff = 0;
|
||||
|
||||
/**
|
||||
* Number of folded line feeds before the current position.
|
||||
*
|
||||
* @see #visualPositionAware
|
||||
* @deprecated Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Will be removed in future.
|
||||
* @deprecated Not used by platform code since 2018.2.
|
||||
* Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Always {@code 0} since 2018.2.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public final int foldedLines;
|
||||
public final int foldedLines = 0;
|
||||
|
||||
/**
|
||||
* Number to add to the {@link #column logical column} in order to get folding-introduced visual column offset.
|
||||
*
|
||||
* @see #visualPositionAware
|
||||
* @deprecated Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Will be removed in future.
|
||||
* @deprecated Not used by platform code since 2018.2.
|
||||
* Always {@code 0} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Always {@code 0} since 2018.2.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public final int foldingColumnDiff;
|
||||
public final int foldingColumnDiff = 0;
|
||||
|
||||
/**
|
||||
* If {@code true}, this position is associated with succeeding character (in logical order), otherwise it's associated with
|
||||
@@ -119,94 +90,67 @@ public class LogicalPosition implements Comparable<LogicalPosition> {
|
||||
public final boolean leansForward;
|
||||
|
||||
/**
|
||||
* This field provides the value of {@link VisualPosition#leansRight} field of visual position corresponding to current position.
|
||||
* It has meaning only if {@link #visualPositionAware} is set.
|
||||
*
|
||||
* @deprecated Always {@code false} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Will be removed in future.
|
||||
* @deprecated Not used by platform code since 2018.2.
|
||||
* Always {@code false} in {@link LogicalPosition} instances returned by platform code since 2016.1.
|
||||
* Always {@code false} since 2018.2.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public final boolean visualPositionLeansRight;
|
||||
public final boolean visualPositionLeansRight = false;
|
||||
|
||||
public LogicalPosition(int line, int column) throws IllegalArgumentException {
|
||||
this(line, column, 0, 0, 0, 0, 0, false, false, false);
|
||||
this(line, column, false);
|
||||
}
|
||||
|
||||
public LogicalPosition(int line, int column, boolean leansForward) throws IllegalArgumentException {
|
||||
this(line, column, 0, 0, 0, 0, 0, false, leansForward, leansForward);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #LogicalPosition(int, int)} instead. Additional fields won't be used in future.
|
||||
*/
|
||||
public LogicalPosition(int line, int column, int softWrapLinesBeforeCurrentLogicalLine, int softWrapLinesOnCurrentLogicalLine,
|
||||
int softWrapColumnDiff, int foldedLines, int foldingColumnDiff) throws IllegalArgumentException {
|
||||
this(line, column, softWrapLinesBeforeCurrentLogicalLine, softWrapLinesOnCurrentLogicalLine, softWrapColumnDiff, foldedLines,
|
||||
foldingColumnDiff, true, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #LogicalPosition(int, int, boolean)} instead. Additional fields won't be used in future.
|
||||
*/
|
||||
public LogicalPosition(int line, int column, int softWrapLinesBeforeCurrentLogicalLine, int softWrapLinesOnCurrentLogicalLine,
|
||||
int softWrapColumnDiff, int foldedLines, int foldingColumnDiff, boolean leansForward,
|
||||
boolean visualPositionLeansRight) throws IllegalArgumentException {
|
||||
this(line, column, softWrapLinesBeforeCurrentLogicalLine, softWrapLinesOnCurrentLogicalLine, softWrapColumnDiff, foldedLines,
|
||||
foldingColumnDiff, true, leansForward, visualPositionLeansRight);
|
||||
}
|
||||
|
||||
private LogicalPosition(int line, int column, int softWrapLinesBeforeCurrentLogicalLine, int softWrapLinesOnCurrentLogicalLine,
|
||||
int softWrapColumnDiff, int foldedLines, int foldingColumnDiff, boolean visualPositionAware,
|
||||
boolean leansForward, boolean visualPositionLeansRight)
|
||||
throws IllegalArgumentException {
|
||||
if (column + softWrapColumnDiff + foldingColumnDiff < 0) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Attempt to create %s with invalid arguments - resulting column is negative (%d). Given arguments: line=%d, column=%d, "
|
||||
+ "soft wrap lines before: %d, soft wrap lines current: %d, soft wrap column diff: %d, folded lines: %d, folding column "
|
||||
+ "diff: %d, visual position aware: %b",
|
||||
getClass().getName(), column + softWrapColumnDiff + foldingColumnDiff, line, column, softWrapLinesBeforeCurrentLogicalLine,
|
||||
softWrapLinesOnCurrentLogicalLine, softWrapColumnDiff, foldedLines, foldingColumnDiff, visualPositionAware
|
||||
));
|
||||
}
|
||||
if (line < 0) throw new IllegalArgumentException("line must be non negative: "+line);
|
||||
if (column < 0) throw new IllegalArgumentException("column must be non negative: "+column);
|
||||
this.line = line;
|
||||
this.column = column;
|
||||
this.softWrapLinesBeforeCurrentLogicalLine = softWrapLinesBeforeCurrentLogicalLine;
|
||||
this.softWrapLinesOnCurrentLogicalLine = softWrapLinesOnCurrentLogicalLine;
|
||||
this.softWrapColumnDiff = softWrapColumnDiff;
|
||||
this.foldedLines = foldedLines;
|
||||
this.foldingColumnDiff = foldingColumnDiff;
|
||||
this.visualPositionAware = visualPositionAware;
|
||||
this.leansForward = leansForward;
|
||||
this.visualPositionLeansRight = visualPositionLeansRight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #LogicalPosition(int, int)} instead.
|
||||
* Additional fields are not used since 2018.2. To be removed in 2019.2.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public LogicalPosition(int line, int column, int softWrapLinesBeforeCurrentLogicalLine, int softWrapLinesOnCurrentLogicalLine,
|
||||
int softWrapColumnDiff, int foldedLines, int foldingColumnDiff) throws IllegalArgumentException {
|
||||
this(line, column, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #LogicalPosition(int, int, boolean)} instead.
|
||||
* Additional fields are not used since 2018.2. To be removed in 2019.2.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public LogicalPosition(int line, int column, int softWrapLinesBeforeCurrentLogicalLine, int softWrapLinesOnCurrentLogicalLine,
|
||||
int softWrapColumnDiff, int foldedLines, int foldingColumnDiff, boolean leansForward,
|
||||
boolean visualPositionLeansRight) throws IllegalArgumentException {
|
||||
this(line, column, leansForward);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds visual position based on a state of the current logical position.
|
||||
* <p/>
|
||||
* Such visual position is considered to make sense only if current logical position
|
||||
* is {@link #visualPositionAware visual position aware}.
|
||||
*
|
||||
* @return visual position based on a state of the current logical position
|
||||
*
|
||||
* @deprecated Result doesn't makes sense, since {@link #visualPositionAware} is deprecated.
|
||||
* @deprecated Result doesn't makes sense since 2018.2 - it just returns a visual position with same line and column as logical position.
|
||||
* To convert logical to visual position, use {@link Editor#logicalToVisualPosition(LogicalPosition)}.
|
||||
* To be removed in 2019.2.
|
||||
*/
|
||||
public VisualPosition toVisualPosition() {
|
||||
return new VisualPosition(
|
||||
line + softWrapLinesBeforeCurrentLogicalLine + softWrapLinesOnCurrentLogicalLine - foldedLines,
|
||||
column + softWrapColumnDiff + foldingColumnDiff,
|
||||
visualPositionLeansRight
|
||||
);
|
||||
return new VisualPosition(line, column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of class corresponding to the same logical position in the document, but without any cached
|
||||
* reference to its visual position.
|
||||
*
|
||||
* @deprecated Not needed, since {@link #visualPositionAware} is deprecated.
|
||||
* @deprecated Not needed since 2018.2 (just returns {@code this}). To be removed in 2019.2.
|
||||
*/
|
||||
public LogicalPosition withoutVisualPositionInfo() {
|
||||
return new LogicalPosition(line, column, leansForward);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,22 +174,12 @@ public class LogicalPosition implements Comparable<LogicalPosition> {
|
||||
@NonNls
|
||||
public String toString() {
|
||||
return "LogicalPosition: (" + line + ", " + column + ")"
|
||||
+ (visualPositionAware ? "; vp aware" : "")
|
||||
+ (softWrapLinesBeforeCurrentLogicalLine + softWrapLinesOnCurrentLogicalLine == 0
|
||||
? ""
|
||||
: "; soft wrap: lines=" + (softWrapLinesBeforeCurrentLogicalLine + softWrapLinesOnCurrentLogicalLine)
|
||||
+ " (before=" + softWrapLinesBeforeCurrentLogicalLine + "; current=" + softWrapLinesOnCurrentLogicalLine + ")")
|
||||
+ (softWrapColumnDiff == 0 ? "" : "; columns diff=" + softWrapColumnDiff + ";" )
|
||||
+ (foldedLines == 0? "" : "; folding: lines = " + foldedLines + ";")
|
||||
+ (foldingColumnDiff == 0 ? "" : "; columns diff=" + foldingColumnDiff)
|
||||
+ (leansForward ? "; leans forward" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull LogicalPosition position) {
|
||||
if (line != position.line) return line - position.line;
|
||||
if (column != position.column) return column - position.column;
|
||||
if (softWrapLinesBeforeCurrentLogicalLine != position.softWrapLinesBeforeCurrentLogicalLine) return softWrapLinesBeforeCurrentLogicalLine - position.softWrapLinesBeforeCurrentLogicalLine;
|
||||
return softWrapColumnDiff - position.softWrapColumnDiff;
|
||||
return column - position.column;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,13 +718,8 @@ public final class EditorUtil {
|
||||
/**
|
||||
* Number of virtual soft wrap introduced lines on a current logical line before the visual position that corresponds
|
||||
* to the current logical position.
|
||||
*
|
||||
* @see LogicalPosition#softWrapLinesOnCurrentLogicalLine
|
||||
*/
|
||||
public static int getSoftWrapCountAfterLineStart(@NotNull Editor editor, @NotNull LogicalPosition position) {
|
||||
if (position.visualPositionAware) {
|
||||
return position.softWrapLinesOnCurrentLogicalLine;
|
||||
}
|
||||
int startOffset = editor.getDocument().getLineStartOffset(position.line);
|
||||
int endOffset = editor.logicalPositionToOffset(position);
|
||||
return editor.getSoftWrapModel().getSoftWrapsForRange(startOffset, endOffset).size();
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor.impl;
|
||||
|
||||
import com.intellij.diagnostic.Dumpable;
|
||||
@@ -365,11 +363,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
validateCallContext();
|
||||
int column = pos.column;
|
||||
int line = pos.line;
|
||||
int softWrapLinesBefore = pos.softWrapLinesBeforeCurrentLogicalLine;
|
||||
int softWrapLinesCurrent = pos.softWrapLinesOnCurrentLogicalLine;
|
||||
int softWrapColumns = pos.softWrapColumnDiff;
|
||||
boolean leansForward = pos.leansForward;
|
||||
boolean leansRight = pos.visualPositionLeansRight;
|
||||
|
||||
Document doc = myEditor.getDocument();
|
||||
|
||||
@@ -386,8 +380,6 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
.append(" as it is greater than total document lines number\n");
|
||||
}
|
||||
line = lineCount - 1;
|
||||
softWrapLinesBefore = 0;
|
||||
softWrapLinesCurrent = 0;
|
||||
}
|
||||
|
||||
EditorSettings editorSettings = myEditor.getSettings();
|
||||
@@ -400,15 +392,10 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
int oldColumn = column;
|
||||
column = lineEndColumnNumber;
|
||||
leansForward = true;
|
||||
leansRight = true;
|
||||
if (softWrapColumns != 0) {
|
||||
softWrapColumns -= column - lineEndColumnNumber;
|
||||
}
|
||||
if (debugBuffer != null) {
|
||||
debugBuffer.append("Resetting target logical column (").append(oldColumn).append(") to ").append(lineEndColumnNumber)
|
||||
.append(" because caret is not allowed to be located after line end (offset: ").append(lineEndOffset).append(", ")
|
||||
.append("logical position: ").append(endLinePosition).append("). Current soft wrap columns value: ").append(softWrapColumns)
|
||||
.append("\n");
|
||||
.append("logical position: ").append(endLinePosition).append(").\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -419,16 +406,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
LogicalPosition oldCaretPosition = myLogicalCaret;
|
||||
VisualPosition oldVisualPosition = myVisibleCaret;
|
||||
|
||||
LogicalPosition logicalPositionToUse;
|
||||
if (pos.visualPositionAware) {
|
||||
logicalPositionToUse = new LogicalPosition(
|
||||
line, column, softWrapLinesBefore, softWrapLinesCurrent, softWrapColumns, pos.foldedLines, pos.foldingColumnDiff,
|
||||
leansForward, leansRight
|
||||
);
|
||||
}
|
||||
else {
|
||||
logicalPositionToUse = new LogicalPosition(line, column, leansForward);
|
||||
}
|
||||
LogicalPosition logicalPositionToUse = new LogicalPosition(line, column, leansForward);
|
||||
final int offset = myEditor.logicalPositionToOffset(logicalPositionToUse);
|
||||
if (debugBuffer != null) {
|
||||
debugBuffer.append("Resulting logical position to use: ").append(logicalPositionToUse).append(". It's mapped to offset ").append(offset).append("\n");
|
||||
@@ -454,7 +432,6 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
finally {
|
||||
mySkipChangeRequests = false;
|
||||
}
|
||||
logicalPositionToUse = logicalPositionToUse.visualPositionAware ? logicalPositionToUse.withoutVisualPositionInfo() : logicalPositionToUse;
|
||||
}
|
||||
|
||||
setCurrentLogicalCaret(logicalPositionToUse);
|
||||
|
||||
@@ -1114,7 +1114,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
Rectangle visibleArea = myScrollingModel.getVisibleArea();
|
||||
Point zoomCenterRelative = zoomCenter == null ? new Point() : zoomCenter;
|
||||
Point zoomCenterAbsolute = new Point(visibleArea.x + zoomCenterRelative.x, visibleArea.y + zoomCenterRelative.y);
|
||||
LogicalPosition zoomCenterLogical = xyToLogicalPosition(zoomCenterAbsolute).withoutVisualPositionInfo();
|
||||
LogicalPosition zoomCenterLogical = xyToLogicalPosition(zoomCenterAbsolute);
|
||||
int oldLineHeight = getLineHeight();
|
||||
int intraLineOffset = zoomCenterAbsolute.y % oldLineHeight;
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedInternalDocu
|
||||
// There is a possible case that caret position is already visual position aware. But visual position depends on number of folded
|
||||
// logical lines as well, hence, we can't be sure that target logical position defines correct visual position because fold
|
||||
// regions have just changed. Hence, we use 'raw' logical position instead.
|
||||
LogicalPosition caretPosition = caret.getLogicalPosition().withoutVisualPositionInfo();
|
||||
LogicalPosition caretPosition = caret.getLogicalPosition();
|
||||
int caretOffset = myEditor.logicalPositionToOffset(caretPosition);
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
@@ -695,7 +695,7 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedInternalDocu
|
||||
private final long docStamp;
|
||||
|
||||
private SavedCaretPosition(Caret caret) {
|
||||
position = caret.getLogicalPosition().withoutVisualPositionInfo();
|
||||
position = caret.getLogicalPosition();
|
||||
docStamp = caret.getEditor().getDocument().getModificationStamp();
|
||||
}
|
||||
|
||||
|
||||
+2
-16
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor.impl.softwrap.mapping;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -74,7 +60,7 @@ public class IncrementalCacheUpdateEvent {
|
||||
myStartOffset = 0;
|
||||
myMandatoryEndOffset = document.getTextLength();
|
||||
myLengthDiff = 0;
|
||||
myStartLogicalPosition = new LogicalPosition(0, 0, 0, 0, 0, 0, 0);
|
||||
myStartLogicalPosition = new LogicalPosition(0, 0);
|
||||
myOldEndLogicalLine = myNewEndLogicalLine = Math.max(0, document.getLineCount() - 1);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor.impl.softwrap.mapping;
|
||||
|
||||
import com.intellij.codeInsight.folding.CodeFoldingManager;
|
||||
@@ -538,7 +538,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorT
|
||||
type('a');
|
||||
|
||||
LogicalPosition logicalPositionAfter = myEditor.visualToLogicalPosition(changePosition);
|
||||
assertEquals(new LogicalPosition(1, 0, 0, 0, 0, 0, 0), logicalPositionAfter);
|
||||
assertEquals(new LogicalPosition(1, 0), logicalPositionAfter);
|
||||
assertEquals(offsetBefore + softWrap.getText().length() + 1, myEditor.getCaretModel().getOffset());
|
||||
assertEquals(logicalLinesBefore + 1, myEditor.offsetToLogicalPosition(text.length()).line);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user