postAccessibilityNotificationsForFrame: was calling NSString lineRangeForRange: to detect line-crossing cursor moves. That method scans from the start of the string, making it O(cursor_offset). In large buffers with the cursor near the end, this executes on every redisplay cycle — causing progressive slowdown proportional to cursor position. patch 0002 already builds lineStartOffsets in ensureTextCache (O(N) once per text change) and exposes lineForAXIndex: (O(log L) binary search). Use it instead. Also remove the now-redundant tlen clamping that existed solely to prevent lineRangeForRange: from receiving an out-of-range index. lineForAXIndex: handles out-of-range inputs safely.
18 KiB
18 KiB