code: public static <PS, SEG, S> Consumer<PlainTextChange> applyPlainTextChange(GenericStyledArea<PS, SEG, S> area) {
          return change -> area.replaceText(change.getPosition(), change.getRemovalEnd(), change.getInserted());
      }
docs: Applies a {@link PlainTextChange} to the given area when the {@link UndoManager}'s change stream emits an event
  by {@code area.replaceText(change.getPosition(), change.getRemovalEnd(), change.getInserted()}.