void () { SimpleDiffChange change = getDiffChanges().get(myIndex); myIndex++; int line1 = change.getStartLine(Side.RIGHT); int line2 = change.getEndLine(Side.RIGHT); Document document = getEditor(Side.RIGHT).getDocument(); for (int i = line1; i < line2; i++) { int offset1 = document.getLineStartOffset(i); int offset2 = document.getLineEndOffset(i); CharSequence text = document.getImmutableCharSequence().subSequence(offset1, offset2); addLine(i, text); } }