patches: fix O(position) lag — O(1) fast path in charposForAccessibilityIndex:
charposForAccessibilityIndex: walked composed character sequences from the start of a visible run to the target AX index. For a run covering an entire ASCII buffer, this is O(cursor_position): moving to line 10,000 requires ~500,000 iterations per call. The method is called on every SelectedTextChanged notification response (accessibilityBoundsForRange: from the AX server for cursor tracking), making cursor movement O(position) in large files. Fix: when ax_length == length for a run (all characters are single AX index units — true for all ASCII/Latin text), the charpos offset is simply ax_idx - run.ax_start. O(1) instead of O(position). Multi-byte runs (emoji, CJK, non-BMP) fall back to the sequence walk, bounded by run length (visible window size), not total buffer size.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From aeab7e4db306049fb543f60cadcaaa346350f77b Mon Sep 17 00:00:00 2001
|
||||
From 03a3e77f9ff5f46429964863a2f320e119c0686c Mon Sep 17 00:00:00 2001
|
||||
From: Martin Sukany <martin@sukany.cz>
|
||||
Date: Sat, 28 Feb 2026 22:39:35 +0100
|
||||
Subject: [PATCH 1/9] ns: integrate with macOS Zoom for cursor tracking
|
||||
Subject: [PATCH 0/8] ns: integrate with macOS Zoom for cursor tracking
|
||||
|
||||
Inform macOS Zoom of the text cursor position so the zoomed viewport
|
||||
follows keyboard focus in Emacs.
|
||||
|
||||
Reference in New Issue
Block a user