code: public static <PS, SEG, S> UndoManager defaultUndoManager(GenericStyledArea<PS, SEG, S> area) {
          return area.isPreserveStyle()
                  ? richTextUndoManager(area)
                  : plainTextUndoManager(area);
      }
docs: Constructs an UndoManager with an unlimited history:
  if {@link GenericStyledArea#isPreserveStyle() the area's preserveStyle flag is true}, the returned UndoManager
  can undo/redo multiple {@link RichTextChange}s; otherwise, it can undo/redo multiple {@link PlainTextChange}s.