Search in sources :

Example 31 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class RangeMarkerTest method testMoveTextRetargetsMarkers.

public void testMoveTextRetargetsMarkers() throws Exception {
    RangeMarkerEx marker1 = createMarker("01234567890", 1, 3);
    DocumentEx document = (DocumentEx) marker1.getDocument();
    RangeMarker marker2 = document.createRangeMarker(2, 4);
    document.moveText(0, 5, 8);
    assertEquals("56701234890", document.getText());
    assertValidMarker(marker1, 4, 6);
    assertValidMarker(marker2, 5, 7);
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) RangeMarkerEx(com.intellij.openapi.editor.ex.RangeMarkerEx)

Example 32 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class RangeMarkerTest method testE2.

public void testE2() {
    DocumentEx document = (DocumentEx) EditorFactory.getInstance().createDocument(StringUtil.repeatSymbol(' ', 10));
    List<RangeMarker> mm = add(document, 0, 3, 6, 9, 8, 8);
    edit(document, 0, 3, 0);
    delete(mm, 0);
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx)

Example 33 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class RangeMarkerTest method testMoveText2.

public void testMoveText2() throws Exception {
    RangeMarkerEx marker1 = createMarker(StringUtil.repeat(" ", 100), 0, 0);
    DocumentEx document = (DocumentEx) marker1.getDocument();
    RangeMarker marker2 = document.createRangeMarker(49, 49);
    document.moveText(0, 1, 49);
    marker1.dispose();
    marker2.dispose();
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) RangeMarkerEx(com.intellij.openapi.editor.ex.RangeMarkerEx)

Example 34 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class RangeMarkerTest method testX2.

public void testX2() {
    DocumentEx document = (DocumentEx) EditorFactory.getInstance().createDocument(StringUtil.repeatSymbol(' ', 10));
    List<RangeMarker> mm = add(document, 2, 9, 0, 0, 7, 7);
    delete(mm, 0);
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx)

Example 35 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class RangeMarkerTest method testE12.

public void testE12() {
    DocumentEx document = (DocumentEx) EditorFactory.getInstance().createDocument(StringUtil.repeatSymbol(' ', 10));
    List<RangeMarker> mm = add(document, 3, 3, 8, 8, 5, 5, 5, 6);
    edit(document, 2, 0, 2);
    delete(mm, 2);
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx)

Aggregations

DocumentEx (com.intellij.openapi.editor.ex.DocumentEx)87 Document (com.intellij.openapi.editor.Document)12 NotNull (org.jetbrains.annotations.NotNull)8 RangeMarkerEx (com.intellij.openapi.editor.ex.RangeMarkerEx)7 Project (com.intellij.openapi.project.Project)7 TextRange (com.intellij.openapi.util.TextRange)7 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)7 PsiFile (com.intellij.psi.PsiFile)6 Nullable (org.jetbrains.annotations.Nullable)5 EditorEx (com.intellij.openapi.editor.ex.EditorEx)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 MockVirtualFile (com.intellij.mock.MockVirtualFile)3 FoldRegion (com.intellij.openapi.editor.FoldRegion)3 PsiDocumentManager (com.intellij.psi.PsiDocumentManager)3 DocumentWindow (com.intellij.injected.editor.DocumentWindow)2 DocumentBulkUpdateListener (com.intellij.openapi.editor.ex.DocumentBulkUpdateListener)2 DocumentImpl (com.intellij.openapi.editor.impl.DocumentImpl)2 DocumentMarkupModel (com.intellij.openapi.editor.impl.DocumentMarkupModel)2 RangeHighlighter (com.intellij.openapi.editor.markup.RangeHighlighter)2 FileDocumentManagerAdapter (com.intellij.openapi.fileEditor.FileDocumentManagerAdapter)2