patches: fix O(position) lag — O(1) fast path in accessibilityIndexForCharpos:
accessibilityIndexForCharpos: walked composed character sequences from run.ax_start up to the target charpos offset. For a run covering an entire ASCII buffer, chars_in = pt - BUF_BEGV, making each call O(cursor_position). This method is called from ensureTextCache on EVERY redisplay frame (as part of the cache validity check), making each frame O(position) even when the buffer is completely unchanged. At line 34,000 of a large file this is ~1,000,000 iterations per frame. Fix: when ax_length == length for a run (all single-unit characters), the ax_index is simply ax_start + chars_in. O(1) instead of O(N). This is the symmetric counterpart to the charposForAccessibilityIndex: fast path added in the previous commit. Both conversion directions now run in O(1) for pure-ASCII buffers.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From a1c42c0fefc4cc942884c0fe44520717742e4dba Mon Sep 17 00:00:00 2001
|
||||
From 78b8d79ec5505165d6864cc65c7b3703a57e441c Mon Sep 17 00:00:00 2001
|
||||
From: Martin Sukany <martin@sukany.cz>
|
||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
||||
Subject: [PATCH 4/8] ns: add interactive span elements for Tab navigation
|
||||
@@ -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 a73b7f5..98ff027 100644
|
||||
index 239666d..94a4602 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -9271,6 +9271,292 @@ - (NSRect)accessibilityFrame
|
||||
@@ -9287,6 +9287,292 @@ - (NSRect)accessibilityFrame
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user