patches: fix C-n/C-p VoiceOver regression - exclude isCtrlNP from re-anchor

When Emacs moves the cursor (emacsMovedCursor=YES), we post
FocusedUIElementChanged on the NSWindow to re-anchor VoiceOver's
browse cursor.  For C-n/C-p this notification races with
AXSelectedTextChanged(granularity=line) and causes VoiceOver to
drop the line-read speech.

Arrow key movement works because VoiceOver intercepts those as AX
selection changes (setAccessibilitySelectedTextRange:), making
voiceoverSetPoint=YES and emacsMovedCursor=NO, so no
FocusedUIElementChanged is posted.

Fix: skip FocusedUIElementChanged for sequential C-n/C-p moves
(isCtrlNP).  AXSelectedTextChanged with direction=next/previous +
granularity=line is sufficient for VoiceOver to read the new line.
FocusedUIElementChanged is only needed for discontiguous jumps
(]], M-<, isearch, xref etc.) where VoiceOver must re-anchor.

Also merge duplicate comment blocks and fix two compile errors
from a64d24c that Martin caught during testing.
This commit is contained in:
2026-03-02 20:48:57 +01:00
parent a64d24cbd9
commit 7a0b4f6cf2
9 changed files with 84 additions and 92 deletions

View File

@@ -1,4 +1,4 @@
From b33ad461f56034270d8461ad48e838f5f36a98da Mon Sep 17 00:00:00 2001
From 33ed790921c1d78dec79f803807deae65fff365e Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 6/8] doc: add VoiceOver accessibility section to macOS
@@ -110,10 +110,10 @@ index 6bd334f48e..8d4a7825d8 100644
@section GNUstep Support
diff --git a/src/nsterm.m b/src/nsterm.m
index 95a5b378c1..8a1bfd9eb1 100644
index 7c118045bd..a0598a73c2 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -14665,9 +14665,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -14709,9 +14709,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled,
doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support.