I found `TextUtilities.getDefaultLineDelimiter(doc)` and used it.