From 3df5dc94b1e29e9e6de10bd7a9ba773f57fe433d Mon Sep 17 00:00:00 2001 From: Daneel Date: Fri, 27 Feb 2026 11:48:42 +0100 Subject: [PATCH] =?UTF-8?q?patches:=20fix=20char=20nav=20=E2=80=94=20annou?= =?UTF-8?q?nce=20char=20AT=20point,=20not=20before=20it=20(evil=20block=20?= =?UTF-8?q?cursor)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oundsForRange-for-macOS-Zoom-cursor-.patch | 57 ++++++++++++++++--- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch index 993233a..0c543d9 100644 --- a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch +++ b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch @@ -1,13 +1,13 @@ -From 26208baf6a7d44d471d0c99bd99e288cd23472bc Mon Sep 17 00:00:00 2001 +From 36073f1ad322a2ca478189fca89bc2b220fce621 Mon Sep 17 00:00:00 2001 From: Martin Sukany -Date: Fri, 27 Feb 2026 11:36:03 +0100 +Date: Fri, 27 Feb 2026 11:48:36 +0100 Subject: [PATCH] ns: implement VoiceOver accessibility (AXBoundsForRange, line nav, completions, interactive spans) --- src/nsterm.h | 109 ++ - src/nsterm.m | 2674 +++++++++++++++++++++++++++++++++++++++++++++++--- - 2 files changed, 2634 insertions(+), 149 deletions(-) + src/nsterm.m | 2715 +++++++++++++++++++++++++++++++++++++++++++++++--- + 2 files changed, 2675 insertions(+), 149 deletions(-) diff --git a/src/nsterm.h b/src/nsterm.h index 7c1ee4c..6c95673 100644 @@ -144,7 +144,7 @@ index 7c1ee4c..6c95673 100644 diff --git a/src/nsterm.m b/src/nsterm.m -index 932d209..e81798a 100644 +index 932d209..7e53bb3 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch) @@ -205,7 +205,7 @@ index 932d209..e81798a 100644 ns_focus (f, NULL, 0); NSGraphicsContext *ctx = [NSGraphicsContext currentContext]; -@@ -6849,219 +6886,2235 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg +@@ -6849,219 +6886,2276 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg /* ========================================================================== @@ -1981,6 +1981,47 @@ index 932d209..e81798a 100644 + NSAccessibilitySelectedTextChangedNotification, + moveInfo); + ++ /* Character navigation: announce the character AT point. ++ VoiceOver's default for SelectedTextChanged with direction=next/char ++ reads the character BEFORE the new cursor position (the one "just ++ passed"). This is correct for insert-mode (cursor BETWEEN chars) ++ but wrong for block-cursor modes like evil-normal where the cursor ++ is visually ON the character at point. Post an explicit ++ announcement with the character at point to override this. */ ++ if ([self isAccessibilityFocused] ++ && cachedText ++ && granularity == ns_ax_text_selection_granularity_character ++ && (direction == ns_ax_text_selection_direction_next ++ || direction == ns_ax_text_selection_direction_previous)) ++ { ++ NSUInteger point_idx = [self accessibilityIndexForCharpos:point]; ++ NSUInteger tlen = [cachedText length]; ++ if (point_idx < tlen) ++ { ++ NSRange charRange = [cachedText ++ rangeOfComposedCharacterSequenceAtIndex: point_idx]; ++ if (charRange.location != NSNotFound && charRange.length > 0 ++ && charRange.location + charRange.length <= tlen) ++ { ++ NSString *ch = [cachedText substringWithRange: charRange]; ++ /* Skip bare newlines — VoiceOver already says "new line". */ ++ if (![ch isEqualToString: @" ++"]) ++ { ++ NSDictionary *annInfo = @{ ++ NSAccessibilityAnnouncementKey: ch, ++ NSAccessibilityPriorityKey: ++ @(NSAccessibilityPriorityHigh) ++ }; ++ NSAccessibilityPostNotificationWithUserInfo ( ++ NSApp, ++ NSAccessibilityAnnouncementRequestedNotification, ++ annInfo); ++ } ++ } ++ } ++ } ++ + /* Emit an explicit announcement whenever point lands on a new line. + Triggering on granularity=line covers ALL line-motion commands + in ALL modes (next-line, dired-next-line, next-completion, …) @@ -2590,7 +2631,7 @@ index 932d209..e81798a 100644 unsigned fnKeysym = 0; static NSMutableArray *nsEvArray; unsigned int flags = [theEvent modifierFlags]; -@@ -8237,6 +10290,28 @@ - (void)windowDidBecomeKey /* for direct calls */ +@@ -8237,6 +10331,28 @@ - (void)windowDidBecomeKey /* for direct calls */ XSETFRAME (event.frame_or_window, emacsframe); kbd_buffer_store_event (&event); ns_send_appdefined (-1); // Kick main loop @@ -2619,7 +2660,7 @@ index 932d209..e81798a 100644 } -@@ -9474,6 +11549,307 @@ - (int) fullscreenState +@@ -9474,6 +11590,307 @@ - (int) fullscreenState return fs_state; }