private void init( final int visibleWidth, @NotNull String fileText, @NotNull TestFileType fileType, final int symbolWidth) throws IOException { init(fileText, fileType); EditorTestUtil.configureSoftWraps(myEditor, visibleWidth, symbolWidth); }
public void testCaretPositionsRecalculationOnDocumentChange() throws Exception { initText( "\n" + "<selection><caret>word</selection>\n" + "some long prefix <selection><caret>word</selection>-suffix"); EditorTestUtil.configureSoftWraps(myEditor, 17); // wrapping right before 'word-suffix' delete(); checkResultByText("\n" + "<caret>\n" + "some long prefix <caret>-suffix"); verifySoftWrapPositions(19); }
public void testOnlyMinimalRangeIsRecalculatedOnDocumentChange() throws IOException { init("aa bb cc dd ee<caret> ff gg hh ii jj", TestFileType.TEXT); EditorTestUtil.configureSoftWraps(myEditor, 8); verifySoftWrapPositions(6, 12, 18, 24); final IncrementalCacheUpdateEvent[] event = new IncrementalCacheUpdateEvent[1]; ((SoftWrapModelImpl) myEditor.getSoftWrapModel()) .getApplianceManager() .addListener( new SoftWrapAwareDocumentParsingListenerAdapter() { @Override public void onRecalculationEnd(@NotNull IncrementalCacheUpdateEvent e) { assertNull(event[0]); event[0] = e; } }); type(' '); verifySoftWrapPositions(6, 12, 19, 25); assertNotNull(event[0]); assertEquals(6, event[0].getStartOffset()); assertEquals(19, event[0].getActualEndOffset()); }