patches: fix Corfu completion tracking in Zoom

Fget_char_property with a buffer as OBJECT checks text properties
only.  Corfu highlights the selected candidate (corfu-current) via
an overlay, not a text property, so the scan always returned -1 and
Zoom focus stayed on the first line.

Pass cf->selected_window instead of cw->contents so that overlays
are included in the property lookup.  Vertico uses text properties
and is unaffected; child-frame completion frameworks that use overlays
(Corfu, Company-box) now track correctly.
This commit is contained in:
2026-03-01 06:50:46 +01:00
parent 636545c2a5
commit d15fe43bf0
9 changed files with 82 additions and 76 deletions

View File

@@ -1,4 +1,4 @@
From d494967af08ec3e5bb94ff50126c2994505a6d85 Mon Sep 17 00:00:00 2001
From 380124ba2243d4a587cb748aa6e88c0384400154 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 22:39:35 +0100
Subject: [PATCH 1/9] ns: integrate with macOS Zoom for cursor tracking
@@ -38,8 +38,8 @@ window splits, switches (C-x o), and completion frameworks.
---
etc/NEWS | 11 ++
src/nsterm.h | 6 +
src/nsterm.m | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 356 insertions(+)
src/nsterm.m | 345 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 362 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index ef36df5..80661a9 100644
@@ -81,10 +81,10 @@ index 7c1ee4c..ea6e7ba 100644
}
diff --git a/src/nsterm.m b/src/nsterm.m
index 74e4ad5..6527750 100644
index 74e4ad5..f9ec72d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1081,6 +1081,271 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
@@ -1081,6 +1081,277 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
}
@@ -228,6 +228,12 @@ index 74e4ad5..6527750 100644
+ ptrdiff_t zv = BUF_ZV (b);
+ int line = 0;
+
+ /* Pass the window (not the buffer) to Fget_char_property so
+ that overlay face properties are checked in addition to text
+ properties. Corfu highlights the selected candidate with an
+ overlay face (corfu-current); text-property-only lookup misses
+ it. Vertico uses text properties, so either form works there,
+ but passing the window is strictly correct for both. */
+ specpdl_ref count = SPECPDL_INDEX ();
+ record_unwind_current_buffer ();
+ set_buffer_internal_1 (b);
@@ -237,7 +243,7 @@ index 74e4ad5..6527750 100644
+ {
+ Lisp_Object face
+ = Fget_char_property (make_fixnum (pos), Qface,
+ cw->contents);
+ cf->selected_window);
+ if (ns_zoom_face_is_selected (face))
+ {
+ unbind_to (count, Qnil);
@@ -356,7 +362,7 @@ index 74e4ad5..6527750 100644
static void
ns_update_end (struct frame *f)
/* --------------------------------------------------------------------------
@@ -1104,6 +1369,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
@@ -1104,6 +1375,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
unblock_input ();
ns_updating_frame = NULL;
@@ -398,7 +404,7 @@ index 74e4ad5..6527750 100644
}
static void
@@ -3232,6 +3532,45 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
@@ -3232,6 +3538,45 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
/* Prevent the cursor from being drawn outside the text area. */
r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA));

View File

