private String getLineContents(IDocument d, int line)
        throws BadLocationException
    {
        int offset = d.getLineOffset(line);
        int length = d.getLineLength(line);
        String lineDelimiter = d.getLineDelimiter(line);
        if (lineDelimiter != null) {
            length = length - lineDelimiter.length();
        }
        String lineContents = d.get(offset, length);
        int trim = commentExtractLinePrefix(d, line).length();
        return lineContents.substring(trim);
    }
Returns the displayed width of a string, taking in account the displayed tab width. The result can be compared
against the print margin.
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/indent/SQLCommentAutoIndentStrategy.java