@Override
  public @NotNull LogicalPosition offsetToLogicalPosition(int offset) {
    int clamped = MathUtil.clamp(offset, 0, myDocument.getTextLength());
    int line = myDocument.getLineNumber(clamped);
    int col = clamped - myDocument.getLineStartOffset(line);
    return new LogicalPosition(line, col);
  }
@Override
  public @NotNull LogicalPosition offsetToLogicalPosition(int offset)