ibireme / YYText

Powerful text framework for iOS to display and edit rich text.
MIT License
8.84k stars 1.67k forks source link

-[YYTextLayout firstRectForRange:(YYTextRange *)],这个方法中有一段代码的逻辑好像有些错误: #1001

Open Airwen opened 2 months ago

Airwen commented 2 months ago

-[YYTextLayout firstRectForRange:(YYTextRange *)]

    NSUInteger startLineIndex = [self lineIndexForPosition:range.start];
    NSUInteger endLineIndex = [self lineIndexForPosition:range.end];

   /* ... 此处省略若干行代码 ... */

    NSMutableArray *lines = [NSMutableArray new];
   // 这里的 `for` 循环, `i <= startLineIndex` 是不是应该 `i <= endLineIndex`
  //  用来获取 range 范围内的相关 “line”
    for (NSUInteger i = startLineIndex; i <= startLineIndex; i++) {
        YYTextLine *line = _lines[i];
        if (line.row != startLine.row) break;
        [lines addObject:line];
    }

如果我解读有误,请指正~