patches: squash perf fixes into respective patches, clean 9-patch series
Performance fixes folded back: - BUF_CHARS_MODIFF → patch 0002 (implement buffer accessibility element) - UAZoomEnabled cache + rate-limit → patch 0000 (Zoom integration) Also in patch 0000: ns_zoom_face_is_selected (standalone compilation). Also in patch 0001: ns_accessibility_enabled defaults to nil.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From 5edae69b987f3234d4545d8c77f89f5dc4201e03 Mon Sep 17 00:00:00 2001
|
||||
From a5f18d7d2b4fdabb3d1ed10d536117ea8d641dad Mon Sep 17 00:00:00 2001
|
||||
From: Martin Sukany <martin@sukany.cz>
|
||||
Date: Sat, 28 Feb 2026 16:01:29 +0100
|
||||
Subject: [PATCH 09/11] ns: announce child frame completion candidates for
|
||||
Subject: [PATCH 9/9] ns: announce child frame completion candidates for
|
||||
VoiceOver
|
||||
|
||||
Completion frameworks such as Corfu, Company-box, and similar
|
||||
@@ -40,11 +40,11 @@ childFrameCompletionActive flag.
|
||||
(EmacsView postAccessibilityUpdates): Dispatch to child frame handler,
|
||||
refocus parent buffer element when child frame closes.
|
||||
---
|
||||
doc/emacs/macos.texi | 6 --
|
||||
doc/emacs/macos.texi | 6 -
|
||||
etc/NEWS | 4 +-
|
||||
src/nsterm.h | 5 +
|
||||
src/nsterm.m | 236 ++++++++++++++++++++++++++++++++++++++++++-
|
||||
4 files changed, 242 insertions(+), 9 deletions(-)
|
||||
src/nsterm.m | 263 +++++++++++++++++++++++++++++++++++++++++--
|
||||
4 files changed, 260 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
|
||||
index 4825cf9..97777e2 100644
|
||||
@@ -109,10 +109,10 @@ index 2102fb9..dd98d56 100644
|
||||
@end
|
||||
|
||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||
index aaeed33..d576512 100644
|
||||
index e333d45..27607c0 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -7318,6 +7318,112 @@ visual line index for Zoom (skip whitespace-only lines
|
||||
@@ -7352,6 +7352,112 @@ visual line index for Zoom (skip whitespace-only lines
|
||||
|
||||
return nil;
|
||||
}
|
||||
@@ -225,7 +225,50 @@ index aaeed33..d576512 100644
|
||||
/* Build accessibility text for window W, skipping invisible text.
|
||||
Populates *OUT_START with the buffer start charpos.
|
||||
Populates *OUT_RUNS with an array of visible runs and *OUT_NRUNS
|
||||
@@ -9055,6 +9161,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
|
||||
@@ -8096,16 +8202,25 @@ - (void)ensureTextCache
|
||||
if (!b)
|
||||
return;
|
||||
|
||||
- ptrdiff_t modiff = BUF_MODIFF (b);
|
||||
- ptrdiff_t pt = BUF_PT (b);
|
||||
- NSUInteger textLen = cachedText ? [cachedText length] : 0;
|
||||
- /* Cache validity: track BUF_MODIFF and buffer narrowing.
|
||||
+ /* Use BUF_CHARS_MODIFF, not BUF_MODIFF, for cache validity.
|
||||
+ BUF_MODIFF is bumped by every text-property change, including
|
||||
+ font-lock face applications on every redisplay. AX text contains
|
||||
+ only characters, not face data, so property-only changes do not
|
||||
+ affect the cached value. Rebuilding the full buffer text on
|
||||
+ each font-lock pass is O(buffer-size) per redisplay --- this
|
||||
+ causes progressive slowdown when scrolling through large files.
|
||||
+ BUF_CHARS_MODIFF is bumped only on actual character insertions
|
||||
+ and deletions, matching the semantic of "did the text change".
|
||||
+ This is the pattern used by WebKit and NSTextView.
|
||||
Do NOT track BUF_OVERLAY_MODIFF here --- overlay text is not
|
||||
included in the cached AX text (it is handled separately via
|
||||
- explicit announcements). Including overlay_modiff would
|
||||
- silently update cachedOverlayModiff and prevent the
|
||||
- notification dispatch from detecting overlay changes. */
|
||||
- if (cachedText && cachedTextModiff == modiff
|
||||
+ explicit announcements in postAccessibilityNotificationsForFrame).
|
||||
+ Including overlay_modiff would silently update cachedOverlayModiff
|
||||
+ and prevent the notification dispatch from detecting changes. */
|
||||
+ ptrdiff_t chars_modiff = BUF_CHARS_MODIFF (b);
|
||||
+ ptrdiff_t pt = BUF_PT (b);
|
||||
+ NSUInteger textLen = cachedText ? [cachedText length] : 0;
|
||||
+ if (cachedText && cachedTextModiff == chars_modiff
|
||||
&& cachedTextStart == BUF_BEGV (b)
|
||||
&& pt >= cachedTextStart
|
||||
&& (textLen == 0
|
||||
@@ -8121,7 +8236,7 @@ included in the cached AX text (it is handled separately via
|
||||
{
|
||||
[cachedText release];
|
||||
cachedText = [text retain];
|
||||
- cachedTextModiff = modiff;
|
||||
+ cachedTextModiff = chars_modiff;
|
||||
cachedTextStart = start;
|
||||
|
||||
if (visibleRuns)
|
||||
@@ -9089,6 +9204,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
|
||||
ptrdiff_t currentOverlayStart = 0;
|
||||
ptrdiff_t currentOverlayEnd = 0;
|
||||
|
||||
@@ -233,7 +276,7 @@ index aaeed33..d576512 100644
|
||||
specpdl_ref count2 = SPECPDL_INDEX ();
|
||||
record_unwind_current_buffer ();
|
||||
if (b != current_buffer)
|
||||
@@ -9213,6 +9320,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
|
||||
@@ -9247,6 +9363,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
|
||||
self.cachedCompletionOverlayEnd = 0;
|
||||
self.cachedCompletionPoint = 0;
|
||||
}
|
||||
@@ -241,7 +284,7 @@ index aaeed33..d576512 100644
|
||||
}
|
||||
|
||||
/* ---- Notification dispatch (main entry point) ---- */
|
||||
@@ -9809,6 +9917,10 @@ - (void)dealloc
|
||||
@@ -9843,6 +9960,10 @@ - (void)dealloc
|
||||
#endif
|
||||
|
||||
[accessibilityElements release];
|
||||
@@ -252,7 +295,7 @@ index aaeed33..d576512 100644
|
||||
[[self menu] release];
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -12569,6 +12681,80 @@ - (id)accessibilityFocusedUIElement
|
||||
@@ -12603,6 +12724,80 @@ - (id)accessibilityFocusedUIElement
|
||||
The existing elements carry cached state (modiff, point) from the
|
||||
previous redisplay cycle. Rebuilding first would create fresh
|
||||
elements with current values, making change detection impossible. */
|
||||
@@ -333,7 +376,7 @@ index aaeed33..d576512 100644
|
||||
- (void)postAccessibilityUpdates
|
||||
{
|
||||
NSTRACE ("[EmacsView postAccessibilityUpdates]");
|
||||
@@ -12579,11 +12765,59 @@ - (void)postAccessibilityUpdates
|
||||
@@ -12613,11 +12808,59 @@ - (void)postAccessibilityUpdates
|
||||
|
||||
/* Re-entrance guard: VoiceOver callbacks during notification posting
|
||||
can trigger redisplay, which calls ns_update_end, which calls us
|
||||
|
||||
Reference in New Issue
Block a user