patches: address all non-blocking review findings

Fix remaining issues identified in core maintainer review:
- 0000: correct [PATCH 0/8] to [PATCH] (standalone Zoom series)
- 0006: add paragraph break in macos.texi VoiceOver section
- 0001/0005: shorten separator comment lines to 79 chars
- 0007/0008: genericize third-party package names in commit messages
- 0001: fix block_input ordering (block before registering unwind)
- 0000/0007: document intentional face_is_selected duplication
This commit is contained in:
2026-03-03 12:48:31 +01:00
parent 9bee2a1987
commit 61c23aed2c
12 changed files with 202 additions and 126 deletions

View File

@@ -1,11 +1,11 @@
From affdaf60d28ad4d9836c6505216e19599b31c437 Mon Sep 17 00:00:00 2001
From: Daneel <daneel@sukany.cz>
From: Martin Sukany <martin@sukany.cz>
Date: Mon, 2 Mar 2026 18:39:46 +0100
Subject: [PATCH 7/8] ns: announce overlay completion candidates for VoiceOver
Completion frameworks such as Vertico, Ivy, and Icomplete render
candidates via overlay before-string/after-string properties. Without
this change VoiceOver cannot read overlay-based completion UIs.
Overlay-based completion frameworks render candidates via overlay
before-string/after-string properties (e.g., Vertico, Icomplete,
Ivy). Without this change VoiceOver cannot read these completion UIs.
* src/nsterm.m (ns_ax_face_is_selected): New static function; matches
'current', 'selected', 'selection' in face symbol names.
@@ -18,8 +18,8 @@ ValueChanged; keep overlay_modiff out of ensureTextCache to prevent a
race where an AX query consumes the change before notification.
---
src/nsterm.h | 1 +
src/nsterm.m | 348 ++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 307 insertions(+), 42 deletions(-)
src/nsterm.m | 352 ++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 311 insertions(+), 42 deletions(-)
diff --git a/src/nsterm.h b/src/nsterm.h
index 5746e9e9bd..21a93bc799 100644
@@ -37,10 +37,13 @@ diff --git a/src/nsterm.m b/src/nsterm.m
index 8e5cc7e1d7..8ef344d9fe 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7263,11 +7263,154 @@ Accessibility virtual elements (macOS / Cocoa only)
@@ -7266,11 +7266,158 @@ Accessibility virtual elements (macOS / Cocoa only)
/* ---- Helper: extract buffer text for accessibility ---- */
+/* Note: ns_zoom_face_is_selected in the Zoom series has identical
+ logic. The duplication is intentional: both series are independent
+ and must compile standalone. */
+/* Return true if FACE is or contains a face symbol whose name
+ includes "current" or "selected", indicating a highlighted
+ completion candidate. Works for vertico-current,
@@ -185,6 +188,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
+
+ return nil;
+}
+
/* 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
@@ -193,7 +197,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
static NSString *
ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start,
ns_ax_visible_run **out_runs, NSUInteger *out_nruns)
@@ -7340,7 +7483,7 @@ Accessibility virtual elements (macOS / Cocoa only)
@@ -7343,7 +7489,7 @@ Accessibility virtual elements (macOS / Cocoa only)
/* Extract this visible run's text. Use
Fbuffer_substring_no_properties which correctly handles the
@@ -202,7 +206,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
include garbage bytes when the run spans the gap position. */
Lisp_Object lstr = Fbuffer_substring_no_properties (
make_fixnum (pos), make_fixnum (run_end));
@@ -7421,7 +7564,7 @@ Mode lines using icon fonts (e.g. nerd-font icons)
@@ -7424,7 +7570,7 @@ Mode lines using icon fonts (e.g. nerd-font icons)
return NSZeroRect;
/* charpos_start and charpos_len are already in buffer charpos
@@ -211,7 +215,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
charposForAccessibilityIndex which handles invisible text. */
ptrdiff_t cp_start = charpos_start;
ptrdiff_t cp_end = cp_start + charpos_len;
@@ -7896,6 +8039,7 @@ @implementation EmacsAccessibilityBuffer
@@ -7899,6 +8045,7 @@ @implementation EmacsAccessibilityBuffer
@synthesize cachedOverlayModiff;
@synthesize cachedTextStart;
@synthesize cachedModiff;
@@ -219,7 +223,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
@synthesize cachedPoint;
@synthesize cachedMarkActive;
@synthesize cachedCompletionAnnouncement;
@@ -7993,7 +8137,7 @@ - (void)ensureTextCache
@@ -7996,7 +8143,7 @@ - (void)ensureTextCache
NSTRACE ("EmacsAccessibilityBuffer ensureTextCache");
/* This method is only called from the main thread (AX getters
dispatch_sync to main first). Reads of cachedText/cachedTextModiff
@@ -228,7 +232,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
write section at the end needs synchronization to protect
against concurrent reads from AX server thread. */
eassert ([NSThread isMainThread]);
@@ -8005,25 +8149,34 @@ - (void)ensureTextCache
@@ -8008,25 +8155,34 @@ - (void)ensureTextCache
if (!b)
return;
@@ -280,7 +284,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
&& cachedTextStart == BUF_BEGV (b)
&& pt >= cachedTextStart
&& (textLen == 0
@@ -8039,7 +8192,7 @@ included in the cached AX text (it is handled separately via
@@ -8042,7 +8198,7 @@ included in the cached AX text (it is handled separately via
{
[cachedText release];
cachedText = [text retain];
@@ -289,7 +293,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
cachedTextStart = start;
if (visibleRuns)
@@ -8051,9 +8204,9 @@ included in the cached AX text (it is handled separately via
@@ -8054,9 +8210,9 @@ included in the cached AX text (it is handled separately via
Walk the cached text once, recording the start offset of each
line. Uses NSString lineRangeForRange: --- O(N) in the total
text --- but this loop runs only on cache rebuild, which is
@@ -302,7 +306,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
enters this code. */
if (lineStartOffsets)
xfree (lineStartOffsets);
@@ -8108,7 +8261,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
@@ -8111,7 +8267,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
/* Binary search: runs are sorted by charpos (ascending). Find the
run whose [charpos, charpos+length) range contains the target,
or the nearest run after an invisible gap. O(log n) instead of
@@ -311,7 +315,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
NSUInteger lo = 0, hi = visibleRunCount;
while (lo < hi)
{
@@ -8157,10 +8310,10 @@ by run length (visible window), not total buffer size. */
@@ -8160,10 +8316,10 @@ by run length (visible window), not total buffer size. */
/* Convert accessibility string index to buffer charpos.
Safe to call from any thread: uses only cachedText (NSString) and
@@ -324,7 +328,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
@synchronized (self)
{
if (visibleRunCount == 0)
@@ -8202,7 +8355,7 @@ the slow path (composed character sequence walk), which is
@@ -8205,7 +8361,7 @@ the slow path (composed character sequence walk), which is
return cp;
}
}
@@ -333,7 +337,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
if (lo > 0)
{
ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
@@ -8224,7 +8377,7 @@ the slow path (composed character sequence walk), which is
@@ -8227,7 +8383,7 @@ the slow path (composed character sequence walk), which is
deadlocking the AX server thread. This is prevented by:
1. validWindow checks WINDOW_LIVE_P and BUFFERP before every
@@ -342,7 +346,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
2. All dispatch_sync blocks run on the main thread where no
concurrent Lisp code can modify state between checks.
3. block_input prevents timer events and process output from
@@ -8570,6 +8723,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
@@ -8573,6 +8729,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
return [self lineForAXIndex:point_idx];
}
@@ -393,7 +397,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
- (NSRange)accessibilityRangeForLine:(NSInteger)line
{
if (![NSThread isMainThread])
@@ -8792,7 +8989,7 @@ - (NSRect)accessibilityFrame
@@ -8795,7 +8995,7 @@ - (NSRect)accessibilityFrame
/* ===================================================================
@@ -402,7 +406,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
These methods notify VoiceOver of text and selection changes.
Called from the redisplay cycle (postAccessibilityUpdates).
@@ -8807,7 +9004,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8810,7 +9010,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
if (point > self.cachedPoint
&& point - self.cachedPoint == 1)
{
@@ -411,7 +415,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
[self invalidateTextCache];
[self ensureTextCache];
if (cachedText)
@@ -8826,7 +9023,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8829,7 +9029,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
/* Update cachedPoint here so the selection-move branch does NOT
fire for point changes caused by edits. WebKit and Chromium
never send both ValueChanged and SelectedTextChanged for the
@@ -420,7 +424,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
self.cachedPoint = point;
NSDictionary *change = @{
@@ -9220,16 +9417,83 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
@@ -9223,16 +9423,83 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
BOOL markActive = !NILP (BVAR (b, mark_active));
/* --- Text changed (edit) --- */
@@ -508,7 +512,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
{
ptrdiff_t oldPoint = self.cachedPoint;
BOOL oldMarkActive = self.cachedMarkActive;
@@ -12403,7 +12667,7 @@ - (int) fullscreenState
@@ -12406,7 +12673,7 @@ - (int) fullscreenState
if (WINDOW_LEAF_P (w))
{
@@ -517,7 +521,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
EmacsAccessibilityBuffer *elem
= [existing objectForKey:[NSValue valueWithPointer:w]];
if (!elem)
@@ -12437,7 +12701,7 @@ - (int) fullscreenState
@@ -12440,7 +12707,7 @@ - (int) fullscreenState
}
else
{
@@ -526,7 +530,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
Lisp_Object child = w->contents;
while (!NILP (child))
{
@@ -12549,7 +12813,7 @@ - (void)postAccessibilityUpdates
@@ -12552,7 +12819,7 @@ - (void)postAccessibilityUpdates
accessibilityUpdating = YES;
/* Detect window tree change (split, delete, new buffer). Compare
@@ -535,7 +539,7 @@ index 8e5cc7e1d7..8ef344d9fe 100644
Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe);
if (!EQ (curRoot, lastRootWindow))
{
@@ -12558,12 +12822,12 @@ - (void)postAccessibilityUpdates
@@ -12561,12 +12828,12 @@ - (void)postAccessibilityUpdates
}
/* If tree is stale, rebuild FIRST so we don't iterate freed