@@ -1,4 +1,4 @@
From 971bf8f19bec3a89144ddf2375cd17a4d95bb707 Mon Sep 17 00:00:00 2001
From cfbcc32408407a7742192872b4ee1ba771bfc9e6 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 2/9] ns: add accessibility base classes and text extraction
@@ -188,7 +188,7 @@ index ea6e7ba..6e830de 100644
diff --git a/src/nsterm.m b/src/nsterm.m
index 6527750..3e97248 100644
index f9ec72d..3b5633c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch)
@@ -199,7 +199,7 @@ index 6527750..3e97248 100644
#include "systime.h"
#include "character.h"
#include "xwidget.h"
@@ -7195,6 +7196,430 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
@@ -7201,6 +7202,430 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
}
#endif
@@ -630,7 +630,7 @@ index 6527750..3e97248 100644
/* ==========================================================================
EmacsView implementation
@@ -11651,6 +12076,28 @@ Convert an X font name (XLFD) to an NS font name.
@@ -11657,6 +12082,28 @@ Convert an X font name (XLFD) to an NS font name.
DEFSYM (Qns_drag_operation_generic, "ns-drag-operation-generic");
DEFSYM (Qns_handle_drag_motion, "ns-handle-drag-motion");
@@ -659,7 +659,7 @@ index 6527750..3e97248 100644
Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
@@ -11783,7 +12230,7 @@ Convert an X font name (XLFD) to an NS font name.
@@ -11789,7 +12236,7 @@ Convert an X font name (XLFD) to an NS font name.
doc: /* Non-nil means to use native fullscreen on Mac OS X 10.7 and later.
Nil means use fullscreen the old (< 10.7) way. The old way works better with
multiple monitors, but lacks tool bar. This variable is ignored on
@@ -668,7 +668,7 @@ index 6527750..3e97248 100644
ns_use_native_fullscreen = YES;
ns_last_use_native_fullscreen = ns_use_native_fullscreen;
@@ -11799,10 +12246,19 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -11805,10 +12252,19 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
This variable is ignored on Mac OS X < 10.7 and GNUstep. */);
ns_use_srgb_colorspace = YES;
@@ -689,7 +689,7 @@ index 6527750..3e97248 100644
ns_use_mwheel_acceleration = YES;
DEFVAR_LISP ("ns-mwheel-line-height", ns_mwheel_line_height,
@@ -11813,7 +12269,7 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -11819,7 +12275,7 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
DEFVAR_BOOL ("ns-use-mwheel-momentum", ns_use_mwheel_momentum,
doc: /* Non-nil means mouse wheel scrolling uses momentum.

View File

@@ -1,4 +1,4 @@
From d49a7ef5e31a5988d6c54a04561326cff8444a2f Mon Sep 17 00:00:00 2001
From 6c0b194068b60d3479307d8d2f9074b6d569e1b2 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 3/9] ns: implement buffer accessibility element (core
@@ -22,10 +22,10 @@ line-by-line navigation, word/character announcements.
1 file changed, 1104 insertions(+)
diff --git a/src/nsterm.m b/src/nsterm.m
index 3e97248..7beedc4 100644
index 3b5633c..9ad3838 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7617,6 +7617,1110 @@ - (id)accessibilityTopLevelUIElement
@@ -7623,6 +7623,1110 @@ - (id)accessibilityTopLevelUIElement
@end

View File

@@ -1,4 +1,4 @@
From 5a58044053001af12f388af2960f903427676c8f Mon Sep 17 00:00:00 2001
From 77e24fc828380ed53ca4ec02f207a8adefcbf73f 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/9] ns: add buffer notification dispatch and mode-line
@@ -24,10 +24,10 @@ region selection feedback, completion popups, mode-line reading.
1 file changed, 545 insertions(+)
diff --git a/src/nsterm.m b/src/nsterm.m
index 7beedc4..ecc8c54 100644
index 9ad3838..4a5b624 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8721,6 +8721,551 @@ - (NSRect)accessibilityFrame
@@ -8727,6 +8727,551 @@ - (NSRect)accessibilityFrame
@end

View File

@@ -1,4 +1,4 @@
From 388628944f6ecc74806932e0ee2ad89c3df669ed Mon Sep 17 00:00:00 2001
From 94993f66e28d3787ff4cdd60522a267c38247b11 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
@@ -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 ecc8c54..5eaf480 100644
index 4a5b624..d8b18ae 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -9266,6 +9266,292 @@ - (NSRect)accessibilityFrame
@@ -9272,6 +9272,292 @@ - (NSRect)accessibilityFrame
@end

View File

@@ -1,4 +1,4 @@
From 61a0ae5344e6f52cb21ae299133b39b2ede010d0 Mon Sep 17 00:00:00 2001
From 52bbb70e63cf384daa353394b2f5a1857f9912b7 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 6/9] ns: integrate accessibility with EmacsView and redisplay
@@ -51,10 +51,10 @@ index 80661a9..2b1f9e6 100644
** Re-introduced dictation, lost in Emacs v30 (macOS).
We lost macOS dictation in v30 when migrating to NSTextInputClient.
diff --git a/src/nsterm.m b/src/nsterm.m
index 5eaf480..4ad451f 100644
index d8b18ae..ff03ee6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1258,7 +1258,7 @@ If a completion candidate is selected (overlay or child frame),
@@ -1264,7 +1264,7 @@ If a completion candidate is selected (overlay or child frame),
static void
ns_zoom_track_completion (struct frame *f, EmacsView *view)
{
@@ -63,7 +63,7 @@ index 5eaf480..4ad451f 100644
return;
if (!WINDOWP (f->selected_window))
return;
@@ -1378,7 +1378,8 @@ so the visual offset is (ov_line + 1) * line_h from
@@ -1384,7 +1384,8 @@ so the visual offset is (ov_line + 1) * line_h from
(zoomCursorUpdated is NO). */
#if defined (MAC_OS_X_VERSION_MIN_REQUIRED) \
&& MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@@ -73,7 +73,7 @@ index 5eaf480..4ad451f 100644
&& !NSIsEmptyRect (view->lastCursorRect))
{
NSRect r = view->lastCursorRect;
@@ -1405,6 +1406,9 @@ so the visual offset is (ov_line + 1) * line_h from
@@ -1411,6 +1412,9 @@ so the visual offset is (ov_line + 1) * line_h from
if (view)
ns_zoom_track_completion (f, view);
#endif /* NS_IMPL_COCOA */
@@ -83,7 +83,7 @@ index 5eaf480..4ad451f 100644
}
static void
@@ -3552,7 +3556,7 @@ EmacsView pixels (AppKit, flipped, top-left origin)
@@ -3558,7 +3562,7 @@ EmacsView pixels (AppKit, flipped, top-left origin)
#if defined (MAC_OS_X_VERSION_MIN_REQUIRED) \
&& MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@@ -92,7 +92,7 @@ index 5eaf480..4ad451f 100644
{
NSRect windowRect = [view convertRect:r toView:nil];
NSRect screenRect
@@ -6717,9 +6721,56 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
@@ -6723,9 +6727,56 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
}
#endif
@@ -149,7 +149,7 @@ index 5eaf480..4ad451f 100644
- (void)antialiasThresholdDidChange:(NSNotification *)notification
{
#ifdef NS_IMPL_COCOA
@@ -7620,7 +7671,6 @@ - (id)accessibilityTopLevelUIElement
@@ -7626,7 +7677,6 @@ - (id)accessibilityTopLevelUIElement
@@ -157,7 +157,7 @@ index 5eaf480..4ad451f 100644
static BOOL
ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
ptrdiff_t *out_start,
@@ -8722,7 +8772,6 @@ - (NSRect)accessibilityFrame
@@ -8728,7 +8778,6 @@ - (NSRect)accessibilityFrame
@end
@@ -165,7 +165,7 @@ index 5eaf480..4ad451f 100644
/* ===================================================================
EmacsAccessibilityBuffer (Notifications) — AX event dispatch
@@ -9267,7 +9316,6 @@ - (NSRect)accessibilityFrame
@@ -9273,7 +9322,6 @@ - (NSRect)accessibilityFrame
@end
@@ -173,7 +173,7 @@ index 5eaf480..4ad451f 100644
/* ===================================================================
EmacsAccessibilityInteractiveSpan — helpers and implementation
=================================================================== */
@@ -9597,6 +9645,7 @@ - (void)dealloc
@@ -9603,6 +9651,7 @@ - (void)dealloc
[layer release];
#endif
@@ -181,7 +181,7 @@ index 5eaf480..4ad451f 100644
[[self menu] release];
[super dealloc];
}
@@ -10945,6 +10994,32 @@ - (void)windowDidBecomeKey /* for direct calls */
@@ -10951,6 +11000,32 @@ - (void)windowDidBecomeKey /* for direct calls */
XSETFRAME (event.frame_or_window, emacsframe);
kbd_buffer_store_event (&event);
ns_send_appdefined (-1); // Kick main loop
@@ -214,7 +214,7 @@ index 5eaf480..4ad451f 100644
}
@@ -12182,6 +12257,332 @@ - (int) fullscreenState
@@ -12188,6 +12263,332 @@ - (int) fullscreenState
return fs_state;
}
@@ -547,7 +547,7 @@ index 5eaf480..4ad451f 100644
@end /* EmacsView */
@@ -14182,12 +14583,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -14188,12 +14589,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
ns_use_srgb_colorspace = YES;
DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled,

