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