void (@NotNull CharSequence text) { synchronized (myLock) { LOG.assertTrue(text.toString().startsWith(myShreds.get(0).getPrefix())); LOG.assertTrue(text.toString().endsWith(myShreds.get(myShreds.size() - 1).getSuffix())); if (isOneLine()) { text = StringUtil.replace(text.toString(), "\n", ""); } String[] changes = calculateMinEditSequence(text.toString()); assert changes.length == myShreds.size(); for (int i = 0; i < changes.length; i++) { String change = changes[i]; if (change != null) { Segment hostRange = myShreds.get(i).getHostRangeMarker(); if (hostRange == null) continue; myDelegate.replaceString(hostRange.getStartOffset(), hostRange.getEndOffset(), change); } } } }