View File

@@ -1,4 +1,4 @@
From e2213409bca76154764263879b4bd43459230d6c Mon Sep 17 00:00:00 2001
From 8a88edca0a142479227a20e5fc865cd7e0124d75 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 7/9] doc: add VoiceOver accessibility section to macOS

View File

@@ -1,4 +1,4 @@
From a5041ede13b2bbcea1ebcb501f8c7317c0fe998f Mon Sep 17 00:00:00 2001
From 6e5805fa028ebf96ecae238b8dc604ee29a20214 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 14:46:25 +0100
Subject: [PATCH 8/9] ns: announce overlay completion candidates for VoiceOver
@@ -61,10 +61,10 @@ index 6e830de..2102fb9 100644
@property (nonatomic, assign) BOOL cachedMarkActive;
@property (nonatomic, copy) NSString *cachedCompletionAnnouncement;
diff --git a/src/nsterm.m b/src/nsterm.m
index 4ad451f..5654283 100644
index ff03ee6..05ad1bc 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7257,11 +7257,154 @@ Accessibility virtual elements (macOS / Cocoa only)
@@ -7263,11 +7263,154 @@ Accessibility virtual elements (macOS / Cocoa only)
/* ---- Helper: extract buffer text for accessibility ---- */
@@ -220,7 +220,7 @@ index 4ad451f..5654283 100644
static NSString *
ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start,
ns_ax_visible_run **out_runs, NSUInteger *out_nruns)
@@ -7332,7 +7475,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
@@ -229,7 +229,7 @@ index 4ad451f..5654283 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));
@@ -7413,7 +7556,7 @@ Mode lines using icon fonts (e.g. doom-modeline with nerd-font)
@@ -7419,7 +7562,7 @@ Mode lines using icon fonts (e.g. doom-modeline with nerd-font)
return NSZeroRect;
/* charpos_start and charpos_len are already in buffer charpos
@@ -238,7 +238,7 @@ index 4ad451f..5654283 100644
charposForAccessibilityIndex which handles invisible text. */
ptrdiff_t cp_start = charpos_start;
ptrdiff_t cp_end = cp_start + charpos_len;
@@ -7892,6 +8035,7 @@ @implementation EmacsAccessibilityBuffer
@@ -7898,6 +8041,7 @@ @implementation EmacsAccessibilityBuffer
@synthesize cachedOverlayModiff;
@synthesize cachedTextStart;
@synthesize cachedModiff;
@@ -246,7 +246,7 @@ index 4ad451f..5654283 100644
@synthesize cachedPoint;
@synthesize cachedMarkActive;
@synthesize cachedCompletionAnnouncement;
@@ -7989,7 +8133,7 @@ - (void)ensureTextCache
@@ -7995,7 +8139,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
@@ -255,7 +255,7 @@ index 4ad451f..5654283 100644
write section at the end needs synchronization to protect
against concurrent reads from AX server thread. */
eassert ([NSThread isMainThread]);
@@ -8001,25 +8145,16 @@ - (void)ensureTextCache
@@ -8007,25 +8151,16 @@ - (void)ensureTextCache
if (!b)
return;
@@ -289,7 +289,7 @@ index 4ad451f..5654283 100644
&& cachedTextStart == BUF_BEGV (b)
&& pt >= cachedTextStart
&& (textLen == 0
@@ -8035,7 +8170,7 @@ included in the cached AX text (it is handled separately via
@@ -8041,7 +8176,7 @@ included in the cached AX text (it is handled separately via
{
[cachedText release];
cachedText = [text retain];
@@ -298,7 +298,7 @@ index 4ad451f..5654283 100644
cachedTextStart = start;
if (visibleRuns)
@@ -8100,7 +8235,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
@@ -307,7 +307,7 @@ index 4ad451f..5654283 100644
NSUInteger lo = 0, hi = visibleRunCount;
while (lo < hi)
{
@@ -8113,7 +8248,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
@@ -8119,7 +8254,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
else
{
/* Found: charpos is inside this run. Compute UTF-16 delta
@@ -316,7 +316,7 @@ index 4ad451f..5654283 100644
NSUInteger chars_in = (NSUInteger)(charpos - r->charpos);
if (chars_in == 0 || !cachedText)
return r->ax_start;
@@ -8138,10 +8273,10 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
@@ -8144,10 +8279,10 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
/* Convert accessibility string index to buffer charpos.
Safe to call from any thread: uses only cachedText (NSString) and
@@ -329,7 +329,7 @@ index 4ad451f..5654283 100644
@synchronized (self)
{
if (visibleRunCount == 0)
@@ -8175,7 +8310,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
@@ -8181,7 +8316,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
return cp;
}
}
@@ -338,7 +338,7 @@ index 4ad451f..5654283 100644
if (lo > 0)
{
ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
@@ -8197,7 +8332,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
@@ -8203,7 +8338,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
deadlocking the AX server thread. This is prevented by:
1. validWindow checks WINDOW_LIVE_P and BUFFERP before every
@@ -347,7 +347,7 @@ index 4ad451f..5654283 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
@@ -8551,6 +8686,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
@@ -8557,6 +8692,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
return [self lineForAXIndex:point_idx];
}
@@ -398,7 +398,7 @@ index 4ad451f..5654283 100644
- (NSRange)accessibilityRangeForLine:(NSInteger)line
{
if (![NSThread isMainThread])
@@ -8773,7 +8952,7 @@ - (NSRect)accessibilityFrame
@@ -8779,7 +8958,7 @@ - (NSRect)accessibilityFrame
/* ===================================================================
@@ -407,7 +407,7 @@ index 4ad451f..5654283 100644
These methods notify VoiceOver of text and selection changes.
Called from the redisplay cycle (postAccessibilityUpdates).
@@ -8788,7 +8967,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8794,7 +8973,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
if (point > self.cachedPoint
&& point - self.cachedPoint == 1)
{
@@ -416,7 +416,7 @@ index 4ad451f..5654283 100644
[self invalidateTextCache];
[self ensureTextCache];
if (cachedText)
@@ -8807,7 +8986,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8813,7 +8992,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
@@ -425,7 +425,7 @@ index 4ad451f..5654283 100644
self.cachedPoint = point;
NSDictionary *change = @{
@@ -9140,16 +9319,83 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
@@ -9146,16 +9325,83 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
BOOL markActive = !NILP (BVAR (b, mark_active));
/* --- Text changed (edit) --- */
@@ -513,7 +513,7 @@ index 4ad451f..5654283 100644
{
ptrdiff_t oldPoint = self.cachedPoint;
BOOL oldMarkActive = self.cachedMarkActive;
@@ -9317,7 +9563,7 @@ - (NSRect)accessibilityFrame
@@ -9323,7 +9569,7 @@ - (NSRect)accessibilityFrame
/* ===================================================================
@@ -522,7 +522,7 @@ index 4ad451f..5654283 100644
=================================================================== */
/* Scan visible range of window W for interactive spans.
@@ -9525,7 +9771,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
@@ -9531,7 +9777,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
@@ -531,7 +531,7 @@ index 4ad451f..5654283 100644
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)))
@@ -9551,7 +9797,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
@@ -9557,7 +9803,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
@end
@@ -540,7 +540,7 @@ index 4ad451f..5654283 100644
Methods are kept here (same .m file) so they access the ivars
declared in the @interface ivar block. */
@implementation EmacsAccessibilityBuffer (InteractiveSpans)
@@ -12273,7 +12519,7 @@ - (int) fullscreenState
@@ -12279,7 +12525,7 @@ - (int) fullscreenState
if (WINDOW_LEAF_P (w))
{
@@ -549,7 +549,7 @@ index 4ad451f..5654283 100644
EmacsAccessibilityBuffer *elem
= [existing objectForKey:[NSValue valueWithPointer:w]];
if (!elem)
@@ -12307,7 +12553,7 @@ - (int) fullscreenState
@@ -12313,7 +12559,7 @@ - (int) fullscreenState
}
else
{
@@ -558,7 +558,7 @@ index 4ad451f..5654283 100644
Lisp_Object child = w->contents;
while (!NILP (child))
{
@@ -12419,7 +12665,7 @@ - (void)postAccessibilityUpdates
@@ -12425,7 +12671,7 @@ - (void)postAccessibilityUpdates
accessibilityUpdating = YES;
/* Detect window tree change (split, delete, new buffer). Compare
@@ -567,7 +567,7 @@ index 4ad451f..5654283 100644
Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe);
if (!EQ (curRoot, lastRootWindow))
{
@@ -12428,12 +12674,12 @@ - (void)postAccessibilityUpdates
@@ -12434,12 +12680,12 @@ - (void)postAccessibilityUpdates
}
/* If tree is stale, rebuild FIRST so we don't iterate freed

View File

@@ -1,4 +1,4 @@
From 2dabc7e44d316fa29e64958383fbac230f0f6870 Mon Sep 17 00:00:00 2001
From 3abad1f5cf06d8dc5266013f3c4ba10c7da70ebe Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 16:01:29 +0100
Subject: [PATCH 9/9] ns: announce child frame completion candidates for
@@ -109,10 +109,10 @@ index 2102fb9..dd98d56 100644
@end
diff --git a/src/nsterm.m b/src/nsterm.m
index 5654283..69644d5 100644
index 05ad1bc..b78a126 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7401,6 +7401,112 @@ visual line index for Zoom (skip whitespace-only lines
@@ -7407,6 +7407,112 @@ visual line index for Zoom (skip whitespace-only lines
return nil;
}
@@ -225,7 +225,7 @@ index 5654283..69644d5 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
@@ -8145,16 +8251,25 @@ - (void)ensureTextCache
@@ -8151,16 +8257,25 @@ - (void)ensureTextCache
if (!b)
return;
@@ -259,7 +259,7 @@ index 5654283..69644d5 100644
&& cachedTextStart == BUF_BEGV (b)
&& pt >= cachedTextStart
&& (textLen == 0
@@ -8170,7 +8285,7 @@ included in the cached AX text (it is handled separately via
@@ -8176,7 +8291,7 @@ included in the cached AX text (it is handled separately via
{
[cachedText release];
cachedText = [text retain];
@@ -268,7 +268,7 @@ index 5654283..69644d5 100644
cachedTextStart = start;
if (visibleRuns)
@@ -9138,6 +9253,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
@@ -9144,6 +9259,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
ptrdiff_t currentOverlayStart = 0;
ptrdiff_t currentOverlayEnd = 0;
@@ -276,7 +276,7 @@ index 5654283..69644d5 100644
specpdl_ref count2 = SPECPDL_INDEX ();
record_unwind_current_buffer ();
if (b != current_buffer)
@@ -9296,6 +9412,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
@@ -9302,6 +9418,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
self.cachedCompletionOverlayEnd = 0;
self.cachedCompletionPoint = 0;
}
@@ -284,7 +284,7 @@ index 5654283..69644d5 100644
}
/* ---- Notification dispatch (main entry point) ---- */
@@ -9892,6 +10009,10 @@ - (void)dealloc
@@ -9898,6 +10015,10 @@ - (void)dealloc
#endif
[accessibilityElements release];
@@ -295,7 +295,7 @@ index 5654283..69644d5 100644
[[self menu] release];
[super dealloc];
}
@@ -11341,6 +11462,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
@@ -11347,6 +11468,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
windowClosing = NO;
processingCompose = NO;
@@ -305,7 +305,7 @@ index 5654283..69644d5 100644
scrollbarsNeedingUpdate = 0;
fs_state = FULLSCREEN_NONE;
fs_before_fs = next_maximized = -1;
@@ -12649,6 +12773,80 @@ - (id)accessibilityFocusedUIElement
@@ -12655,6 +12779,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. */
@@ -386,7 +386,7 @@ index 5654283..69644d5 100644
- (void)postAccessibilityUpdates
{
NSTRACE ("[EmacsView postAccessibilityUpdates]");
@@ -12659,11 +12857,59 @@ - (void)postAccessibilityUpdates
@@ -12665,11 +12863,59 @@ - (void)postAccessibilityUpdates
/* Re-entrance guard: VoiceOver callbacks during notification posting
can trigger redisplay, which calls ns_update_end, which calls us