mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-113684 Soft wraps insert additional spaces
This commit is contained in:
@@ -36,6 +36,7 @@ import com.intellij.openapi.editor.ex.util.EditorUtil;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.LightHighlighterClient;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
|
||||
import com.intellij.openapi.editor.impl.TextDrawingCallback;
|
||||
import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces;
|
||||
import com.intellij.openapi.editor.markup.MarkupModel;
|
||||
@@ -73,6 +74,7 @@ public class EditorWindow extends UserDataHolderBase implements EditorEx {
|
||||
private boolean myDisposed;
|
||||
private final MarkupModelWindow myMarkupModelDelegate;
|
||||
private final FoldingModelWindow myFoldingModelWindow;
|
||||
private final SoftWrapModelImpl mySoftWrapModel;
|
||||
|
||||
public static Editor create(@NotNull final DocumentWindowImpl documentRange, @NotNull final EditorImpl editor, @NotNull final PsiFile injectedFile) {
|
||||
assert documentRange.isValid();
|
||||
@@ -106,6 +108,8 @@ public class EditorWindow extends UserDataHolderBase implements EditorEx {
|
||||
mySelectionModelDelegate = new SelectionModelWindow(myDelegate, myDocumentWindow,this);
|
||||
myMarkupModelDelegate = new MarkupModelWindow((MarkupModelEx)myDelegate.getMarkupModel(), myDocumentWindow);
|
||||
myFoldingModelWindow = new FoldingModelWindow(delegate.getFoldingModel(), documentWindow, this);
|
||||
mySoftWrapModel = new SoftWrapModelImpl(this);
|
||||
Disposer.register(myDocumentWindow, mySoftWrapModel);
|
||||
}
|
||||
|
||||
public static void disposeInvalidEditors() {
|
||||
@@ -262,7 +266,7 @@ public class EditorWindow extends UserDataHolderBase implements EditorEx {
|
||||
@Override
|
||||
@NotNull
|
||||
public SoftWrapModelEx getSoftWrapModel() {
|
||||
return myDelegate.getSoftWrapModel();
|
||||
return mySoftWrapModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
*/
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
|
||||
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
* Date: 25.11.13
|
||||
*/
|
||||
public class SoftWrapTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
public void testSoftWrapInInjection() throws Exception {
|
||||
|
||||
myFixture.configureByFile("softWrap.html");
|
||||
Editor editor = myFixture.getEditor();
|
||||
editor.getSettings().setUseSoftWraps(true);
|
||||
((SoftWrapModelImpl)editor.getSoftWrapModel()).getApplianceManager().setWidthProvider(new SoftWrapApplianceManager.VisibleAreaWidthProvider() {
|
||||
@Override
|
||||
public int getVisibleAreaWidth() {
|
||||
return 600;
|
||||
}
|
||||
});
|
||||
|
||||
myFixture.type('j');
|
||||
myFixture.checkResultByFile("softWrap_after.html");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/xml/tests/testData/softWrap";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCommunity() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<!-- -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<!--[if IE]>
|
||||
<link rel="stylesheet" href="<caret>" type="text/css" media="all"/>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
<!-- -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<!--[if IE]>
|
||||
<link rel="stylesheet" href="j<caret>" type="text/css" media="all"/>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user