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 7303dd3913729a454b44fe71219acbd612d624b4 Mon Sep 17 00:00:00 2001
|
||||
From a1c42c0fefc4cc942884c0fe44520717742e4dba Mon Sep 17 00:00:00 2001
|
||||
From: Martin Sukany <martin@sukany.cz>
|
||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
||||
Subject: [PATCH 5/9] ns: add interactive span elements for Tab navigation
|
||||
Subject: [PATCH 4/8] ns: add interactive span elements for Tab navigation
|
||||
|
||||
* src/nsterm.m (ns_ax_scan_interactive_spans): New function.
|
||||
(EmacsAccessibilityInteractiveSpan): Implement AXButton/AXLink
|
||||
@@ -17,10 +17,10 @@ Tested on macOS 14. Verified: Tab-cycling through org-mode links,
|
||||
1 file changed, 286 insertions(+)
|
||||
|
||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||
index 7e3d57a..1a21f2e 100644
|
||||
index a73b7f5..98ff027 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -9263,6 +9263,292 @@ - (NSRect)accessibilityFrame
|
||||
@@ -9271,6 +9271,292 @@ - (NSRect)accessibilityFrame
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user