Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Airwen opened this issue Apr 26, 2024 · 0 comments

Comments

@Airwen
Copy link

Airwen commented Apr 26, 2024

-[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];
    }

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant