patches: apply all maintainer review fixes (review pass 2)

All 9 patches now apply cleanly with git am on Linux (git 2.43.0).
Root cause of previous failures: hunk offsets were systematically wrong
by 7-40 lines; macOS git fuzzy-matched them, Linux did not.
Patches regenerated via git format-patch after applying all changes.

Fixes applied:
- P0000: unbind_to on no-candidate fall-through path; hunk regenerated
- P0001: block_input + record_unwind_protect_void in ns_ax_buffer_text
- P0003: [trims release] MRC memory leak; block_input already present
- P0004: mojibake comment (--- not UTF-8 em-dash)
- P0006: texinfo dangling semicolons -> periods in GNUstep paragraph
- P0007: em-dash fixes removed (content was already --- from P0004/P0005)
- P0008: childFrameLastBuffer -> BVAR(b,name) for GC safety;
  BUF_OVERLAY_MODIFF removed from ensureTextCache (hl-line-mode O(N)
  rebuild regression); block_input in ns_ax_buffer_text (P0001 scope);
  voiceoverSetPoint and childFrameLastBuffer explicit init in
  initFrameFromEmacs:; cachedOverlayModiffForText ivar removed
This commit is contained in:
2026-03-02 18:50:45 +01:00
parent 51f59441c1
commit 6176087cfb
9 changed files with 176 additions and 200 deletions

View File

@@ -1,7 +1,7 @@
From c777281b5f05b463ec4bb8bdcb71bdcf400a10c6 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 14:46:25 +0100
Subject: [PATCH 7/8] ns: announce overlay completion candidates for VoiceOver
From 1c8bbd32afe8d5686c8c875feb399a20ea656d72 Mon Sep 17 00:00:00 2001
From: Daneel <daneel@sukany.cz>
Date: Mon, 2 Mar 2026 18:39:46 +0100
Subject: [PATCH 8/9] 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
@@ -18,11 +18,11 @@ 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 | 330 ++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 289 insertions(+), 42 deletions(-)
src/nsterm.m | 324 ++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 286 insertions(+), 39 deletions(-)
diff --git a/src/nsterm.h b/src/nsterm.h
index 5746e9e..21a93bc 100644
index 5746e9e9bd..21a93bc799 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -510,6 +510,7 @@ typedef struct ns_ax_visible_run
@@ -34,10 +34,10 @@ index 5746e9e..21a93bc 100644
@property (nonatomic, assign) BOOL cachedMarkActive;
@property (nonatomic, copy) NSString *cachedCompletionAnnouncement;
diff --git a/src/nsterm.m b/src/nsterm.m
index 426b029..8d44b5f 100644
index 062066d4e5..5e6ab11295 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7271,11 +7271,154 @@ Accessibility virtual elements (macOS / Cocoa only)
@@ -7263,11 +7263,154 @@ Accessibility virtual elements (macOS / Cocoa only)
/* ---- Helper: extract buffer text for accessibility ---- */
@@ -193,7 +193,7 @@ index 426b029..8d44b5f 100644
static NSString *
ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start,
ns_ax_visible_run **out_runs, NSUInteger *out_nruns)
@@ -7346,7 +7489,7 @@ Accessibility virtual elements (macOS / Cocoa only)
@@ -7338,7 +7481,7 @@ Accessibility virtual elements (macOS / Cocoa only)
/* Extract this visible run's text. Use
Fbuffer_substring_no_properties which correctly handles the
@@ -202,7 +202,7 @@ index 426b029..8d44b5f 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));
@@ -7427,7 +7570,7 @@ Mode lines using icon fonts (e.g. nerd-font icons)
@@ -7419,7 +7562,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 +211,7 @@ index 426b029..8d44b5f 100644
charposForAccessibilityIndex which handles invisible text. */
ptrdiff_t cp_start = charpos_start;
ptrdiff_t cp_end = cp_start + charpos_len;
@@ -7906,6 +8049,7 @@ @implementation EmacsAccessibilityBuffer
@@ -7894,6 +8037,7 @@ @implementation EmacsAccessibilityBuffer
@synthesize cachedOverlayModiff;
@synthesize cachedTextStart;
@synthesize cachedModiff;
@@ -219,7 +219,7 @@ index 426b029..8d44b5f 100644
@synthesize cachedPoint;
@synthesize cachedMarkActive;
@synthesize cachedCompletionAnnouncement;
@@ -8003,7 +8147,7 @@ - (void)ensureTextCache
@@ -7991,7 +8135,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 +228,7 @@ index 426b029..8d44b5f 100644
write section at the end needs synchronization to protect
against concurrent reads from AX server thread. */
eassert ([NSThread isMainThread]);
@@ -8015,25 +8159,16 @@ - (void)ensureTextCache
@@ -8003,25 +8147,16 @@ - (void)ensureTextCache
if (!b)
return;
@@ -262,7 +262,7 @@ index 426b029..8d44b5f 100644
&& cachedTextStart == BUF_BEGV (b)
&& pt >= cachedTextStart
&& (textLen == 0
@@ -8049,7 +8184,7 @@ included in the cached AX text (it is handled separately via
@@ -8037,7 +8172,7 @@ included in the cached AX text (it is handled separately via
{
[cachedText release];
cachedText = [text retain];
@@ -271,7 +271,7 @@ index 426b029..8d44b5f 100644
cachedTextStart = start;
if (visibleRuns)
@@ -8118,7 +8253,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
@@ -8106,7 +8241,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
@@ -280,7 +280,7 @@ index 426b029..8d44b5f 100644
NSUInteger lo = 0, hi = visibleRunCount;
while (lo < hi)
{
@@ -8167,10 +8302,10 @@ by run length (visible window), not total buffer size. */
@@ -8155,10 +8290,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
@@ -293,7 +293,7 @@ index 426b029..8d44b5f 100644
@synchronized (self)
{
if (visibleRunCount == 0)
@@ -8212,7 +8347,7 @@ the slow path (composed character sequence walk), which is
@@ -8200,7 +8335,7 @@ the slow path (composed character sequence walk), which is
return cp;
}
}
@@ -302,7 +302,7 @@ index 426b029..8d44b5f 100644
if (lo > 0)
{
ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
@@ -8234,7 +8369,7 @@ the slow path (composed character sequence walk), which is
@@ -8222,7 +8357,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
@@ -311,7 +311,7 @@ index 426b029..8d44b5f 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
@@ -8588,6 +8723,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
@@ -8568,6 +8703,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
return [self lineForAXIndex:point_idx];
}
@@ -362,7 +362,7 @@ index 426b029..8d44b5f 100644
- (NSRange)accessibilityRangeForLine:(NSInteger)line
{
if (![NSThread isMainThread])
@@ -8810,7 +8989,7 @@ - (NSRect)accessibilityFrame
@@ -8790,7 +8969,7 @@ - (NSRect)accessibilityFrame
/* ===================================================================
@@ -371,7 +371,7 @@ index 426b029..8d44b5f 100644
These methods notify VoiceOver of text and selection changes.
Called from the redisplay cycle (postAccessibilityUpdates).
@@ -8825,7 +9004,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8805,7 +8984,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
if (point > self.cachedPoint
&& point - self.cachedPoint == 1)
{
@@ -380,7 +380,7 @@ index 426b029..8d44b5f 100644
[self invalidateTextCache];
[self ensureTextCache];
if (cachedText)
@@ -8844,7 +9023,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8824,7 +9003,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
@@ -389,7 +389,7 @@ index 426b029..8d44b5f 100644
self.cachedPoint = point;
NSDictionary *change = @{
@@ -9178,16 +9357,83 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
@@ -9216,16 +9395,83 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
BOOL markActive = !NILP (BVAR (b, mark_active));
/* --- Text changed (edit) --- */
@@ -477,34 +477,7 @@ index 426b029..8d44b5f 100644
{
ptrdiff_t oldPoint = self.cachedPoint;
BOOL oldMarkActive = self.cachedMarkActive;
@@ -9355,7 +9601,7 @@ - (NSRect)accessibilityFrame
/* ===================================================================
- EmacsAccessibilityInteractiveSpan — helpers and implementation
+ EmacsAccessibilityInteractiveSpan --- helpers and implementation
=================================================================== */
/* Scan visible range of window W for interactive spans.
@@ -9564,7 +9810,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
dispatch_async (dispatch_get_main_queue (), ^{
/* lwin is a Lisp_Object captured by value. This is GC-safe
because Lisp_Objects are tagged integers/pointers that
- remain valid across GC — GC does not relocate objects in
+ remain valid across GC --- GC does not relocate objects in
Emacs. The WINDOW_LIVE_P check below guards against the
window being deleted between capture and execution. */
if (!WINDOWP (lwin) || NILP (Fwindow_live_p (lwin)))
@@ -9590,7 +9836,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
@end
-/* EmacsAccessibilityBuffer — InteractiveSpans category.
+/* EmacsAccessibilityBuffer --- InteractiveSpans category.
Methods are kept here (same .m file) so they access the ivars
declared in the @interface ivar block. */
@implementation EmacsAccessibilityBuffer (InteractiveSpans)
@@ -12312,7 +12558,7 @@ - (int) fullscreenState
@@ -12350,7 +12596,7 @@ - (int) fullscreenState
if (WINDOW_LEAF_P (w))
{
@@ -513,7 +486,7 @@ index 426b029..8d44b5f 100644
EmacsAccessibilityBuffer *elem
= [existing objectForKey:[NSValue valueWithPointer:w]];
if (!elem)
@@ -12346,7 +12592,7 @@ - (int) fullscreenState
@@ -12384,7 +12630,7 @@ - (int) fullscreenState
}
else
{
@@ -522,7 +495,7 @@ index 426b029..8d44b5f 100644
Lisp_Object child = w->contents;
while (!NILP (child))
{
@@ -12458,7 +12704,7 @@ - (void)postAccessibilityUpdates
@@ -12496,7 +12742,7 @@ - (void)postAccessibilityUpdates
accessibilityUpdating = YES;
/* Detect window tree change (split, delete, new buffer). Compare
@@ -531,7 +504,7 @@ index 426b029..8d44b5f 100644
Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe);
if (!EQ (curRoot, lastRootWindow))
{
@@ -12467,12 +12713,12 @@ - (void)postAccessibilityUpdates
@@ -12505,12 +12751,12 @@ - (void)postAccessibilityUpdates
}
/* If tree is stale, rebuild FIRST so we don't iterate freed