patches: fix all compile errors and review issues
- ZV_S -> BUF_ZV (undefined macro) - cf->current_buffer -> XWINDOW(cf->selected_window)->contents (current_buffer is a thread macro, can't use as field name) - find_newline: add record_unwind_current_buffer + set_buffer_internal_1 - ns_zoom_track_completion: add specpdl unwind protection - ns_zoom_face_is_selected: replace with forward decl of ns_ax_face_is_selected (eliminates duplicate) - childFrameLastBuffer: struct buffer * -> Lisp_Object (safe vs kill-buffer) - EmacsView dealloc: xfree childFrameLastCandidate (memory leak) - postCompletionAnnouncementForBuffer: add block_input/unblock_input
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 43b0625a7b9ce634006811e814fff037af8a51cd Mon Sep 17 00:00:00 2001
|
||||
From a9ea010735a6839a9f5cceb728e1a072cf0b3bfb 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 2e8ae20..b9b2a80 100644
|
||||
index 93da88a..b3bdd42 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -7152,11 +7152,154 @@ Accessibility virtual elements (macOS / Cocoa only)
|
||||
@@ -7147,11 +7147,154 @@ Accessibility virtual elements (macOS / Cocoa only)
|
||||
|
||||
/* ---- Helper: extract buffer text for accessibility ---- */
|
||||
|
||||
@@ -220,7 +220,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
static NSString *
|
||||
ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start,
|
||||
ns_ax_visible_run **out_runs, NSUInteger *out_nruns)
|
||||
@@ -7227,7 +7370,7 @@ Accessibility virtual elements (macOS / Cocoa only)
|
||||
@@ -7222,7 +7365,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 2e8ae20..b9b2a80 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));
|
||||
@@ -7308,7 +7451,7 @@ Mode lines using icon fonts (e.g. doom-modeline with nerd-font)
|
||||
@@ -7303,7 +7446,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 2e8ae20..b9b2a80 100644
|
||||
charposForAccessibilityIndex which handles invisible text. */
|
||||
ptrdiff_t cp_start = charpos_start;
|
||||
ptrdiff_t cp_end = cp_start + charpos_len;
|
||||
@@ -7787,6 +7930,7 @@ @implementation EmacsAccessibilityBuffer
|
||||
@@ -7782,6 +7925,7 @@ @implementation EmacsAccessibilityBuffer
|
||||
@synthesize cachedOverlayModiff;
|
||||
@synthesize cachedTextStart;
|
||||
@synthesize cachedModiff;
|
||||
@@ -246,7 +246,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
@synthesize cachedPoint;
|
||||
@synthesize cachedMarkActive;
|
||||
@synthesize cachedCompletionAnnouncement;
|
||||
@@ -7884,7 +8028,7 @@ - (void)ensureTextCache
|
||||
@@ -7879,7 +8023,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 2e8ae20..b9b2a80 100644
|
||||
write section at the end needs synchronization to protect
|
||||
against concurrent reads from AX server thread. */
|
||||
eassert ([NSThread isMainThread]);
|
||||
@@ -7897,16 +8041,15 @@ - (void)ensureTextCache
|
||||
@@ -7892,16 +8036,15 @@ - (void)ensureTextCache
|
||||
return;
|
||||
|
||||
ptrdiff_t modiff = BUF_MODIFF (b);
|
||||
@@ -278,7 +278,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
&& cachedTextStart == BUF_BEGV (b)
|
||||
&& pt >= cachedTextStart
|
||||
&& (textLen == 0
|
||||
@@ -7923,7 +8066,6 @@ - (void)ensureTextCache
|
||||
@@ -7918,7 +8061,6 @@ - (void)ensureTextCache
|
||||
[cachedText release];
|
||||
cachedText = [text retain];
|
||||
cachedTextModiff = modiff;
|
||||
@@ -286,7 +286,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
cachedTextStart = start;
|
||||
|
||||
if (visibleRuns)
|
||||
@@ -7988,7 +8130,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
|
||||
@@ -7983,7 +8125,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
|
||||
@@ -295,7 +295,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
NSUInteger lo = 0, hi = visibleRunCount;
|
||||
while (lo < hi)
|
||||
{
|
||||
@@ -8001,7 +8143,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
|
||||
@@ -7996,7 +8138,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
|
||||
else
|
||||
{
|
||||
/* Found: charpos is inside this run. Compute UTF-16 delta
|
||||
@@ -304,7 +304,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
NSUInteger chars_in = (NSUInteger)(charpos - r->charpos);
|
||||
if (chars_in == 0 || !cachedText)
|
||||
return r->ax_start;
|
||||
@@ -8026,10 +8168,10 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
|
||||
@@ -8021,10 +8163,10 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
|
||||
|
||||
/* Convert accessibility string index to buffer charpos.
|
||||
Safe to call from any thread: uses only cachedText (NSString) and
|
||||
@@ -317,7 +317,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
@synchronized (self)
|
||||
{
|
||||
if (visibleRunCount == 0)
|
||||
@@ -8063,7 +8205,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
|
||||
@@ -8058,7 +8200,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
|
||||
return cp;
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
if (lo > 0)
|
||||
{
|
||||
ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
|
||||
@@ -8085,7 +8227,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
|
||||
@@ -8080,7 +8222,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
|
||||
@@ -335,7 +335,7 @@ index 2e8ae20..b9b2a80 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
|
||||
@@ -8439,6 +8581,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
|
||||
@@ -8434,6 +8576,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
|
||||
return [self lineForAXIndex:point_idx];
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
- (NSRange)accessibilityRangeForLine:(NSInteger)line
|
||||
{
|
||||
if (![NSThread isMainThread])
|
||||
@@ -8661,7 +8847,7 @@ - (NSRect)accessibilityFrame
|
||||
@@ -8656,7 +8842,7 @@ - (NSRect)accessibilityFrame
|
||||
|
||||
|
||||
/* ===================================================================
|
||||
@@ -395,7 +395,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
|
||||
These methods notify VoiceOver of text and selection changes.
|
||||
Called from the redisplay cycle (postAccessibilityUpdates).
|
||||
@@ -8676,7 +8862,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
|
||||
@@ -8671,7 +8857,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
|
||||
if (point > self.cachedPoint
|
||||
&& point - self.cachedPoint == 1)
|
||||
{
|
||||
@@ -404,7 +404,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
[self invalidateTextCache];
|
||||
[self ensureTextCache];
|
||||
if (cachedText)
|
||||
@@ -8695,7 +8881,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
|
||||
@@ -8690,7 +8876,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
|
||||
@@ -413,7 +413,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
self.cachedPoint = point;
|
||||
|
||||
NSDictionary *change = @{
|
||||
@@ -9028,14 +9214,72 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
||||
@@ -9023,14 +9209,72 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
||||
BOOL markActive = !NILP (BVAR (b, mark_active));
|
||||
|
||||
/* --- Text changed (edit) --- */
|
||||
@@ -488,7 +488,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
per the WebKit/Chromium pattern. */
|
||||
else if (point != self.cachedPoint || markActive != self.cachedMarkActive)
|
||||
{
|
||||
@@ -9205,7 +9449,7 @@ - (NSRect)accessibilityFrame
|
||||
@@ -9200,7 +9444,7 @@ - (NSRect)accessibilityFrame
|
||||
|
||||
|
||||
/* ===================================================================
|
||||
@@ -497,7 +497,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
=================================================================== */
|
||||
|
||||
/* Scan visible range of window W for interactive spans.
|
||||
@@ -9413,7 +9657,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
|
||||
@@ -9408,7 +9652,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
|
||||
@@ -506,7 +506,7 @@ index 2e8ae20..b9b2a80 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)))
|
||||
@@ -9439,7 +9683,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
|
||||
@@ -9434,7 +9678,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
|
||||
|
||||
@end
|
||||
|
||||
@@ -515,7 +515,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
Methods are kept here (same .m file) so they access the ivars
|
||||
declared in the @interface ivar block. */
|
||||
@implementation EmacsAccessibilityBuffer (InteractiveSpans)
|
||||
@@ -12161,7 +12405,7 @@ - (int) fullscreenState
|
||||
@@ -12159,7 +12403,7 @@ - (int) fullscreenState
|
||||
|
||||
if (WINDOW_LEAF_P (w))
|
||||
{
|
||||
@@ -524,7 +524,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
EmacsAccessibilityBuffer *elem
|
||||
= [existing objectForKey:[NSValue valueWithPointer:w]];
|
||||
if (!elem)
|
||||
@@ -12195,7 +12439,7 @@ - (int) fullscreenState
|
||||
@@ -12193,7 +12437,7 @@ - (int) fullscreenState
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -533,7 +533,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
Lisp_Object child = w->contents;
|
||||
while (!NILP (child))
|
||||
{
|
||||
@@ -12307,7 +12551,7 @@ - (void)postAccessibilityUpdates
|
||||
@@ -12305,7 +12549,7 @@ - (void)postAccessibilityUpdates
|
||||
accessibilityUpdating = YES;
|
||||
|
||||
/* Detect window tree change (split, delete, new buffer). Compare
|
||||
@@ -542,7 +542,7 @@ index 2e8ae20..b9b2a80 100644
|
||||
Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe);
|
||||
if (!EQ (curRoot, lastRootWindow))
|
||||
{
|
||||
@@ -12316,12 +12560,12 @@ - (void)postAccessibilityUpdates
|
||||
@@ -12314,12 +12558,12 @@ - (void)postAccessibilityUpdates
|
||||
}
|
||||
|
||||
/* If tree is stale, rebuild FIRST so we don't iterate freed
|
||||
|
||||
Reference in New Issue
Block a user