Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
272,000
RangeHighlighter (int startOffset, int endOffset, int layer, TextAttributes attributes) { return getEditor().getMarkupModel().addRangeHighlighter(startOffset, endOffset, layer, attributes, HighlighterTargetArea.LINES_IN_RANGE); }
addLineHighlighter
272,001
RangeHighlighter (int startOffset, int endOffset, int layer, TextAttributes attributes) { return getEditor().getMarkupModel().addRangeHighlighter(startOffset, endOffset, layer, attributes, HighlighterTargetArea.EXACT_RANGE); }
addRangeHighlighter
272,002
void (boolean visible) { getEditor().getSettings().setCaretRowShown(visible); }
setCaretRowVisible
272,003
void (int width) { getEditor().getSettings().setLineCursorWidth(width); }
setLineCursorWidth
272,004
void (Color color) { getDefaultColorScheme().setColor(EditorColors.CARET_COLOR, color); }
setCaretColor
272,005
void (String name, int size) { getDefaultColorScheme().setEditorFontName(name); getDefaultColorScheme().setEditorFontSize(size); }
setFont
272,006
void (float lineSpacing) { getDefaultColorScheme().setLineSpacing(lineSpacing); }
setLineSpacing
272,007
EditorColorsScheme () { return EditorColorsUtil.getGlobalOrDefaultColorScheme(); }
getDefaultColorScheme
272,008
void (boolean enabled) { ImmediatePainter.ENABLED.setValue(enabled); }
setZeroLatencyRenderingEnabled
272,009
void (boolean enabled) { ImmediatePainter.DOUBLE_BUFFERING.setValue(enabled); }
setDoubleBufferingEnabled
272,010
void (boolean blockCursor) { getEditor().getSettings().setBlockCursor(blockCursor); }
setBlockCursor
272,011
void (boolean fullLineHeightCursor) { getEditor().getSettings().setFullLineHeightCursor(fullLineHeightCursor); }
setFullLineHeightCursor
272,012
TextAttributes (Color color) { return new TextAttributes(null, color, null, null, Font.PLAIN); }
background
272,013
TextAttributes (Color color) { return new TextAttributes(color, null, null, null, Font.PLAIN); }
foreground
272,014
void () { ThreadingAssertions.assertEventDispatchThread(); initText(" ".repeat(100)); Document document = getDocument(getFile()); MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); List<String> events = new ArrayList<>(); addMarkupListener(markupModel, events); checkEventsFiredSynchronously(markupModel, events); }
testMarkupModelListenersDoWork
272,015
void (MarkupModelEx markupModel, List<String> events) { RangeHighlighter highlighter = markupModel.addRangeHighlighter(1, 2, 0, null, HighlighterTargetArea.EXACT_RANGE); List<String> expected = new ArrayList<>(); assertEventsFired(expected, events, "(1,2): AA"); highlighter.setCustomRenderer((editor, highlighter1, g) -> {}); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setEditorFilter(__ -> true); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setErrorStripeMarkColor(new Color(1)); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setErrorStripeTooltip(this); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setGutterIconRenderer(MarkupModelStressTest.DUMMY_GUTTER_ICON_RENDERER); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setLineMarkerRenderer((editor, g, r) -> {}); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setLineSeparatorColor(new Color(1)); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setLineSeparatorPlacement(SeparatorPlacement.BOTTOM); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setLineSeparatorRenderer((g, x1, x2, y) -> {}); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setTextAttributesKey(CodeInsightColors.LINE_NONE_COVERAGE); assertEventsFired(expected, events, "(1,2): AC"); highlighter.setThinErrorStripeMark(true); assertEventsFired(expected, events, "(1,2): AC"); highlighter.dispose(); assertEventsFired(expected, events,"(1,2): BR", "(1,2): AR"); }
checkEventsFiredSynchronously
272,016
void (@NotNull MarkupModelEx markupModel, @NotNull List<? super String> events) { markupModel.addMarkupModelListener(getTestRootDisposable(), new MarkupModelListener() { @Override public void afterAdded(@NotNull RangeHighlighterEx highlighter) { events.add(highlighter.getTextRange() + ": AA"); } @Override public void beforeRemoved(@NotNull RangeHighlighterEx highlighter) { events.add(highlighter.getTextRange() + ": BR"); } @Override public void afterRemoved(@NotNull RangeHighlighterEx highlighter) { events.add(highlighter.getTextRange() + ": AR"); } @Override public void attributesChanged(@NotNull RangeHighlighterEx highlighter, boolean renderersChanged, boolean fontStyleOrColorChanged) { events.add(highlighter.getTextRange() + ": AC"); } }); }
addMarkupListener
272,017
void (@NotNull RangeHighlighterEx highlighter) { events.add(highlighter.getTextRange() + ": AA"); }
afterAdded
272,018
void (@NotNull RangeHighlighterEx highlighter) { events.add(highlighter.getTextRange() + ": BR"); }
beforeRemoved
272,019
void (@NotNull RangeHighlighterEx highlighter) { events.add(highlighter.getTextRange() + ": AR"); }
afterRemoved
272,020
void (@NotNull RangeHighlighterEx highlighter, boolean renderersChanged, boolean fontStyleOrColorChanged) { events.add(highlighter.getTextRange() + ": AC"); }
attributesChanged
272,021
void (List<String> expected, List<String> actualEvents, String... events) { expected.addAll(List.of(events)); assertEquals(expected, actualEvents); }
assertEventsFired
272,022
void () { ThreadingAssertions.assertEventDispatchThread(); initText(" ".repeat(100)); Document document = getDocument(getFile()); MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); List<String> events = new ArrayList<>(); addMarkupListener(markupModel, events); List<String> expected = new ArrayList<>(); RangeHighlighter highlighter = markupModel.addRangeHighlighter(1, 2, 0, null, HighlighterTargetArea.EXACT_RANGE); assertEventsFired(expected, events, "(1,2): AA"); RangeHighlighter highlighter2 = markupModel.addRangeHighlighter(2, 3, 0, null, HighlighterTargetArea.EXACT_RANGE); assertEventsFired(expected, events, "(2,3): AA"); markupModel.removeAllHighlighters(); assertEventsFired(expected, events, "(1,2): BR", "(1,2): AR", "(2,3): BR", "(2,3): AR"); assertFalse(highlighter.isValid()); assertFalse(highlighter2.isValid()); assertEmpty((markupModel.getAllHighlighters())); }
testRangeMarkerTreeClearMustFireRemoveEvents
272,023
void () { initText(" ".repeat(100)); Document document = getDocument(getFile()); MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); List<String> events = new ArrayList<>(); addMarkupListener(markupModel, events); RangeHighlighter highlighter = markupModel.addRangeHighlighter(10, 11, 1, null, HighlighterTargetArea.EXACT_RANGE); List<String> expected = new ArrayList<>(); assertEventsFired(expected, events, "(10,11): AA"); WriteAction.run(() -> document.deleteString(5, 20)); assertFalse(highlighter.isValid()); assertEventsFired(expected, events, "(10,11): BR", "(10,11): AR"); }
testMarkupModelListenersFireAfterDocumentChangeLedToRangeHighlighterRemoval
272,024
void () { initText(" ".repeat(100)); Document document = getDocument(getFile()); MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); RangeHighlighter highlighter = markupModel.addRangeHighlighter(10, 11, 1, null, HighlighterTargetArea.EXACT_RANGE); RangeHighlighter highlighter2 = markupModel.addRangeHighlighter(10, 11, 1, null, HighlighterTargetArea.EXACT_RANGE); AtomicInteger fired = new AtomicInteger(); markupModel.addMarkupModelListener(getTestRootDisposable(), new MarkupModelListener() { @Override public void beforeRemoved(@NotNull RangeHighlighterEx highlighter1) { fired.incrementAndGet(); assertSame(highlighter, highlighter1); assertTrue(highlighter2.isValid()); assertThrows(IncorrectOperationException.class, ()->markupModel.addRangeHighlighter(1, 3, 1, null, HighlighterTargetArea.EXACT_RANGE)); assertThrows(IncorrectOperationException.class, ()->markupModel.removeHighlighter(highlighter2)); } }); highlighter.dispose(); assertEquals(1, fired.get()); }
testMustNotAllowCrazyStuffFromInsideMarkupModelListenerDuringHighlighterRemove
272,025
void (@NotNull RangeHighlighterEx highlighter1) { fired.incrementAndGet(); assertSame(highlighter, highlighter1); assertTrue(highlighter2.isValid()); assertThrows(IncorrectOperationException.class, ()->markupModel.addRangeHighlighter(1, 3, 1, null, HighlighterTargetArea.EXACT_RANGE)); assertThrows(IncorrectOperationException.class, ()->markupModel.removeHighlighter(highlighter2)); }
beforeRemoved
272,026
void () { initText("ab"); addInlay(1); right(); checkCaretPosition(1, 1, 1); right(); checkCaretPosition(1, 1, 2); right(); checkCaretPosition(2, 2, 3); left(); checkCaretPosition(1, 1, 2); left(); checkCaretPosition(1, 1, 1); left(); checkCaretPosition(0, 0, 0); }
testCaretMovement
272,027
void () { initText("abc"); addInlay(1); addCollapsedFoldRegion(1, 2, "."); right(); checkCaretPosition(1, 1, 1); right(); checkCaretPosition(2, 2, 2); }
testFoldedInlay
272,028
void () { initText("ab"); addInlay(1); rightWithSelection(); checkCaretPositionAndSelection(1, 1, 1, 0, 1); rightWithSelection(); checkCaretPositionAndSelection(2, 2, 3, 0, 2); leftWithSelection(); checkCaretPositionAndSelection(1, 1, 1, 0, 1); leftWithSelection(); checkCaretPositionAndSelection(0, 0, 0, 0, 0); getEditor().getCaretModel().moveToOffset(2); leftWithSelection(); checkCaretPositionAndSelection(1, 1, 2, 1, 2); leftWithSelection(); checkCaretPositionAndSelection(0, 0, 0, 0, 2); rightWithSelection(); checkCaretPositionAndSelection(1, 1, 2, 1, 2); rightWithSelection(); checkCaretPositionAndSelection(2, 2, 3, 2, 2); }
testCaretMovementWithSelection
272,029
void () { initText("ab<caret>c"); addInlay(1); backspace(); checkResultByText("ac"); checkCaretPosition(1, 1, 2); backspace(); checkResultByText("ac"); checkCaretPosition(1, 1, 1); backspace(); checkResultByText("c"); checkCaretPosition(0, 0, 0); }
testBackspace
272,030
void () { initText("a<caret>bc"); addInlay(2); delete(); checkResultByText("ac"); checkCaretPosition(1, 1, 1); delete(); checkResultByText("ac"); checkCaretPosition(1, 1, 2); delete(); checkResultByText("a"); checkCaretPosition(1, 1, 2); }
testDelete
272,031
void () { initText("<caret>ab <caret>ab"); addInlay(1); addInlay(4); right(); delete(); checkResultByText("a<caret>b a<caret>b"); delete(); checkResultByText("a<caret> a<caret>"); }
testMulticaretDelete
272,032
void () { initText("<caret>ab <caret>ab"); addInlay(1); addInlay(4); right(); type(' '); checkResultByText("a <caret>b a <caret>b"); assertEquals(Arrays.asList(new VisualPosition(0, 2), new VisualPosition(0, 7)), ContainerUtil.map(getEditor().getCaretModel().getAllCarets(), Caret::getVisualPosition)); right(); type(' '); checkResultByText("a <caret>b a <caret>b"); assertEquals(Arrays.asList(new VisualPosition(0, 4), new VisualPosition(0, 10)), ContainerUtil.map(getEditor().getCaretModel().getAllCarets(), Caret::getVisualPosition)); }
testMulticaretTyping
272,033
void () { initText("long line"); configureSoftWraps(7); Inlay<?> inlay = addInlay(1); assertNotNull(getEditor().getSoftWrapModel().getSoftWrap(5)); runWriteCommand(() -> getEditor().getDocument().setText(" ")); assertFalse(inlay.isValid()); }
testDocumentEditingWithSoftWraps
272,034
void () { initText(""); // Cannot set up text with singular surrogate characters directly runWriteCommand(() -> getEditor().getDocument().setText(HIGH_SURROGATE + LOW_SURROGATE + LOW_SURROGATE)); Inlay<?> inlay = addInlay(2); assertNotNull(inlay); assertTrue(inlay.isValid()); runWriteCommand(() -> ((DocumentEx)getEditor().getDocument()).moveText(2, 3, 1)); assertFalse(inlay.isValid() && DocumentUtil.isInsideSurrogatePair(getEditor().getDocument(), inlay.getOffset())); }
testInlayDoesntGetInsideSurrogatePair
272,035
void () { initText("ab"); addInlay(1); addInlay(1); right(); checkCaretPosition(1, 1, 1); right(); checkCaretPosition(1, 1, 2); right(); checkCaretPosition(1, 1, 3); right(); checkCaretPosition(2, 2, 4); left(); checkCaretPosition(1, 1, 3); left(); checkCaretPosition(1, 1, 2); left(); checkCaretPosition(1, 1, 1); left(); checkCaretPosition(0, 0, 0); }
testTwoInlaysAtSameOffset
272,036
void () { initText("ab"); Inlay<?> inlay1 = addInlay(1); Inlay<?> inlay2 = addInlay(1); right(); right(); type(' '); checkResultByText("a <caret>b"); checkCaretPosition(2, 2, 3); assertTrue(inlay1.isValid()); assertEquals(1, inlay1.getOffset()); assertTrue(inlay2.isValid()); assertEquals(2, inlay2.getOffset()); }
testTypingBetweenInlaysAtSameOffset
272,037
void () { initText("ab"); addInlay(1); addInlay(1); assertTrue(getEditor().getInlayModel().hasInlineElementAt(new VisualPosition(0, 2))); }
testHasInlayAtVisualPosition
272,038
void () { initText("ab<caret>c"); addInlay(1); addInlay(1); backspace(); checkResultByText("ac"); checkCaretPosition(1, 1, 3); backspace(); checkResultByText("ac"); checkCaretPosition(1, 1, 2); backspace(); checkResultByText("ac"); checkCaretPosition(1, 1, 1); backspace(); checkResultByText("c"); checkCaretPosition(0, 0, 0); }
testBackspaceWithTwoInlaysAtSameOffset
272,039
void () { initText("a<caret>bc"); addInlay(2); addInlay(2); delete(); checkResultByText("ac"); checkCaretPosition(1, 1, 1); delete(); checkResultByText("ac"); checkCaretPosition(1, 1, 2); delete(); checkResultByText("ac"); checkCaretPosition(1, 1, 3); delete(); checkResultByText("a"); checkCaretPosition(1, 1, 3); }
testDeleteWithTwoInlaysAtSameOffset
272,040
void () { initText("ab"); addInlay(1); addInlay(1); rightWithSelection(); checkCaretPositionAndSelection(1, 1, 1, 0, 1); rightWithSelection(); checkCaretPositionAndSelection(2, 2, 4, 0, 2); leftWithSelection(); checkCaretPositionAndSelection(1, 1, 1, 0, 1); leftWithSelection(); checkCaretPositionAndSelection(0, 0, 0, 0, 0); getEditor().getCaretModel().moveToOffset(2); leftWithSelection(); checkCaretPositionAndSelection(1, 1, 3, 1, 2); leftWithSelection(); checkCaretPositionAndSelection(0, 0, 0, 0, 2); rightWithSelection(); checkCaretPositionAndSelection(1, 1, 3, 1, 2); rightWithSelection(); checkCaretPositionAndSelection(2, 2, 4, 2, 2); }
testSelectionWithTwoInlaysAtSameOffset
272,041
void () { initText("abc"); addInlay(1); addInlay(2); right(); right(); delete(); checkResultByText("ac"); checkCaretPosition(1, 1, 2); assertInlaysPositions(1, 1); }
testDeleteBetweenInlays
272,042
void () { initText("ab"); Inlay<?> inlay = addInlay(1); addInlay(1); right(); right(); Disposer.dispose(inlay); checkCaretPosition(1, 1, 1); }
testCaretPositionAfterInlayDisposalToTheLeft
272,043
void () { initText("ab"); addInlay(1); Inlay<?> inlay = addInlay(1); right(); right(); Disposer.dispose(inlay); checkCaretPosition(1, 1, 2); }
testCaretPositionAfterInlayDisposalToTheRight
272,044
void () { initText("ab"); addInlay(1); addInlay(1); LogicalPosition lp = getEditor().visualToLogicalPosition(new VisualPosition(0, 2)); assertEquals(new LogicalPosition(0, 1), lp); assertFalse(lp.leansForward); }
testPositionConversionForAdjacentInlays
272,045
void () { initText("abc"); addInlay(2); addInlay(2); right(); right(); right(); addCollapsedFoldRegion(0, 1, "..."); checkCaretPosition(2, 2, 5); }
testFoldingOperationDoesntMoveCaretFromBetweenInlays
272,046
void () { initText("abc"); Inlay<?> i1 = addInlay(1, false); Inlay<?> i2 = addInlay(2, true); runWriteCommand(() -> { getEditor().getDocument().insertString(2, " "); getEditor().getDocument().insertString(1, " "); }); assertTrue(i1.isValid() && i1.getOffset() == 1); assertTrue(i2.isValid() && i2.getOffset() == 4); }
testBehaviourOnTextInsertion
272,047
void () { initText("<caret>abc"); addInlay(2); right(); right(); runWriteCommand(() -> getEditor().getDocument().replaceString(1, 2, "b")); checkCaretPosition(2, 2, 2); }
testNoOpReplaceDoesntMoveCaret
272,048
void () { initText("<caret>abc"); addInlay(2); getEditor().getCaretModel().moveToOffset(2); checkCaretPosition(2, 2, 3); }
testCaretMovingToInlayOffset
272,049
void () { initText("ab"); Inlay<?> i0 = addInlay(0); Inlay<?> i1 = addInlay(1); Inlay<?> i2 = addInlay(2); runWriteCommand(() -> { getEditor().getDocument().deleteString(0, 1); getEditor().getDocument().deleteString(0, 1); }); assertEquals(Arrays.asList(i0, i1, i2), getEditor().getInlayModel().getInlineElementsInRange(0, 0)); }
testInlayOrderAfterMerge
272,050
void () { initText("abc"); Inlay<?> i1 = addInlay(2); runWriteCommand(() -> getEditor().getDocument().deleteString(1, 2)); Inlay<?> i2 = addInlay(1); assertEquals(Arrays.asList(i1, i2), getEditor().getInlayModel().getInlineElementsInRange(1, 1)); }
testInlayOrderAfterDocumentModification
272,051
int (int geometricLine) { return getEditor().yToVisualLine(geometricLineY(geometricLine)); }
geometricLineToVisualLine
272,052
int (int geometricLine) { return (int)(FontPreferences.DEFAULT_LINE_SPACING * TEST_LINE_HEIGHT) * geometricLine; }
geometricLineY
272,053
void () { initText("abc\ndef"); addBlockInlay(1); assertEquals(0, geometricLineToVisualLine(0)); assertEquals(1, geometricLineToVisualLine(2)); }
testYToVisualLineCalculationForBlockInlay
272,054
void () { initText("abc\ndef"); addBlockInlay(1, true); assertEquals(0, geometricLineToVisualLine(1)); assertEquals(1, geometricLineToVisualLine(2)); }
testYToVisualLineCalculationForAboveBlockInlay
272,055
void () { initText("abc\ndef\nghi"); addBlockInlay(1); assertEquals(0, geometricLineToVisualLine(0)); assertEquals(1, geometricLineToVisualLine(2)); assertEquals(2, geometricLineToVisualLine(3)); }
testYToVisualLineCalculationForBlockInlayAnotherCase
272,056
void () { initText("abc\ndef\nghi"); addCollapsedFoldRegion(4, 8, ""); addBlockInlay(4, true, false); assertEquals(0, geometricLineToVisualLine(0)); assertEquals(1, geometricLineToVisualLine(2)); }
testInlayInStartOfCollapsedLine
272,057
void () { initText("abc\ndef\nghi"); addCollapsedFoldRegion(4, 8, ""); addBlockInlay(4, true, true); assertEquals(geometricLineY(0), getEditor().visualLineToY(0)); assertEquals(geometricLineY(1), getEditor().visualLineToY(1)); }
testInlayInStartOfCollapsedLineRelatesToPreceding
272,058
void () { initText("abc\ndef\nghi"); addCollapsedFoldRegion(4, 8, ""); addBlockInlay(5, true, false); assertEquals(geometricLineY(0), getEditor().visualLineToY(0)); assertEquals(geometricLineY(1), getEditor().visualLineToY(1)); }
testInlayInCollapsedLine
272,059
void () { initText("abc\ndef\nghi"); addCollapsedFoldRegion(4, 8, ""); EditorTestUtil.addBlockInlay(getEditor(), 5, true, true, true, 0, null); assertEquals(geometricLineY(0), getEditor().offsetToXY(0).y); assertEquals(geometricLineY(2), getEditor().offsetToXY(8).y); }
testInlayAboveFolding
272,060
void () { initText("abc"); addCollapsedFoldRegion(0, 3, "..."); Inlay inlay = EditorTestUtil.addBlockInlay(getEditor(), 0, true, false, 0, null); assertEquals((int)(FontPreferences.DEFAULT_LINE_SPACING * TEST_LINE_HEIGHT), getEditor().visualLineToY(1)); assertNull(inlay.getBounds()); }
testInlayIsAddedIntoCollapsedFoldRegion
272,061
void () { initText("abc"); addCollapsedFoldRegion(0, 3, "..."); Inlay inlay = EditorTestUtil.addBlockInlay(getEditor(), 0, false, false, 0, null); assertEquals((int)(FontPreferences.DEFAULT_LINE_SPACING * TEST_LINE_HEIGHT) * 2, getEditor().visualLineToY(1)); assertNotNull(inlay.getBounds()); }
testInlayIsAddedIntoCollapsedFoldRegionDifferentRelatesFlag
272,062
void () { initText("abc\nd<caret>ef\nghi"); addBlockInlay(0); addInlay(4, TEST_CHAR_WIDTH * 2); down(); checkResultByText("abc\ndef\nghi<caret>"); }
testVerticalCaretMovementInPresenceOfBothTypesOfInlays
272,063
void () { initText("abcd efgh"); addInlay(9, TEST_CHAR_WIDTH * 3); configureSoftWraps(10); verifySoftWrapPositions(5); }
testInlayAtLineEndCausesSoftWrapping
272,064
void () { initText(""); getEditor().getSettings().setAdditionalColumnsCount(0); getEditor().getInlayModel().addBlockElement(0, false, false, 0, new EditorCustomElementRenderer() { @Override public int calcWidthInPixels(@NotNull Inlay inlay) { return 123;} @Override public void paint(@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) {} }); assertEquals(123, getEditor().getContentComponent().getPreferredSize().width); }
testBlockInlayImpactsEditorWidth
272,065
int (@NotNull Inlay inlay) { return 123;}
calcWidthInPixels
272,066
void (@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) {}
paint
272,067
void () { initText("text"); addBlockInlay(0, true); addBlockInlay(0, true); List<Inlay<?>> list1 = getEditor().getInlayModel().getBlockElementsInRange(0, 0); List<Inlay<?>> list2 = getEditor().getInlayModel().getBlockElementsForVisualLine(0, true); Collections.reverse(list2); assertEquals(list1, list2); }
testOrderForAboveInlaysWithSamePriority
272,068
void () { initText("text"); addBlockInlay(0, false); addBlockInlay(0, false); List<Inlay<?>> list1 = getEditor().getInlayModel().getBlockElementsInRange(0, 0); List<Inlay<?>> list2 = getEditor().getInlayModel().getBlockElementsForVisualLine(0, false); assertEquals(list1, list2); }
testOrderForBelowInlaysWithSamePriority
272,069
void () { initText(" \tabcd efghijklmno"); addInlay(1, TEST_CHAR_WIDTH); configureSoftWraps(11, false); verifySoftWrapPositions(7); WriteCommandAction.writeCommandAction(getProject()).run(() -> ((EditorEx)getEditor()).getDocument().moveText(0, 1, 7)); verifySoftWrapPositions(7, 16); }
testCorrectSoftWrappingAfterTextMovementWithInlays
272,070
void () { initText(""); addInlay(0, 10); assertNull(getEditor().getInlayModel().getElementAt(new Point(5, getEditor().getLineHeight() * 3 / 2))); }
testInlineElementAtDocumentEnd
272,071
void () { initText(""); addAfterLineEndInlay(0, 10); assertNull(getEditor().getInlayModel().getElementAt(new Point(TEST_CHAR_WIDTH + 5, getEditor().getLineHeight() * 3 / 2))); }
testAfterLineEndElementAtDocumentEnd
272,072
void () { Editor editor = EditorFactory.getInstance().createEditor(new DocumentImpl("")); Inlay<?> inlay = EditorTestUtil.addInlay(editor, 0); assertTrue(inlay.isValid()); EditorFactory.getInstance().releaseEditor(editor); assertFalse(inlay.isValid()); }
testInlayForDisposedEditor
272,073
void (int offset, int logicalColumn, int visualColumn, int selectionStartOffset, int selectionEndOffset) { checkCaretPosition(offset, logicalColumn, visualColumn); assertEquals(selectionStartOffset, getEditor().getSelectionModel().getSelectionStart()); assertEquals(selectionEndOffset, getEditor().getSelectionModel().getSelectionEnd()); }
checkCaretPositionAndSelection
272,074
void (int offset, int logicalColumn, int visualColumn) { assertEquals(offset, getEditor().getCaretModel().getOffset()); assertEquals(0, getEditor().getCaretModel().getLogicalPosition().line); assertEquals(logicalColumn, getEditor().getCaretModel().getLogicalPosition().column); assertEquals(0, getEditor().getCaretModel().getVisualPosition().line); assertEquals(visualColumn, getEditor().getCaretModel().getVisualPosition().column); }
checkCaretPosition
272,075
void (int... offsets) { assertArrayEquals(offsets, getEditor().getInlayModel().getInlineElementsInRange(0, getEditor().getDocument().getTextLength()).stream() .mapToInt(inlay -> inlay.getOffset()).toArray()); }
assertInlaysPositions
272,076
void () { init("aa,<block>bb\n" + "cc,d</block>d"); verifySplitting(true, new Segment(0, 3, Color.BLACK), new Segment(3, 4, Color.WHITE), new Segment(4, 5, Color.BLACK), new Segment(5, 6, Color.BLACK), new Segment(6, 9, Color.BLACK), new Segment(9, 10, Color.WHITE), new Segment(10, 11, Color.BLACK)); }
testBlockSelection
272,077
void () { init(""" a bbb ccccc"""); setColumnModeOn(); mouse().pressAt(0, 2).dragTo(2, 4).release(); verifySplitting(false, new Segment(0, 1, DEFAULT_BACKGROUND), new Segment(1, 2, DEFAULT_BACKGROUND), new Segment(2, 4, DEFAULT_BACKGROUND), new Segment(4, 5, SELECTION_BACKGROUND), new Segment(5, 6, DEFAULT_BACKGROUND), new Segment(6, 8, CARET_ROW_BACKGROUND), new Segment(8, 10, SELECTION_BACKGROUND), new Segment(10, 11, CARET_ROW_BACKGROUND)); }
testColumnModeBlockSelection
272,078
void () { init(""" a bbb ccccc"""); setColumnModeOn(); mouse().pressAt(0, 2).dragTo(2, 6).release(); verifySplitting(false, new Segment(0, 1, DEFAULT_BACKGROUND), new Segment(1, 2, DEFAULT_BACKGROUND), new Segment(2, 4, DEFAULT_BACKGROUND), new Segment(4, 5, SELECTION_BACKGROUND), new Segment(5, 6, DEFAULT_BACKGROUND), new Segment(6, 8, CARET_ROW_BACKGROUND), new Segment(8, 11, SELECTION_BACKGROUND)); }
testColumnModeBlockSelectionAtLastNonEmptyLine
272,079
void () { init("a\n"); setColumnModeOn(); mouse().pressAt(1, 1).dragTo(1, 2).release(); verifySplitting(false, new Segment(0, 1, DEFAULT_BACKGROUND), new Segment(1, 2, DEFAULT_BACKGROUND)); }
testColumnModeBlockSelectionAtLastEmptyLine
272,080
void () { init("\n"); setColumnModeOn(); mouse().pressAt(0, 1).dragTo(1, 2).release(); verifySplitting(false, new Segment(0, 1, DEFAULT_BACKGROUND)); }
testColumnModeBlockSelectionAtEmptyLines
272,081
void () { init("line1\n" + "line2"); setColumnModeOn(); Color breakpointColor = Color.RED; getEditor().getMarkupModel().addLineHighlighter(0, HighlighterLayer.CARET_ROW + 1, new TextAttributes(null, breakpointColor, null, null, Font.PLAIN)); Color currentDebuggingLineColor = Color.CYAN; getEditor().getMarkupModel().addLineHighlighter(0, HighlighterLayer.SELECTION - 1, new TextAttributes(null, currentDebuggingLineColor, null, null, Font.PLAIN)); mouse().pressAt(0, 4).dragTo(0, 6).release(); verifySplitting(false, new Segment(0, 4, currentDebuggingLineColor), new Segment(4, 5, SELECTION_BACKGROUND), new Segment(5, 6, currentDebuggingLineColor), new Segment(6, 11, DEFAULT_BACKGROUND)); }
testColumnModeSelectionWithCurrentBreakpointHighlighting
272,082
void () { init(" line1\n" + " line2"); Color breakpointColor = Color.RED; getEditor().getMarkupModel().addLineHighlighter(0, HighlighterLayer.CARET_ROW + 1, new TextAttributes(null, breakpointColor, null, null, Font.PLAIN)); verifySplitting(false, new Segment(0, 5, breakpointColor), new Segment(5, 10, breakpointColor), new Segment(10, 11, breakpointColor), new Segment(11, 16, DEFAULT_BACKGROUND), new Segment(16, 21, DEFAULT_BACKGROUND)); }
testLinesInRange
272,083
void () { init("abc"); getEditor().getColorsScheme().setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.BOLD)); IterationState it = new IterationState((EditorEx)getEditor(), 0, 3, null, false, false, true, false); assertFalse(it.atEnd()); assertEquals(0, it.getStartOffset()); assertEquals(3, it.getEndOffset()); TextAttributes attributes = it.getMergedAttributes(); assertEquals(Font.BOLD, attributes.getFontType()); }
testBoldDefaultFont
272,084
void () { init("a bc"); EditorTestUtil.configureSoftWraps(getEditor(), 2); assertNotNull(getEditor().getSoftWrapModel().getSoftWrap(2)); addRangeHighlighter(1, 3, 0, Color.red); addRangeHighlighter(1, 2, 1, Color.blue); IterationState it = new IterationState((EditorEx)getEditor(), 0, 4, null, false, false, false, false); it.advance(); it.advance(); assertFalse(it.atEnd()); assertEquals(2, it.getStartOffset()); assertEquals(3, it.getEndOffset()); assertEquals(Color.red, it.getPastLineEndBackgroundAttributes().getBackgroundColor()); assertEquals(Color.red, it.getBeforeLineStartBackgroundAttributes().getBackgroundColor()); }
testBreakAttributesAtSoftWrap
272,085
void (int startOffset, int endOffset, int layer, Color bgColor) { getEditor().getMarkupModel().addRangeHighlighter(startOffset, endOffset, layer, new TextAttributes(null, bgColor, null, null, Font.PLAIN), HighlighterTargetArea.EXACT_RANGE); }
addRangeHighlighter
272,086
void (boolean checkForegroundColor, Segment @NotNull ... expectedSegments) { EditorEx editor = (EditorEx)getEditor(); IterationState.CaretData caretData = IterationState.createCaretData(editor); IterationState iterationState = new IterationState(editor, 0, editor.getDocument().getTextLength(), caretData, false, false, true, false); List<Segment> actualSegments = new ArrayList<>(); do { Segment segment = new Segment(iterationState.getStartOffset(), iterationState.getEndOffset(), checkForegroundColor ? iterationState.getMergedAttributes().getForegroundColor() : iterationState.getMergedAttributes().getBackgroundColor()); actualSegments.add(segment); iterationState.advance(); } while (!iterationState.atEnd()); Assert.assertArrayEquals(expectedSegments, actualSegments.toArray()); }
verifySplitting
272,087
void (String text) { configureFromFileText(getTestName(true) + ".txt", text); EditorTestUtil.setEditorVisibleSize(getEditor(), 1000, 1000); }
init
272,088
void () { ((EditorEx)getEditor()).setColumnMode(true); }
setColumnModeOn
272,089
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Segment segment = (Segment)o; if (end != segment.end) return false; if (start != segment.start) return false; if (color != null ? !color.equals(segment.color) : segment.color != null) return false; return true; }
equals
272,090
int () { int result = start; result = 31 * result + end; result = 31 * result + (color != null ? color.hashCode() : 0); return result; }
hashCode
272,091
String () { return "Segment{" + "start=" + start + ", end=" + end + ", color=" + color + '}'; }
toString
272,092
void () { MyRange marker = new MyRange(2, 1); checkSumForOffset(0, 0); checkSumForOffset(1, 0); checkSumForOffset(2, 1); checkSumForOffset(3, 1); checkSumForOffset(10, 1); marker.dispose(); checkSumForOffset(2, 0); checkSumForOffset(3, 0); }
testOneMarker
272,093
void () { new MyRange(2, 1); new MyRange(5, 2); checkSumForOffset(1, 0); checkSumForOffset(2, 1); checkSumForOffset(3, 1); checkSumForOffset(5, 3); checkSumForOffset(6, 3); }
testTwoMarkers
272,094
void () { new MyRange(1, 1); new MyRange(3, 2); new MyRange(5, 4); checkSumForOffset(10, 7); }
testTreeRotation
272,095
void () { MyRange r1 = new MyRange(1, 1); MyRange r2 = new MyRange(1, 2); checkSumForOffset(0, 0); checkSumForOffset(1, 3); checkSumForOffset(2, 3); r1.dispose(); checkSumForOffset(0, 0); checkSumForOffset(1, 2); checkSumForOffset(2, 2); r2.dispose(); checkSumForOffset(0, 0); checkSumForOffset(1, 0); checkSumForOffset(2, 0); }
testTwoMarkersAtSameOffset
272,096
void () { MyRange r1 = new MyRange(1, 1); MyRange r2 = new MyRange(2, 2); runWriteCommand(() -> myDocument.deleteString(1, 2)); assertTrue(r1.isValid()); assertTrue(r2.isValid()); checkSumForOffset(0, 0); checkSumForOffset(1, 3); checkSumForOffset(2, 3); }
testMarkerMergingOnEditing
272,097
void () { MyRange r1 = new MyRange(1, 1, false); MyRange r2 = new MyRange(1, 2, true); checkSumForOffset(0, 0); checkSumForOffset(1, 3); checkSumForOffset(2, 3); runWriteCommand(() -> myDocument.insertString(1, " ")); assertTrue(r1.isValid()); assertEquals(1, r1.getStartOffset()); assertTrue(r2.isValid()); assertEquals(2, r2.getStartOffset()); checkSumForOffset(0, 0); checkSumForOffset(1, 1); checkSumForOffset(2, 3); checkSumForOffset(3, 3); }
testMarkerSplitOnEditing
272,098
void () { MyRange r1 = new MyRange(1, 1); runWriteCommand(() -> myDocument.deleteString(0, 2)); assertFalse(r1.isValid()); checkSumForOffset(0, 0); checkSumForOffset(1, 0); checkSumForOffset(2, 0); }
testMarkerDisposalOnEditing
272,099
void () { MyRange r = new MyRange(1, 1); checkSumForOffset(0, 0); checkSumForOffset(1, 1); checkSumForOffset(2, 1); r.setValue(2); checkSumForOffset(0, 0); checkSumForOffset(1, 2); checkSumForOffset(2, 2); }
testValueUpdate