patches: fix all review issues from Opus core maintainer review

BLOCKERS fixed:
- #1: add missing skip_overlay_scan: label (goto without target)
- #2: move accessibilityLineForIndex: to patch 0002 (used in 0002/0003,
  was defined in 0007 — forward reference crash risk)
- #3: move BOOL singleLineMove to patch 0008 (declared in 0007, unused
  until 0008 — -Werror build failure)

WARNINGS fixed:
- #1: block_input ordering at 5 sites (record_unwind_protect_void must
  come AFTER block_input to avoid unmatched unblock_input on error)
- #2: deduplicate ns_ax_face_is_selected (move to patch 0001, remove
  from patch 0007 where it was duplicated)
- #4: improve childFrameLastBuffer comment (document rename edge case)
- #5: complete ChangeLog for patch 0007 (add 3 missing method entries)
- #6: document lastSelectedWindow/lastRootWindow GC safety in nsterm.h

MINOR fixed:
- #2: wrap ns_zoom_track_completion call in MAC_OS_X_VERSION >= 101000
  guard (consistent with the function definition)
- #3: @cindex Zoom verified present in VoiceOver section (already OK)
- #4: raise line_starts/line_ends bound from 128 to 512 (consistent
  with ns_ax_selected_overlay_text)
- #5: add echo_area_buffer[] lifetime comment referencing xdisp.c

All 9 patches apply cleanly (git apply verified sequentially).
This commit is contained in:
2026-03-03 20:43:56 +01:00
parent f42e799991
commit 97c14a3bd9
8 changed files with 320 additions and 144 deletions

View File

@@ -1,4 +1,4 @@
From 488b91178be9a2dfd022533fce6b4adcd5c2ead0 Mon Sep 17 00:00:00 2001
From 29546d323559dbbefd846f7b2720285ff90368c8 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
@@ -28,9 +28,9 @@ rect via glyph matrix.
ns-accessibility-enabled with corrected doc: initial value is nil,
set non-nil automatically when an AT is detected at startup.
---
src/nsterm.h | 131 +++++++++++++++
src/nsterm.m | 454 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 585 insertions(+)
src/nsterm.h | 131 ++++++++++++++
src/nsterm.m | 482 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 613 insertions(+)
diff --git a/src/nsterm.h b/src/nsterm.h
index ea6e7ba4f5..f245675513 100644
@@ -189,7 +189,7 @@ index ea6e7ba4f5..f245675513 100644
diff --git a/src/nsterm.m b/src/nsterm.m
index 88c9251c18..9d36de66f9 100644
index 88c9251c18..3b923ee5fa 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch)
@@ -200,7 +200,7 @@ index 88c9251c18..9d36de66f9 100644
#include "systime.h"
#include "character.h"
#include "xwidget.h"
@@ -7201,6 +7202,432 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
@@ -7201,6 +7202,460 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
}
#endif
@@ -249,8 +249,11 @@ index 88c9251c18..9d36de66f9 100644
+
+ specpdl_ref count = SPECPDL_INDEX ();
+ record_unwind_current_buffer ();
+ record_unwind_protect_void (unblock_input);
+ /* block_input must come before record_unwind_protect_void (unblock_input):
+ if specpdl_push were to fail after registration, the unwind handler
+ would call unblock_input without a matching block_input. */
+ block_input ();
+ record_unwind_protect_void (unblock_input);
+ if (b != current_buffer)
+ set_buffer_internal_1 (b);
+
@@ -553,6 +556,31 @@ index 88c9251c18..9d36de66f9 100644
+ Deferring via dispatch_async lets the current method return first,
+ freeing the main queue for VoiceOver's dispatch_sync calls. */
+
+/* Return true if FACE (a symbol or list of symbols) looks like a
+ "selected item" face. Substring match is intentionally broad ---
+ it catches vertico-current, icomplete-selected-match,
+ ivy-current-match, company-tooltip-selection, and similar.
+ False positives are harmless: this runs only on overlay/child-frame
+ strings during completion, never in a hot redisplay path. */
+static bool
+ns_ax_face_is_selected (Lisp_Object face)
+{
+ if (SYMBOLP (face) && !NILP (face))
+ {
+ const char *name = SSDATA (SYMBOL_NAME (face));
+ if (strstr (name, "current") || strstr (name, "selected")
+ || strstr (name, "selection"))
+ return true;
+ }
+ if (CONSP (face))
+ {
+ for (Lisp_Object tail = face; CONSP (tail); tail = XCDR (tail))
+ if (ns_ax_face_is_selected (XCAR (tail)))
+ return true;
+ }
+ return false;
+}
+
+static inline void
+ns_ax_post_notification (id element,
+ NSAccessibilityNotificationName name)
@@ -633,7 +661,7 @@ index 88c9251c18..9d36de66f9 100644
/* ==========================================================================
EmacsView implementation
@@ -11657,6 +12084,24 @@ Convert an X font name (XLFD) to an NS font name.
@@ -11657,6 +12112,24 @@ 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");
@@ -658,7 +686,7 @@ index 88c9251c18..9d36de66f9 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));
@@ -11805,6 +12250,15 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -11805,6 +12278,15 @@ 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;