patches: fix completion span boundary (completion--string vs mouse-face)

This commit is contained in:
2026-02-27 10:42:31 +01:00
parent 23102444d4
commit 5f08e0a315
2 changed files with 1265 additions and 9 deletions

View File

@@ -1,13 +1,13 @@
From 9ecac3f53f402174cafbe07d7809826f9f698a23 Mon Sep 17 00:00:00 2001 From ee45648ef5ba61c7c9b5937741666b59b172a291 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Fri, 27 Feb 2026 10:30:58 +0100 Date: Fri, 27 Feb 2026 10:42:28 +0100
Subject: [PATCH] ns: implement VoiceOver accessibility (AXBoundsForRange, line Subject: [PATCH] ns: implement VoiceOver accessibility (AXBoundsForRange, line
nav, completions, interactive spans) nav, completions, interactive spans)
--- ---
src/nsterm.h | 109 +++ src/nsterm.h | 109 +++
src/nsterm.m | 2645 +++++++++++++++++++++++++++++++++++++++++++++++--- src/nsterm.m | 2651 +++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 2604 insertions(+), 150 deletions(-) 2 files changed, 2610 insertions(+), 150 deletions(-)
diff --git a/src/nsterm.h b/src/nsterm.h diff --git a/src/nsterm.h b/src/nsterm.h
index 7c1ee4c..6c95673 100644 index 7c1ee4c..6c95673 100644
@@ -144,7 +144,7 @@ index 7c1ee4c..6c95673 100644
diff --git a/src/nsterm.m b/src/nsterm.m diff --git a/src/nsterm.m b/src/nsterm.m
index 932d209..1166ad9 100644 index 932d209..3c3c14a 100644
--- a/src/nsterm.m --- a/src/nsterm.m
+++ b/src/nsterm.m +++ b/src/nsterm.m
@@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch) @@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch)
@@ -205,7 +205,7 @@ index 932d209..1166ad9 100644
ns_focus (f, NULL, 0); ns_focus (f, NULL, 0);
NSGraphicsContext *ctx = [NSGraphicsContext currentContext]; NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
@@ -6849,220 +6886,2205 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg @@ -6849,220 +6886,2211 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
/* ========================================================================== /* ==========================================================================
@@ -933,8 +933,14 @@ index 932d209..1166ad9 100644
+ else if (is_completion_buf + else if (is_completion_buf
+ && !NILP (Fplist_get (plist, Qmouse_face_sym, Qnil))) + && !NILP (Fplist_get (plist, Qmouse_face_sym, Qnil)))
+ { + {
+ /* For completions, use completion--string as boundary so we
+ don't accidentally merge two column-adjacent candidates
+ whose mouse-face regions may share padding whitespace.
+ Fall back to mouse-face if completion--string is absent. */
+ Lisp_Object cs_sym = intern ("completion--string");
+ Lisp_Object cs_val = ns_ax_text_prop_at (pos, cs_sym, buf_obj);
+ span_type = EmacsAXSpanTypeCompletionItem; + span_type = EmacsAXSpanTypeCompletionItem;
+ limit_prop = Qmouse_face_sym; + limit_prop = NILP (cs_val) ? Qmouse_face_sym : cs_sym;
+ } + }
+ else + else
+ { + {
@@ -2561,7 +2567,7 @@ index 932d209..1166ad9 100644
static NSMutableArray *nsEvArray; static NSMutableArray *nsEvArray;
unsigned int flags = [theEvent modifierFlags]; unsigned int flags = [theEvent modifierFlags];
@@ -8237,6 +10259,28 @@ - (void)windowDidBecomeKey /* for direct calls */ @@ -8237,6 +10265,28 @@ - (void)windowDidBecomeKey /* for direct calls */
XSETFRAME (event.frame_or_window, emacsframe); XSETFRAME (event.frame_or_window, emacsframe);
kbd_buffer_store_event (&event); kbd_buffer_store_event (&event);
ns_send_appdefined (-1); // Kick main loop ns_send_appdefined (-1); // Kick main loop
@@ -2590,7 +2596,7 @@ index 932d209..1166ad9 100644
} }
@@ -9474,6 +11518,307 @@ - (int) fullscreenState @@ -9474,6 +11524,307 @@ - (int) fullscreenState
return fs_state; return fs_state;
} }

File diff suppressed because it is too large Load Diff