private String commentExtractLinePrefix(IDocument d, int line)
        throws BadLocationException
    {

        IRegion region = d.getLineInformation(line);
        int lineOffset = region.getOffset();
        int index = findEndOfWhiteSpace(d, lineOffset, lineOffset + d.getLineLength(line));
        if (d.getChar(index) == '*') {
            index++;
            if (index != lineOffset + region.getLength() && d.getChar(index) == ' ') {
                index++;
            }
        }
        return d.get(lineOffset, index - lineOffset);
    }
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