FrozenDocument (@NotNull DocumentEvent event, int newStamp) { int offset = event.getOffset(); int oldEnd = offset + event.getOldLength(); ImmutableCharSequence newText = myText.replace(offset, oldEnd, event.getNewFragment()); LineSet newLineSet = getLineSet().update(myText, offset, oldEnd, event.getNewFragment(), event.isWholeTextReplaced()); return new FrozenDocument(newText, newLineSet, newStamp, null); }