Revert "patches: fix Corfu completion tracking in Zoom"

This reverts commit d15fe43bf0.
This commit is contained in:
2026-03-01 07:05:33 +01:00
parent d15fe43bf0
commit 19cc43dbbb
9 changed files with 76 additions and 82 deletions

View File

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