patches: fix I2 body indent and I3 childFrameLastCandidate type

I2: Re-indent body of MINI_WINDOW_P if-block in 0008 from 6 spaces to
8 spaces, consistent with GNU style (if at 6 spaces, body at 8).

I3: Change childFrameLastCandidate from char* to NSString*.
Replaces xstrdup/xfree/strcmp with ObjC retain/release/isEqualToString:,
which is consistent with surrounding ObjC code style and avoids
heap allocation with xmalloc.
This commit is contained in:
2026-03-04 13:35:54 +01:00
parent 9ad01c03fd
commit f51da9f8d4

View File

@@ -140,7 +140,7 @@ index 72ca210bb0..1c79c8aced 100644
BOOL accessibilityTreeValid;
BOOL accessibilityUpdating;
+ BOOL childFrameCompletionActive;
+ char *childFrameLastCandidate;
+ NSString *childFrameLastCandidate;
+ Lisp_Object childFrameLastBuffer;
+ EMACS_INT childFrameLastModiff;
+ /* Last BUF_CHARS_MODIFF seen for echo_area_buffer[0]. Used by
@@ -480,11 +480,11 @@ index c9fe93a57b..f7574efb39 100644
+ if (MINI_WINDOW_P (w) && !didTextChange)
+ {
+
+ int selected_line = -1;
+ NSString *candidate
+ int selected_line = -1;
+ NSString *candidate
+ = ns_ax_selected_overlay_text (b, BUF_BEGV (b), BUF_ZV (b),
+ &selected_line);
+ if (candidate)
+ if (candidate)
{
- int selected_line = -1;
- NSString *candidate
@@ -656,13 +656,12 @@ index c9fe93a57b..f7574efb39 100644
block_input ();
specpdl_ref blk_count = SPECPDL_INDEX ();
record_unwind_protect_void (unblock_input);
@@ -10056,6 +10255,10 @@ - (void)dealloc
@@ -10056,6 +10255,9 @@ - (void)dealloc
#endif
[accessibilityElements release];
+#ifdef NS_IMPL_COCOA
+ if (childFrameLastCandidate)
+ xfree (childFrameLastCandidate);
+ [childFrameLastCandidate release];
+#endif
[[self menu] release];
[super dealloc];
@@ -677,7 +676,7 @@ index c9fe93a57b..f7574efb39 100644
scrollbarsNeedingUpdate = 0;
fs_state = FULLSCREEN_NONE;
fs_before_fs = next_maximized = -1;
@@ -12813,6 +13019,159 @@ - (id)accessibilityFocusedUIElement
@@ -12813,6 +13019,158 @@ - (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. */
@@ -804,11 +803,10 @@ index c9fe93a57b..f7574efb39 100644
+ return;
+
+ /* Deduplicate --- avoid re-announcing the same candidate. */
+ const char *cstr = [candidate UTF8String];
+ if (childFrameLastCandidate && strcmp (cstr, childFrameLastCandidate) == 0)
+ if ([candidate isEqualToString:childFrameLastCandidate])
+ return;
+ xfree (childFrameLastCandidate);
+ childFrameLastCandidate = xstrdup (cstr);
+ [childFrameLastCandidate release];
+ childFrameLastCandidate = [candidate copy];
+
+ NSDictionary *annInfo = @{
+ NSAccessibilityAnnouncementKey: candidate,
@@ -837,7 +835,7 @@ index c9fe93a57b..f7574efb39 100644
- (void)postAccessibilityUpdates
{
NSTRACE ("[EmacsView postAccessibilityUpdates]");
@@ -12823,11 +13182,69 @@ - (void)postAccessibilityUpdates
@@ -12823,14 +13182,71 @@ - (void)postAccessibilityUpdates
/* Re-entrance guard: VoiceOver callbacks during notification posting
can trigger redisplay, which calls ns_update_end, which calls us