private static int fixOffset(Document document, int caretOffset) {
    // the initially computed indent includes everything before the caret,
    // so we have to trim the '-' prefix and following ws
    CharSequence sequence = document.getCharsSequence();
    int offset = 0;
    while (sequence.charAt(caretOffset - 1 + offset) != '-') {
      offset--;
    }
    return offset - 1;
  }
private static int fixOffset(Document document, int caretOffset)