Compare commits
17 Commits
f42e799991
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d4952ae9e9 | |||
| abc518a60a | |||
| ad868e0fab | |||
| 2ab4468ca0 | |||
|
|
61f629350c | ||
| f78da08e6b | |||
| d5b5d5301d | |||
| fe0a0181d3 | |||
| 6dd3c9bfe4 | |||
| 5f18d727e1 | |||
| 2b7c7abb48 | |||
| f51da9f8d4 | |||
| 9ad01c03fd | |||
| c418db05dc | |||
| ea9d231177 | |||
| a69aec96d8 | |||
| 97c14a3bd9 |
211
FIXES-APPLIED.md
Normal file
211
FIXES-APPLIED.md
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
# Fixes Applied to Patch Series
|
||||||
|
|
||||||
|
All fixes applied to `/tmp/emacs-doom-review/patches/` on 2026-03-04.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 1 — 0002: Revert em-dash → triple-dash in windowWillResize strings
|
||||||
|
|
||||||
|
**File:** `0002-ns-implement-buffer-accessibility-element.patch`
|
||||||
|
|
||||||
|
The `windowWillResize:` hunk incorrectly changed the window-resize title separator from
|
||||||
|
em-dash (U+2014, ` — `) to triple-dash (` --- `) in:
|
||||||
|
- `strstr (t, " — ")` — used to strip the size suffix when resizing begins
|
||||||
|
- `esprintf (size_title, "%s — (%d × %d)", …)` — used to format the title
|
||||||
|
|
||||||
|
Both `-` lines were converted to context (` ` prefix) and the corresponding `+` lines
|
||||||
|
were removed. The hunk header counts remained unchanged (13,13) since the net effect
|
||||||
|
on old/new line counts is zero.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 2 — 0007: Remove spurious ns_ax_face_is_selected from commit message
|
||||||
|
|
||||||
|
**File:** `0007-ns-announce-overlay-completions-to-VoiceOver.patch`
|
||||||
|
|
||||||
|
The ChangeLog entry for `ns_ax_face_is_selected` was removed from the commit message:
|
||||||
|
```
|
||||||
|
* src/nsterm.m (ns_ax_face_is_selected): New static function; matches
|
||||||
|
'current', 'selected', 'selection' in face symbol names.
|
||||||
|
```
|
||||||
|
This function does not exist in the diff — the actual function is
|
||||||
|
`ns_face_name_matches_selected_p` (introduced in patch 0000/0001).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 3 — All patches: Renumber series for proper separation
|
||||||
|
|
||||||
|
The patches were renumbered to reflect two independent series:
|
||||||
|
|
||||||
|
| File | Before | After | Series |
|
||||||
|
|--------|---------------|---------------|-------------------|
|
||||||
|
| 0000 | [PATCH 1/9] | [PATCH 1/1] | Zoom (standalone) |
|
||||||
|
| 0001 | [PATCH 2/9] | [PATCH 1/8] | VoiceOver |
|
||||||
|
| 0002 | [PATCH 3/9] | [PATCH 2/8] | VoiceOver |
|
||||||
|
| 0003 | [PATCH 4/9] | [PATCH 3/8] | VoiceOver |
|
||||||
|
| 0004 | [PATCH 5/9] | [PATCH 4/8] | VoiceOver |
|
||||||
|
| 0005 | [PATCH 6/9] | [PATCH 5/8] | VoiceOver |
|
||||||
|
| 0006 | [PATCH 7/9] | [PATCH 6/8] | VoiceOver |
|
||||||
|
| 0007 | [PATCH 8/9] | [PATCH 7/8] | VoiceOver |
|
||||||
|
| 0008 | [PATCH 9/9] | [PATCH 8/8] | VoiceOver |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 4 — 0008: Refactor goto to nested if
|
||||||
|
|
||||||
|
**File:** `0008-ns-announce-child-frame-completions-to-VoiceOver.patch`
|
||||||
|
|
||||||
|
**Note:** The task description incorrectly named file 0007; the goto is in 0008.
|
||||||
|
|
||||||
|
In `postAccessibilityNotificationsForFrame:`, the overlay completion scan used a
|
||||||
|
`goto skip_overlay_scan;` pattern. Refactored to a standard nested `if` block:
|
||||||
|
|
||||||
|
Before (in diff):
|
||||||
|
```c
|
||||||
|
if (!MINI_WINDOW_P (w) || didTextChange)
|
||||||
|
goto skip_overlay_scan;
|
||||||
|
|
||||||
|
int selected_line = -1;
|
||||||
|
NSString *candidate = ns_ax_selected_overlay_text (…);
|
||||||
|
if (candidate)
|
||||||
|
{ … }
|
||||||
|
|
||||||
|
skip_overlay_scan:
|
||||||
|
/* --- Cursor moved … */
|
||||||
|
```
|
||||||
|
|
||||||
|
After (in diff):
|
||||||
|
```c
|
||||||
|
if (MINI_WINDOW_P (w) && !didTextChange)
|
||||||
|
{
|
||||||
|
int selected_line = -1;
|
||||||
|
NSString *candidate = ns_ax_selected_overlay_text (…);
|
||||||
|
if (candidate)
|
||||||
|
{ … }
|
||||||
|
}
|
||||||
|
/* --- Cursor moved … */
|
||||||
|
```
|
||||||
|
|
||||||
|
The extended comment explaining the `didTextChange` guard was preserved. The inner
|
||||||
|
body code is restored to its original indentation level. Hunk header updated from
|
||||||
|
`+9609,49` to `+9609,48` (one fewer net added line).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 5 — 0006: Remove "Block-style cursors" from Known Limitations
|
||||||
|
|
||||||
|
**File:** `0006-doc-add-VoiceOver-section-to-macOS-appendix.patch`
|
||||||
|
|
||||||
|
Removed the `@item` bullet from the Known Limitations `@itemize`:
|
||||||
|
```texinfo
|
||||||
|
@item
|
||||||
|
Block-style cursors are handled correctly: character navigation
|
||||||
|
announces the character at the cursor position, not the character
|
||||||
|
before it.
|
||||||
|
```
|
||||||
|
This is a feature, not a limitation. The hunk header was updated from
|
||||||
|
`+273,82` to `+273,78` (4 fewer added lines).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 6 — 0001: Spell out "AT" in commit message
|
||||||
|
|
||||||
|
**File:** `0001-ns-add-accessibility-base-classes-and-helpers.patch`
|
||||||
|
|
||||||
|
In the ChangeLog entry for `syms_of_nsterm`:
|
||||||
|
|
||||||
|
Before: `set non-nil automatically when an AT is detected at startup.`
|
||||||
|
After: `set non-nil automatically when an assistive technology (AT) is detected at startup.`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 7 — 0005: Spell out "AT" in commit message
|
||||||
|
|
||||||
|
**File:** `0005-ns-wire-accessibility-into-EmacsView-and-redisplay.patch`
|
||||||
|
|
||||||
|
**Result: No-op.** The commit message of patch 0005 (lines before the `---` separator)
|
||||||
|
contains no "AT" abbreviation. The "AT" occurrences found by grep are in code comments
|
||||||
|
within the diff body (not the commit message proper). No changes were made.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 8 — 0006: Remove spurious @xref note from commit message
|
||||||
|
|
||||||
|
**File:** `0006-doc-add-VoiceOver-section-to-macOS-appendix.patch`
|
||||||
|
|
||||||
|
Removed the sentence "Use @xref for cross-reference at sentence start." from the
|
||||||
|
ChangeLog entry. This referenced an `@xref` that does not appear in the patch.
|
||||||
|
|
||||||
|
Before:
|
||||||
|
```
|
||||||
|
enabled, and known limitations. Use @xref for cross-reference at
|
||||||
|
sentence start. Correct description of ns-accessibility-enabled
|
||||||
|
```
|
||||||
|
After:
|
||||||
|
```
|
||||||
|
enabled, and known limitations. Correct description of ns-accessibility-enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 9 — 0001: Update stub comment reference
|
||||||
|
|
||||||
|
**File:** `0001-ns-add-accessibility-base-classes-and-helpers.patch`
|
||||||
|
|
||||||
|
In the stub `@implementation EmacsAccessibilityBuffer (InteractiveSpans)`:
|
||||||
|
|
||||||
|
Before: `/* Stub: full implementation added in patch 0004. */`
|
||||||
|
After: `/* Stub: full implementation in the following patch. */`
|
||||||
|
|
||||||
|
This avoids a hard-coded patch number that may shift if the series is reordered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 10 — 0000: Style nits
|
||||||
|
|
||||||
|
**File:** `0000-ns-integrate-with-macOS-Zoom-for-cursor-tracking.patch`
|
||||||
|
|
||||||
|
### a) Double blank line before `#ifdef NS_IMPL_COCOA`
|
||||||
|
|
||||||
|
In the large inserted block starting at `-1081,6 +1086,N`, an extra blank `+` line
|
||||||
|
preceded `+#ifdef NS_IMPL_COCOA`, creating a triple blank gap. The extra `+\n` line
|
||||||
|
was removed. Hunk header updated from `+1086,293` to `+1086,292`.
|
||||||
|
|
||||||
|
### b) Unnecessary block scope in `ns_draw_window_cursor`
|
||||||
|
|
||||||
|
The Zoom integration block used a gratuitous `{ … }` scope wrapper:
|
||||||
|
```c
|
||||||
|
{
|
||||||
|
EmacsView *view = FRAME_NS_VIEW (f);
|
||||||
|
if (view && on_p && active_p)
|
||||||
|
{ … }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Removed the outer braces and dedented the contents by one level:
|
||||||
|
```c
|
||||||
|
EmacsView *view = FRAME_NS_VIEW (f);
|
||||||
|
if (view && on_p && active_p)
|
||||||
|
{ … }
|
||||||
|
```
|
||||||
|
Hunk header updated from `+3559,45` to `+3559,43` (2 fewer added lines).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## FIX 11 — 0008: Remove spurious blank line in announceChildFrameCompletion
|
||||||
|
|
||||||
|
**File:** `0008-ns-announce-child-frame-completions-to-VoiceOver.patch`
|
||||||
|
|
||||||
|
Removed the blank line between the opening `{` and the first comment in the
|
||||||
|
`announceChildFrameCompletion` method body. Hunk header updated from
|
||||||
|
`+12991,156` to `+12991,155`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
All 9 patch files pass post-fix verification:
|
||||||
|
- All Subject: lines present with correct [PATCH N/M] numbering
|
||||||
|
- All @@ hunk headers syntactically valid
|
||||||
|
- No `goto skip_overlay_scan` or `skip_overlay_scan:` label remaining
|
||||||
|
- No triple-dash in functional window-resize strings
|
||||||
|
- No `ns_ax_face_is_selected` in 0007 commit message
|
||||||
395
REVIEW-FINAL.md
Normal file
395
REVIEW-FINAL.md
Normal file
@@ -0,0 +1,395 @@
|
|||||||
|
The review is written to `/tmp/emacs-doom-review/REVIEW-FINAL.md` (418 lines). Here's the summary of findings:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Review Summary
|
||||||
|
|
||||||
|
**Overall verdict: READY WITH MINOR FIXES**
|
||||||
|
|
||||||
|
The series has matured well through six rounds. Architecture is sound, threading model is correct, performance claims are supportable. Two items block upstream submission:
|
||||||
|
|
||||||
|
### Must fix
|
||||||
|
|
||||||
|
**Patch 0002** — Contains an unrelated functional change: the window-resize title string changes `strstr(t, " — ")` and `esprintf(..., "%s — ...")` from Unicode em-dash to triple-dash `---`. This is a behavioral change to non-accessibility code embedded in an accessibility patch. A maintainer will catch it immediately.
|
||||||
|
|
||||||
|
**Patch 0007** — The commit message claims to introduce `ns_ax_face_is_selected` as a new function, but no such function appears in the diff. The actual code calls `ns_face_name_matches_selected_p` from patch 0000. The ChangeLog entry must be corrected.
|
||||||
|
|
||||||
|
### Structural (must fix before submission)
|
||||||
|
|
||||||
|
**[PATCH 1/9] numbering** — All nine patches are numbered as one series, but the README says 0000 is independent of 0001–0008. For emacs-devel submission, either add a `[PATCH 0/9]` cover letter explaining the split, or submit 0000 separately as `[PATCH 1/1]`.
|
||||||
|
|
||||||
|
### Notable nits (fix recommended)
|
||||||
|
|
||||||
|
- `goto skip_overlay_scan` in patch 0007 — unusual in Emacs C; Stefan Monnier will likely ask for a nested `if` instead
|
||||||
|
- "Known Limitations" fifth bullet in patch 0006 ("Block-style cursors are handled correctly...") is a feature, not a limitation
|
||||||
|
- "AT" abbreviation in commit messages — spell out "assistive technology"
|
||||||
|
- Patch 0006 commit message references an `@xref` that isn't there
|
||||||
|
|
||||||
|
### What's clean (no action needed)
|
||||||
|
|
||||||
|
Patches 0003, 0004, 0005 are LGTM. The threading model (AX thread → dispatch_sync to main), the `@synchronized` cache guards, `block_input`/`unblock_input` specpdl protection, GNUstep exclusion, and performance claims all check out.
|
||||||
|
p` TTL caching with `CFAbsoluteTimeGetCurrent()` is
|
||||||
|
well motivated; the 1-second TTL justification is documented clearly.
|
||||||
|
- `ns_face_name_matches_selected_p` using `strstr` on face symbol names
|
||||||
|
is an accepted heuristic; the comment acknowledges it.
|
||||||
|
- specpdl unwind protection is correct throughout.
|
||||||
|
- `ns_zoom_find_child_frame_candidate`: inside the FOR_EACH_FRAME body,
|
||||||
|
`block_input()` is called before `SPECPDL_INDEX()`. In practice this
|
||||||
|
is safe (SPECPDL_INDEX cannot fail), but the canonical Emacs ordering
|
||||||
|
is SPECPDL_INDEX -> record_unwind -> block_input. Patch 0008 later
|
||||||
|
reverses this order in `ns_ax_buffer_text` with an explanatory comment;
|
||||||
|
0000 is left inconsistent. Nit only.
|
||||||
|
- Double blank line before `#ifdef NS_IMPL_COCOA` at the top of the new
|
||||||
|
block (~line 93 of the diff). GNU Emacs style uses a single blank
|
||||||
|
line between top-level definitions.
|
||||||
|
- Block scope `{ EmacsView *view = ...; }` in `ns_draw_window_cursor` is
|
||||||
|
unnecessary (no outer `view` in scope at that point); the extra braces
|
||||||
|
can be removed.
|
||||||
|
|
||||||
|
**Verdict: LGTM with nits** -- fix numbering before submission; the
|
||||||
|
code is otherwise clean.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0001: Add accessibility base classes and helpers [PATCH 2/9]
|
||||||
|
|
||||||
|
**Subject / commit message**
|
||||||
|
Correct format. The commit message abbreviates "AT" for "assistive
|
||||||
|
technology" -- spell it out for an emacs-devel audience.
|
||||||
|
|
||||||
|
**Code quality**
|
||||||
|
|
||||||
|
- GC safety analysis on `lispWindow` is thorough and correct.
|
||||||
|
- `@synchronized (self)` guards on visibleRuns/lineStartOffsets are
|
||||||
|
correct; they protect against concurrent reads from the AX server
|
||||||
|
thread while the main thread rebuilds the cache.
|
||||||
|
- `ns_ax_buffer_text` correctly uses `Fbuffer_substring_no_properties`
|
||||||
|
instead of raw `BUF_BYTE_ADDRESS` to handle the buffer gap. ✓
|
||||||
|
- `Fget_char_property (pos, Qinvisible, Qnil)` with Qnil meaning the
|
||||||
|
current buffer is correct after `set_buffer_internal_1(b)`. ✓
|
||||||
|
- `TEXT_PROP_MEANS_INVISIBLE` correctly mirrors xdisp.c logic. ✓
|
||||||
|
- The stub `@implementation EmacsAccessibilityBuffer (InteractiveSpans)`
|
||||||
|
has a comment reading "full implementation added in patch 0004". Once
|
||||||
|
the series numbering is resolved this should say "in the following
|
||||||
|
patch" or match the final [PATCH N/M] numbers.
|
||||||
|
|
||||||
|
**Verdict: LGTM with nits.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0002: Implement buffer accessibility element [PATCH 3/9]
|
||||||
|
|
||||||
|
**SERIOUS ISSUE -- unrelated functional change**
|
||||||
|
|
||||||
|
Deep in the diff, in the context of `windowWillResize:toSize:`, the patch
|
||||||
|
changes:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- char *pos = strstr (t, " \xe2\x80\x94 ");
|
||||||
|
+ char *pos = strstr (t, " --- ");
|
||||||
|
...
|
||||||
|
- esprintf (size_title, "%s \xe2\x80\x94 (%d x %d)", old_title, cols, rows);
|
||||||
|
+ esprintf (size_title, "%s --- (%d x %d)", old_title, cols, rows);
|
||||||
|
```
|
||||||
|
|
||||||
|
This replaces a Unicode em-dash (U+2014) with three ASCII hyphens in the
|
||||||
|
*functional* window-resize title string. This:
|
||||||
|
|
||||||
|
- Is unrelated to accessibility.
|
||||||
|
- Changes the visual appearance of the resize title bar.
|
||||||
|
- Must be in its own commit (with its own ChangeLog entry and
|
||||||
|
justification) or reverted. A maintainer will reject the patch if
|
||||||
|
they spot this.
|
||||||
|
|
||||||
|
All other content in this patch is correct:
|
||||||
|
|
||||||
|
- `@synchronized (self)` in `invalidateTextCache` correctly releases
|
||||||
|
Objective-C objects under the lock; `invalidateInteractiveSpans` is
|
||||||
|
called outside the lock to avoid mutex inversion. ✓
|
||||||
|
- Binary search in `accessibilityIndexForCharpos:` and
|
||||||
|
`charposForAccessibilityIndex:` is correct; the O(1) ASCII fast-path
|
||||||
|
is well-motivated and the comment explains why it matters. ✓
|
||||||
|
- `setAccessibilitySelectedTextRange:` correctly deactivates the mark
|
||||||
|
(with explanatory comment about VoiceOver word-boundary hints). ✓
|
||||||
|
- `dispatch_async` for setters (no return value needed) vs.
|
||||||
|
`dispatch_sync` for getters (return value required) is the correct
|
||||||
|
pattern throughout. ✓
|
||||||
|
- `accessibilityStyleRangeForIndex:` is the only getter without its own
|
||||||
|
main-thread check; it relies on two sub-calls that each dispatch
|
||||||
|
individually. Correct but two round-trips instead of one. Minor nit.
|
||||||
|
|
||||||
|
**Verdict: Needs work** -- remove the window title em-dash change.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0003: Add AX notifications and mode-line element [PATCH 4/9]
|
||||||
|
|
||||||
|
**Subject / commit message**
|
||||||
|
Correct. ChangeLog entries are detailed and accurate.
|
||||||
|
|
||||||
|
**Code quality**
|
||||||
|
|
||||||
|
- `postTextChangedNotification:` single-character fast path (grab the
|
||||||
|
inserted char for `AXTextChangeValue`) is a useful optimization.
|
||||||
|
- `postFocusedCursorNotification:direction:granularity:markActive:
|
||||||
|
oldMarkActive:` granularity reasoning -- omit for char moves to prevent
|
||||||
|
block-cursor double-speech -- matches documented WebKit behaviour. ✓
|
||||||
|
- `postCompletionAnnouncementForBuffer:point:` four-level fallback chain
|
||||||
|
(completion--string -> mouse-face -> completions-highlight overlay ->
|
||||||
|
line text) is comprehensive.
|
||||||
|
- `[ws mutableCopy]` / `[trims release]` in the word-announcement path
|
||||||
|
is correct MRC. ✓
|
||||||
|
- `EmacsAccessibilityModeLine` returns `NSAccessibilityStaticTextRole`;
|
||||||
|
`accessibilityValue` delegates to `ns_ax_mode_line_text`. Correct.
|
||||||
|
|
||||||
|
**Verdict: LGTM.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0004: Add interactive span elements for Tab [PATCH 5/9]
|
||||||
|
|
||||||
|
**Subject / commit message**
|
||||||
|
Correct.
|
||||||
|
|
||||||
|
**Code quality**
|
||||||
|
|
||||||
|
- `ns_ax_scan_interactive_spans` priority ordering (widget > button >
|
||||||
|
follow-link > org-link > completion > keymap-overlay) is a reasonable
|
||||||
|
policy; documented in the function comment.
|
||||||
|
- Skip-to-next-change logic uses the minimum of per-property change
|
||||||
|
points: O(properties * log(buffer)) rather than O(chars). ✓
|
||||||
|
- `EmacsAccessibilityInteractiveSpan.isAccessibilityFocused` reads
|
||||||
|
`pb.cachedPoint` (a plain `ptrdiff_t`) without `@synchronized`. This
|
||||||
|
is safe because `cachedPoint` is only written on the main thread and
|
||||||
|
the ivar is machine-word aligned (naturally atomic on ARM64/x86-64).
|
||||||
|
Acceptable; a brief comment noting this would be welcome.
|
||||||
|
- `setAccessibilityFocused:` correctly uses `dispatch_async` with the
|
||||||
|
Lisp_Object-captured-by-value comment. ✓
|
||||||
|
- Removes the stub `@implementation` from patch 0001 cleanly. ✓
|
||||||
|
|
||||||
|
**Verdict: LGTM.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0005: Wire accessibility into EmacsView and redisplay [PATCH 6/9]
|
||||||
|
|
||||||
|
**Subject / commit message**
|
||||||
|
Correct.
|
||||||
|
|
||||||
|
**Code quality**
|
||||||
|
|
||||||
|
- Re-entrance guard (`accessibilityUpdating`) is placed correctly at the
|
||||||
|
start of `postAccessibilityUpdates`. ✓
|
||||||
|
- `ns_update_accessibility_state` uses `AXIsProcessTrustedWithOptions`
|
||||||
|
with `kAXTrustedCheckOptionPrompt: @NO` -- does not prompt the user. ✓
|
||||||
|
- `(__bridge id)` and `(__bridge CFDictionaryRef)` casts in MRC context
|
||||||
|
are correct for toll-free bridging (no ownership transfer). ✓
|
||||||
|
- `com.apple.accessibility.api` distributed notification is the standard
|
||||||
|
(if undocumented) mechanism used by WebKit et al. ✓
|
||||||
|
- Window-switch detection via `lastSelectedWindow` comparison is clean.
|
||||||
|
- `accessibilityBoundsForRange:` / `accessibilityFrameForRange:` / the
|
||||||
|
legacy `accessibilityAttributeValue:forParameter:` delegation chain is
|
||||||
|
complete and handles both modern and pre-10.10 AX API callers. ✓
|
||||||
|
- `postAccessibilityUpdates` calls `rebuildAccessibilityTree` before the
|
||||||
|
per-element notification loop when the tree is stale, with a clear
|
||||||
|
comment explaining why (cannot diff state after fresh elements are
|
||||||
|
created). ✓
|
||||||
|
|
||||||
|
**Verdict: LGTM.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0006: doc: Add VoiceOver section to macOS appendix [PATCH 7/9]
|
||||||
|
|
||||||
|
**Texinfo structure**
|
||||||
|
|
||||||
|
- `@node VoiceOver Accessibility` inserted between `Mac / GNUstep Events`
|
||||||
|
and `GNUstep Support`. Menu entry correctly added. ✓
|
||||||
|
- `@cindex`, `@vindex`, `@itemize @bullet`, `@subheading` all used
|
||||||
|
correctly. ✓
|
||||||
|
- `@section` title "VoiceOver Accessibility (macOS)" is appropriate for
|
||||||
|
the macOS appendix.
|
||||||
|
|
||||||
|
**Content issue**
|
||||||
|
|
||||||
|
In the "Known Limitations" `@itemize`, the fifth bullet reads:
|
||||||
|
|
||||||
|
Block-style cursors are handled correctly: character navigation
|
||||||
|
announces the character at the cursor position, not the character
|
||||||
|
before it.
|
||||||
|
|
||||||
|
This is not a limitation -- it is a correctness feature. It does not
|
||||||
|
belong in a "Known Limitations" section. Remove this bullet or move it
|
||||||
|
to the main feature description above.
|
||||||
|
|
||||||
|
**Commit message note**
|
||||||
|
|
||||||
|
The commit message says "Use @xref for cross-reference at sentence start"
|
||||||
|
but no `@xref` appears in the added Texinfo. The note is stale from a
|
||||||
|
previous revision; remove it or add the intended @xref.
|
||||||
|
|
||||||
|
**Verdict: LGTM with nits** -- fix the Known Limitations bullet; clean up
|
||||||
|
the @xref note in the commit message.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0007: Announce overlay completions to VoiceOver [PATCH 8/9]
|
||||||
|
|
||||||
|
**SERIOUS ISSUE -- commit message describes non-existent function**
|
||||||
|
|
||||||
|
The commit message states:
|
||||||
|
|
||||||
|
* src/nsterm.m (ns_ax_face_is_selected): New static function; matches
|
||||||
|
'current', 'selected', 'selection' in face symbol names.
|
||||||
|
|
||||||
|
No function named `ns_ax_face_is_selected` appears anywhere in this
|
||||||
|
patch. The actual code calls `ns_face_name_matches_selected_p`, which
|
||||||
|
was introduced in patch 0000. The commit message must be corrected to
|
||||||
|
remove this spurious ChangeLog entry. A maintainer applying the patch
|
||||||
|
would immediately notice the claimed function does not appear in the diff.
|
||||||
|
|
||||||
|
**Code quality**
|
||||||
|
|
||||||
|
- `ns_ax_selected_overlay_text` uses `SDATA` for the newline scan and
|
||||||
|
correctly notes the data pointer is used only before Lisp calls that
|
||||||
|
could trigger GC. ✓
|
||||||
|
- Stack-allocated `line_starts[512]` / `line_ends[512]` is safe given
|
||||||
|
the vertico-count upper bound and the 512-line cap. ✓
|
||||||
|
- `BUF_CHARS_MODIFF` (not `BUF_MODIFF`) now gates `ValueChanged`; the
|
||||||
|
reason (text-property-only changes from font-lock / Vertico prompt
|
||||||
|
bump BUF_MODIFF but not BUF_CHARS_MODIFF) is well-explained. ✓
|
||||||
|
- Separate `if` for `BUF_OVERLAY_MODIFF` (not `else if`) correctly
|
||||||
|
handles frameworks that bump both counters in one command cycle. ✓
|
||||||
|
- Removing `ensureTextCache` from the cursor-moved branch prevents the
|
||||||
|
O(visible-buffer-text) rebuild cost on every keystroke. ✓
|
||||||
|
- `goto skip_overlay_scan` is unusual in Emacs C code. GNU Emacs does
|
||||||
|
use goto for error exits, but using it to skip over a block is more
|
||||||
|
readable as a nested `if (!MINI_WINDOW_P (w) && !didTextChange)`.
|
||||||
|
Stefan Monnier is likely to request a refactor here.
|
||||||
|
- `block_input` / `record_unwind_protect_void` ordering in
|
||||||
|
`ns_ax_buffer_text` is corrected and documented. ✓
|
||||||
|
- Em-dash to `---` conversions in *comments* are cosmetic cleanup;
|
||||||
|
acceptable (unlike the functional string changes in patch 0002).
|
||||||
|
|
||||||
|
**Verdict: Needs work** -- fix the commit message; consider refactoring
|
||||||
|
the goto.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 0008: Announce child frame completions to VoiceOver [PATCH 9/9]
|
||||||
|
|
||||||
|
**Subject / commit message**
|
||||||
|
Correct and detailed. ChangeLog entries accurately describe all changes.
|
||||||
|
|
||||||
|
**Code quality**
|
||||||
|
|
||||||
|
- `voiceoverSetPoint` flag design (set in `setAccessibilitySelectedText
|
||||||
|
Range:`, consumed and reset in the next notification cycle) is correct
|
||||||
|
and clean. ✓
|
||||||
|
- `singleLineMove` adjacency detection (NSRange boundary comparison) is
|
||||||
|
package-agnostic; no evil/doom/spacemacs-specific code. ✓
|
||||||
|
- `childFrameLastBuffer` stored as `BVAR(b, name)` (an interned symbol,
|
||||||
|
always reachable from obarray) rather than a raw buffer pointer is the
|
||||||
|
correct GC-safe approach. The comment explaining this is clear. ✓
|
||||||
|
- `childFrameLastCandidate` as a `char *` with `xstrdup`/`xfree` is
|
||||||
|
correct C memory management; freed in `dealloc`. ✓
|
||||||
|
- `postEchoAreaAnnouncementIfNeeded` reads `echo_area_buffer[0]` directly
|
||||||
|
with a comment explaining why `with_echo_area_buffer` is not used.
|
||||||
|
The `minibuf_level == 0` guard is correct. ✓
|
||||||
|
- Re-entrance guard comment correctly notes `announceChildFrameCompletion`
|
||||||
|
makes Lisp calls that can trigger redisplay; the guard is placed before
|
||||||
|
the call. ✓
|
||||||
|
- `childFrameCompletionActive` + child-frame-still-visible check for
|
||||||
|
restoring VoiceOver focus after popup close is clean. ✓
|
||||||
|
- `postFocusedCursorNotification:` updated to omit direction/granularity
|
||||||
|
for discontiguous jumps (let VoiceOver determine what to read) matches
|
||||||
|
the new reasoning about org-agenda blank-line gaps. ✓
|
||||||
|
- NEWS entry upgraded from `---` to `+++` now that documentation exists
|
||||||
|
(added in patch 0006). ✓
|
||||||
|
- Minor: `announceChildFrameCompletion` has a spurious blank line between
|
||||||
|
the opening `{` and the first comment. Cosmetic only.
|
||||||
|
|
||||||
|
**Verdict: LGTM with nits.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cross-Cutting Issues
|
||||||
|
|
||||||
|
### 1. Patch numbering inconsistency (structural -- must fix)
|
||||||
|
|
||||||
|
All nine patch files carry [PATCH 1/9]-[PATCH 9/9], implying a single
|
||||||
|
series. The README documents 0000 and 0001-0008 as *independent*. For
|
||||||
|
upstream submission via git-send-email, either:
|
||||||
|
|
||||||
|
- Treat all nine as one series with a [PATCH 0/9] cover letter; or
|
||||||
|
- Separate 0000 into its own submission ([PATCH 1/1]) and renumber the
|
||||||
|
VoiceOver series [PATCH 1/8]-[PATCH 8/8].
|
||||||
|
|
||||||
|
### 2. Em-dash conversion in functional code (serious -- must fix in 0002)
|
||||||
|
|
||||||
|
Em-dash to triple-dash conversions in *comments* (patches 0007, 0008)
|
||||||
|
are acceptable style cleanup. The same conversion in *functional string
|
||||||
|
literals* in patch 0002 (`strstr` / `esprintf` window title code) is a
|
||||||
|
behavioral change that does not belong in an accessibility patch.
|
||||||
|
|
||||||
|
### 3. block_input ordering inconsistency (nit)
|
||||||
|
|
||||||
|
Patches 0001-0006 use `SPECPDL_INDEX -> record_unwind -> block_input`.
|
||||||
|
Patch 0008 (and a targeted fix in 0007) adopt `block_input -> record_unwind`
|
||||||
|
and document why. Both orderings are safe in practice, but the series
|
||||||
|
leaves them inconsistent across the added functions.
|
||||||
|
|
||||||
|
### 4. "AT" abbreviation in commit messages (nit)
|
||||||
|
|
||||||
|
Patches 0001 and 0005 use "AT" for "assistive technology" in commit
|
||||||
|
messages without expanding it. Spell it out on first use.
|
||||||
|
|
||||||
|
### 5. Stub comment reference to "patch 0004" (nit)
|
||||||
|
|
||||||
|
The stub `@implementation EmacsAccessibilityBuffer (InteractiveSpans)` in
|
||||||
|
patch 0001 says "full implementation added in patch 0004". Once the
|
||||||
|
series numbering is finalised, update this to match the actual [PATCH N]
|
||||||
|
number, or change it to "the following patch."
|
||||||
|
|
||||||
|
### 6. Threading model assessment
|
||||||
|
|
||||||
|
The dispatch_sync-to-main pattern for all AX getter methods is correct
|
||||||
|
and matches WebKit's approach. The dispatch_async-for-setters pattern
|
||||||
|
is correct (no return value needed). The @synchronized blocks on the
|
||||||
|
shared cache are correctly scoped. The re-entrance guard in
|
||||||
|
`postAccessibilityUpdates` is correctly placed. No threading issues
|
||||||
|
found.
|
||||||
|
|
||||||
|
### 7. GNUstep exclusion
|
||||||
|
|
||||||
|
All new code is within `#ifdef NS_IMPL_COCOA` guards. GNUstep is
|
||||||
|
correctly excluded. ✓
|
||||||
|
|
||||||
|
### 8. Performance claims
|
||||||
|
|
||||||
|
- O(log n) index lookups via binary search on visible runs: correct. ✓
|
||||||
|
- O(log L) line queries via precomputed lineStartOffsets: correct. ✓
|
||||||
|
- BUF_MODIFF gating (not BUF_CHARS_MODIFF) for cache validity: correct
|
||||||
|
and thoroughly justified. ✓
|
||||||
|
- Zero overhead when `ns_accessibility_enabled` is nil: verified by
|
||||||
|
TESTING.txt item 14. ✓
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Verdict
|
||||||
|
|
||||||
|
| Patch | Files | Status |
|
||||||
|
|-------|-------|--------|
|
||||||
|
| 0000 | nsterm.h, nsterm.m, NEWS | **LGTM with nits** -- fix numbering; minor style nits |
|
||||||
|
| 0001 | nsterm.h, nsterm.m | **LGTM with nits** -- spell out "AT"; update stub comment |
|
||||||
|
| 0002 | nsterm.m | **Needs work** -- remove em-dash/triple-dash change from window-resize string |
|
||||||
|
| 0003 | nsterm.m | **LGTM** |
|
||||||
|
| 0004 | nsterm.m | **LGTM** |
|
||||||
|
| 0005 | nsterm.m, NEWS | **LGTM** |
|
||||||
|
| 0006 | macos.texi, nsterm.m | **LGTM with nits** -- fix Known Limitations bullet; clarify @xref note |
|
||||||
|
| 0007 | nsterm.h, nsterm.m | **Needs work** -- fix commit message (remove spurious ns_ax_face_is_selected entry); consider refactoring goto |
|
||||||
|
| 0008 | nsterm.h, nsterm.m, macos.texi, NEWS | **LGTM with nits** -- remove spurious blank line in method body |
|
||||||
|
|
||||||
|
**Bottom line**: Two patches need targeted fixes before submission (0002:
|
||||||
|
remove unrelated string change; 0007: correct commit message). After
|
||||||
|
those fixes, the series is ready for emacs-devel.
|
||||||
23
config.el
23
config.el
@@ -423,29 +423,6 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular."
|
|||||||
;;; ORG MODE — CUSTOM BEHAVIOR
|
;;; ORG MODE — CUSTOM BEHAVIOR
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
;; Agenda: position cursor at task name (after TODO keyword and priority)
|
|
||||||
(defun my/org-agenda-all-keywords ()
|
|
||||||
"Return list of all org todo keyword strings (without shortcut suffixes)."
|
|
||||||
(let (result)
|
|
||||||
(dolist (seq org-todo-keywords result)
|
|
||||||
(dolist (kw (cdr seq))
|
|
||||||
(unless (equal kw "|")
|
|
||||||
(push (replace-regexp-in-string "(.*" "" kw) result))))))
|
|
||||||
|
|
||||||
(defun my/org-agenda-goto-task-name (&rest _)
|
|
||||||
"Move cursor to the task name on the current org-agenda line."
|
|
||||||
(when (get-text-property (line-beginning-position) 'org-hd-marker)
|
|
||||||
(beginning-of-line)
|
|
||||||
(let* ((eol (line-end-position))
|
|
||||||
(kw-re (regexp-opt (my/org-agenda-all-keywords) 'words)))
|
|
||||||
(when (re-search-forward kw-re eol t)
|
|
||||||
(skip-chars-forward " \t")
|
|
||||||
(when (looking-at "\\[#.\\][ \t]+")
|
|
||||||
(goto-char (match-end 0)))))))
|
|
||||||
|
|
||||||
(advice-add 'org-agenda-next-line :after #'my/org-agenda-goto-task-name)
|
|
||||||
(advice-add 'org-agenda-previous-line :after #'my/org-agenda-goto-task-name)
|
|
||||||
|
|
||||||
;; Also trigger on post-command-hook in agenda buffers (catches Evil j/k,
|
;; Also trigger on post-command-hook in agenda buffers (catches Evil j/k,
|
||||||
;; super-agenda navigation, and any other motion commands)
|
;; super-agenda navigation, and any other motion commands)
|
||||||
(add-hook 'org-agenda-mode-hook
|
(add-hook 'org-agenda-mode-hook
|
||||||
|
|||||||
2127
flycheck_config.el
Normal file
2127
flycheck_config.el
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
From fcc1826baee5b424d5fdc176239c5675aee6159b Mon Sep 17 00:00:00 2001
|
From 2bce9ba4ad500eabad619e684ba319b58f9b1fca Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Sat, 28 Feb 2026 22:39:35 +0100
|
Date: Wed, 4 Mar 2026 15:23:53 +0100
|
||||||
Subject: [PATCH 1/9] ns: integrate with macOS Zoom for cursor tracking
|
Subject: [PATCH 1/1] ns: integrate with macOS Zoom for cursor tracking
|
||||||
|
|
||||||
Inform macOS Zoom of the text cursor position so the zoomed viewport
|
Inform macOS Zoom of the text cursor position so the zoomed viewport
|
||||||
follows keyboard focus in Emacs. Also track completion candidates so
|
follows keyboard focus in Emacs. Also track completion candidates so
|
||||||
@@ -28,8 +28,8 @@ to the selected completion candidate after normal cursor tracking.
|
|||||||
---
|
---
|
||||||
etc/NEWS | 11 ++
|
etc/NEWS | 11 ++
|
||||||
src/nsterm.h | 6 +
|
src/nsterm.h | 6 +
|
||||||
src/nsterm.m | 354 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
src/nsterm.m | 366 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
3 files changed, 371 insertions(+)
|
3 files changed, 383 insertions(+)
|
||||||
|
|
||||||
diff --git a/etc/NEWS b/etc/NEWS
|
diff --git a/etc/NEWS b/etc/NEWS
|
||||||
index 7367e3ccbd..4c149e41d6 100644
|
index 7367e3ccbd..4c149e41d6 100644
|
||||||
@@ -71,7 +71,7 @@ index 7c1ee4cf53..ea6e7ba4f5 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index 932d209f56..88c9251c18 100644
|
index 932d209f56..6333a7253a 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -71,6 +71,11 @@ Updated by Christian Limpach (chris@nice.ch)
|
@@ -71,6 +71,11 @@ Updated by Christian Limpach (chris@nice.ch)
|
||||||
@@ -86,11 +86,10 @@ index 932d209f56..88c9251c18 100644
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static EmacsMenu *dockMenu;
|
static EmacsMenu *dockMenu;
|
||||||
@@ -1081,6 +1086,281 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
@@ -1081,6 +1086,292 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+
|
|
||||||
+#ifdef NS_IMPL_COCOA
|
+#ifdef NS_IMPL_COCOA
|
||||||
+#if defined (MAC_OS_X_VERSION_MIN_REQUIRED) \
|
+#if defined (MAC_OS_X_VERSION_MIN_REQUIRED) \
|
||||||
+ && MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
|
+ && MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
|
||||||
@@ -127,10 +126,9 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+/* Identify faces that mark a selected completion candidate.
|
+/* Identify faces that mark a selected completion candidate.
|
||||||
+ Matches vertico-current, corfu-current, icomplete-selected-match,
|
+ Matches vertico-current, corfu-current, icomplete-selected-match,
|
||||||
+ ivy-current-match, etc. by checking the face symbol name.
|
+ ivy-current-match, etc. by checking the face symbol name.
|
||||||
+ Defined here so the Zoom patch compiles independently of the
|
+ Shared by both Zoom cursor tracking and VoiceOver accessibility. */
|
||||||
+ VoiceOver patches. */
|
|
||||||
+static bool
|
+static bool
|
||||||
+ns_zoom_face_is_selected (Lisp_Object face)
|
+ns_face_name_matches_selected_p (Lisp_Object face)
|
||||||
+{
|
+{
|
||||||
+ if (SYMBOLP (face))
|
+ if (SYMBOLP (face))
|
||||||
+ {
|
+ {
|
||||||
@@ -143,7 +141,7 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ {
|
+ {
|
||||||
+ Lisp_Object tail;
|
+ Lisp_Object tail;
|
||||||
+ for (tail = face; CONSP (tail); tail = XCDR (tail))
|
+ for (tail = face; CONSP (tail); tail = XCDR (tail))
|
||||||
+ if (ns_zoom_face_is_selected (XCAR (tail)))
|
+ if (ns_face_name_matches_selected_p (XCAR (tail)))
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ return false;
|
+ return false;
|
||||||
@@ -163,6 +161,13 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ if (!MINI_WINDOW_P (w))
|
+ if (!MINI_WINDOW_P (w))
|
||||||
+ return -1;
|
+ return -1;
|
||||||
+
|
+
|
||||||
|
+ /* block_input must come before record_unwind_protect_void (unblock_input)
|
||||||
|
+ so that the unwind handler is never invoked without a matching
|
||||||
|
+ block_input, even if Foverlays_in or Foverlay_get signals. */
|
||||||
|
+ specpdl_ref count = SPECPDL_INDEX ();
|
||||||
|
+ block_input ();
|
||||||
|
+ record_unwind_protect_void (unblock_input);
|
||||||
|
+
|
||||||
+ struct buffer *b = XBUFFER (w->contents);
|
+ struct buffer *b = XBUFFER (w->contents);
|
||||||
+ ptrdiff_t beg = marker_position (w->start);
|
+ ptrdiff_t beg = marker_position (w->start);
|
||||||
+ ptrdiff_t end = BUF_ZV (b);
|
+ ptrdiff_t end = BUF_ZV (b);
|
||||||
@@ -195,8 +200,11 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ Lisp_Object face
|
+ Lisp_Object face
|
||||||
+ = Fget_text_property (make_fixnum (line_start),
|
+ = Fget_text_property (make_fixnum (line_start),
|
||||||
+ Qface, str);
|
+ Qface, str);
|
||||||
+ if (ns_zoom_face_is_selected (face))
|
+ if (ns_face_name_matches_selected_p (face))
|
||||||
|
+ {
|
||||||
|
+ unbind_to (count, Qnil);
|
||||||
+ return line;
|
+ return line;
|
||||||
|
+ }
|
||||||
+ line++;
|
+ line++;
|
||||||
+ line_start = i + 1;
|
+ line_start = i + 1;
|
||||||
+ }
|
+ }
|
||||||
@@ -207,6 +215,7 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+ unbind_to (count, Qnil);
|
||||||
+ return -1;
|
+ return -1;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
@@ -242,7 +251,9 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ ptrdiff_t zv = BUF_ZV (b);
|
+ ptrdiff_t zv = BUF_ZV (b);
|
||||||
+ int line = 0;
|
+ int line = 0;
|
||||||
+
|
+
|
||||||
|
+ block_input ();
|
||||||
+ specpdl_ref count = SPECPDL_INDEX ();
|
+ specpdl_ref count = SPECPDL_INDEX ();
|
||||||
|
+ record_unwind_protect_void (unblock_input);
|
||||||
+ record_unwind_current_buffer ();
|
+ record_unwind_current_buffer ();
|
||||||
+ set_buffer_internal_1 (b);
|
+ set_buffer_internal_1 (b);
|
||||||
+
|
+
|
||||||
@@ -252,7 +263,7 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ Lisp_Object face
|
+ Lisp_Object face
|
||||||
+ = Fget_char_property (make_fixnum (pos), Qface,
|
+ = Fget_char_property (make_fixnum (pos), Qface,
|
||||||
+ cw->contents);
|
+ cw->contents);
|
||||||
+ if (ns_zoom_face_is_selected (face))
|
+ if (ns_face_name_matches_selected_p (face))
|
||||||
+ {
|
+ {
|
||||||
+ unbind_to (count, Qnil);
|
+ unbind_to (count, Qnil);
|
||||||
+ *child_frame = cf;
|
+ *child_frame = cf;
|
||||||
@@ -368,7 +379,7 @@ index 932d209f56..88c9251c18 100644
|
|||||||
static void
|
static void
|
||||||
ns_update_end (struct frame *f)
|
ns_update_end (struct frame *f)
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
@@ -1104,6 +1384,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
@@ -1104,6 +1396,41 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
||||||
|
|
||||||
unblock_input ();
|
unblock_input ();
|
||||||
ns_updating_frame = NULL;
|
ns_updating_frame = NULL;
|
||||||
@@ -410,7 +421,7 @@ index 932d209f56..88c9251c18 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3232,6 +3547,45 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
@@ -3232,6 +3559,43 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
||||||
/* Prevent the cursor from being drawn outside the text area. */
|
/* Prevent the cursor from being drawn outside the text area. */
|
||||||
r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA));
|
r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA));
|
||||||
|
|
||||||
@@ -424,7 +435,6 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ -> NSWindow (convertRect:toView:nil)
|
+ -> NSWindow (convertRect:toView:nil)
|
||||||
+ -> NSScreen (convertRectToScreen:)
|
+ -> NSScreen (convertRectToScreen:)
|
||||||
+ -> CGRect with y-flip for CoreGraphics top-left origin. */
|
+ -> CGRect with y-flip for CoreGraphics top-left origin. */
|
||||||
+ {
|
|
||||||
+ EmacsView *view = FRAME_NS_VIEW (f);
|
+ EmacsView *view = FRAME_NS_VIEW (f);
|
||||||
+ if (view && on_p && active_p)
|
+ if (view && on_p && active_p)
|
||||||
+ {
|
+ {
|
||||||
@@ -450,7 +460,6 @@ index 932d209f56..88c9251c18 100644
|
|||||||
+ }
|
+ }
|
||||||
+#endif
|
+#endif
|
||||||
+ }
|
+ }
|
||||||
+ }
|
|
||||||
+#endif /* NS_IMPL_COCOA */
|
+#endif /* NS_IMPL_COCOA */
|
||||||
+
|
+
|
||||||
ns_focus (f, NULL, 0);
|
ns_focus (f, NULL, 0);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From 488b91178be9a2dfd022533fce6b4adcd5c2ead0 Mon Sep 17 00:00:00 2001
|
From 573beced02b3f9b70ba82694d8e4790cfeee9563 Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
Date: Wed, 4 Mar 2026 15:23:53 +0100
|
||||||
Subject: [PATCH 2/9] ns: add accessibility base classes and text extraction
|
Subject: [PATCH 1/8] ns: add accessibility base classes and helpers
|
||||||
|
|
||||||
Add the foundation for macOS VoiceOver accessibility in the NS (Cocoa)
|
Add the foundation for macOS VoiceOver accessibility in the NS (Cocoa)
|
||||||
port. No existing code paths are modified.
|
port. No existing code paths are modified.
|
||||||
@@ -26,14 +26,14 @@ rect via glyph matrix.
|
|||||||
(EmacsAccessibilityElement): Implement base class.
|
(EmacsAccessibilityElement): Implement base class.
|
||||||
(syms_of_nsterm): Register accessibility DEFSYMs. Add DEFVAR_BOOL
|
(syms_of_nsterm): Register accessibility DEFSYMs. Add DEFVAR_BOOL
|
||||||
ns-accessibility-enabled with corrected doc: initial value is nil,
|
ns-accessibility-enabled with corrected doc: initial value is nil,
|
||||||
set non-nil automatically when an AT is detected at startup.
|
set non-nil automatically when an assistive technology (AT) is detected at startup.
|
||||||
---
|
---
|
||||||
src/nsterm.h | 131 +++++++++++++++
|
src/nsterm.h | 131 +++++++++++++++
|
||||||
src/nsterm.m | 454 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
src/nsterm.m | 466 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
2 files changed, 585 insertions(+)
|
2 files changed, 597 insertions(+)
|
||||||
|
|
||||||
diff --git a/src/nsterm.h b/src/nsterm.h
|
diff --git a/src/nsterm.h b/src/nsterm.h
|
||||||
index ea6e7ba4f5..f245675513 100644
|
index ea6e7ba4f5..d9ae6efc2e 100644
|
||||||
--- a/src/nsterm.h
|
--- a/src/nsterm.h
|
||||||
+++ b/src/nsterm.h
|
+++ b/src/nsterm.h
|
||||||
@@ -453,6 +453,124 @@ enum ns_return_frame_mode
|
@@ -453,6 +453,124 @@ enum ns_return_frame_mode
|
||||||
@@ -52,11 +52,11 @@ index ea6e7ba4f5..f245675513 100644
|
|||||||
+/* Base class for virtual accessibility elements attached to EmacsView. */
|
+/* Base class for virtual accessibility elements attached to EmacsView. */
|
||||||
+@interface EmacsAccessibilityElement : NSAccessibilityElement
|
+@interface EmacsAccessibilityElement : NSAccessibilityElement
|
||||||
+@property (nonatomic, unsafe_unretained) EmacsView *emacsView;
|
+@property (nonatomic, unsafe_unretained) EmacsView *emacsView;
|
||||||
+/* Lisp window object — safe across GC cycles.
|
+/* Lisp window object --- safe across GC cycles.
|
||||||
+ GC safety: these Lisp_Objects are NOT visible to GC via staticpro
|
+ GC safety: these Lisp_Objects are NOT visible to GC via staticpro
|
||||||
+ or the specpdl stack. This is safe because:
|
+ or the specpdl stack. This is safe because:
|
||||||
+ (1) Emacs GC runs only on the main thread, at well-defined safe
|
+ (1) Emacs GC runs only on the main thread, at well-defined safe
|
||||||
+ points during Lisp evaluation — never during redisplay.
|
+ points during Lisp evaluation --- never during redisplay.
|
||||||
+ (2) Accessibility elements are owned by EmacsView which belongs to
|
+ (2) Accessibility elements are owned by EmacsView which belongs to
|
||||||
+ an active frame; windows referenced here are always reachable
|
+ an active frame; windows referenced here are always reachable
|
||||||
+ from the frame's window tree until rebuildAccessibilityTree
|
+ from the frame's window tree until rebuildAccessibilityTree
|
||||||
@@ -81,7 +81,7 @@ index ea6e7ba4f5..f245675513 100644
|
|||||||
+ NSUInteger ax_length; /* Length in accessibility string (UTF-16 units). */
|
+ NSUInteger ax_length; /* Length in accessibility string (UTF-16 units). */
|
||||||
+} ns_ax_visible_run;
|
+} ns_ax_visible_run;
|
||||||
+
|
+
|
||||||
+/* Virtual AXTextArea element — one per visible Emacs window (buffer). */
|
+/* Virtual AXTextArea element --- one per visible Emacs window (buffer). */
|
||||||
+@interface EmacsAccessibilityBuffer
|
+@interface EmacsAccessibilityBuffer
|
||||||
+ : EmacsAccessibilityElement <NSAccessibility>
|
+ : EmacsAccessibilityElement <NSAccessibility>
|
||||||
+{
|
+{
|
||||||
@@ -119,7 +119,7 @@ index ea6e7ba4f5..f245675513 100644
|
|||||||
+- (void)invalidateInteractiveSpans;
|
+- (void)invalidateInteractiveSpans;
|
||||||
+@end
|
+@end
|
||||||
+
|
+
|
||||||
+/* Virtual AXStaticText element — one per mode line. */
|
+/* Virtual AXStaticText element --- one per mode line. */
|
||||||
+@interface EmacsAccessibilityModeLine : EmacsAccessibilityElement
|
+@interface EmacsAccessibilityModeLine : EmacsAccessibilityElement
|
||||||
+@end
|
+@end
|
||||||
+
|
+
|
||||||
@@ -189,7 +189,7 @@ index ea6e7ba4f5..f245675513 100644
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index 88c9251c18..9d36de66f9 100644
|
index 6333a7253a..9c53001e37 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)
|
||||||
@@ -200,7 +200,7 @@ index 88c9251c18..9d36de66f9 100644
|
|||||||
#include "systime.h"
|
#include "systime.h"
|
||||||
#include "character.h"
|
#include "character.h"
|
||||||
#include "xwidget.h"
|
#include "xwidget.h"
|
||||||
@@ -7201,6 +7202,432 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
|
@@ -7213,6 +7214,443 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ index 88c9251c18..9d36de66f9 100644
|
|||||||
+
|
+
|
||||||
+ /* Extract this visible run's text. Use
|
+ /* Extract this visible run's text. Use
|
||||||
+ Fbuffer_substring_no_properties which correctly handles the
|
+ Fbuffer_substring_no_properties which correctly handles the
|
||||||
+ buffer gap — raw BUF_BYTE_ADDRESS reads across the gap would
|
+ buffer gap --- raw BUF_BYTE_ADDRESS reads across the gap would
|
||||||
+ include garbage bytes when the run spans the gap position. */
|
+ include garbage bytes when the run spans the gap position. */
|
||||||
+ Lisp_Object lstr = Fbuffer_substring_no_properties (
|
+ Lisp_Object lstr = Fbuffer_substring_no_properties (
|
||||||
+ make_fixnum (pos), make_fixnum (run_end));
|
+ make_fixnum (pos), make_fixnum (run_end));
|
||||||
@@ -372,7 +372,7 @@ index 88c9251c18..9d36de66f9 100644
|
|||||||
+ return NSZeroRect;
|
+ return NSZeroRect;
|
||||||
+
|
+
|
||||||
+ /* charpos_start and charpos_len are already in buffer charpos
|
+ /* charpos_start and charpos_len are already in buffer charpos
|
||||||
+ space — the caller maps AX string indices through
|
+ space --- the caller maps AX string indices through
|
||||||
+ charposForAccessibilityIndex which handles invisible text. */
|
+ charposForAccessibilityIndex which handles invisible text. */
|
||||||
+ ptrdiff_t cp_start = charpos_start;
|
+ ptrdiff_t cp_start = charpos_start;
|
||||||
+ ptrdiff_t cp_end = cp_start + charpos_len;
|
+ ptrdiff_t cp_end = cp_start + charpos_len;
|
||||||
@@ -627,22 +627,33 @@ index 88c9251c18..9d36de66f9 100644
|
|||||||
+
|
+
|
||||||
+@end
|
+@end
|
||||||
+
|
+
|
||||||
|
+/* Stub implementation of InteractiveSpans category.
|
||||||
|
+ The full implementation is added in a later patch. */
|
||||||
|
+@implementation EmacsAccessibilityBuffer (InteractiveSpans)
|
||||||
|
+
|
||||||
|
+- (void)invalidateInteractiveSpans
|
||||||
|
+{
|
||||||
|
+ /* Stub: full implementation in the following patch. */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+@end
|
||||||
|
+
|
||||||
+#endif /* NS_IMPL_COCOA */
|
+#endif /* NS_IMPL_COCOA */
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
/* ==========================================================================
|
/* ==========================================================================
|
||||||
|
|
||||||
EmacsView implementation
|
EmacsView implementation
|
||||||
@@ -11657,6 +12084,24 @@ Convert an X font name (XLFD) to an NS font name.
|
@@ -11669,6 +12107,24 @@ Convert an X font name (XLFD) to an NS font name.
|
||||||
DEFSYM (Qns_drag_operation_generic, "ns-drag-operation-generic");
|
DEFSYM (Qns_drag_operation_generic, "ns-drag-operation-generic");
|
||||||
DEFSYM (Qns_handle_drag_motion, "ns-handle-drag-motion");
|
DEFSYM (Qns_handle_drag_motion, "ns-handle-drag-motion");
|
||||||
|
|
||||||
+ /* Accessibility: line navigation command symbols for
|
+ /* Accessibility: line navigation command symbols for
|
||||||
+ ns_ax_event_is_line_nav_key (hot path, avoid intern per call). */
|
+ ns_ax_event_is_line_nav_key (hot path, avoid intern per call). */
|
||||||
+ DEFSYM (Qns_ax_next_line, "next-line");
|
+ DEFSYM (Qnext_line, "next-line");
|
||||||
+ DEFSYM (Qns_ax_previous_line, "previous-line");
|
+ DEFSYM (Qprevious_line, "previous-line");
|
||||||
+ DEFSYM (Qns_ax_dired_next_line, "dired-next-line");
|
+ DEFSYM (Qdired_next_line, "dired-next-line");
|
||||||
+ DEFSYM (Qns_ax_dired_previous_line, "dired-previous-line");
|
+ DEFSYM (Qdired_previous_line, "dired-previous-line");
|
||||||
+
|
+
|
||||||
+ /* Accessibility span scanning symbols. */
|
+ /* Accessibility span scanning symbols. */
|
||||||
+ DEFSYM (Qns_ax_widget, "widget");
|
+ DEFSYM (Qns_ax_widget, "widget");
|
||||||
@@ -658,7 +669,7 @@ index 88c9251c18..9d36de66f9 100644
|
|||||||
Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
|
Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
|
||||||
Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
|
Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
|
||||||
Fput (Qmeta, Qmodifier_value, make_fixnum (meta_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
|
@@ -11817,6 +12273,16 @@ 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. */);
|
This variable is ignored on Mac OS X < 10.7 and GNUstep. */);
|
||||||
ns_use_srgb_colorspace = YES;
|
ns_use_srgb_colorspace = YES;
|
||||||
|
|
||||||
@@ -668,7 +679,8 @@ index 88c9251c18..9d36de66f9 100644
|
|||||||
+When nil, the accessibility virtual element tree is not built and no
|
+When nil, the accessibility virtual element tree is not built and no
|
||||||
+notifications are posted, eliminating the associated overhead.
|
+notifications are posted, eliminating the associated overhead.
|
||||||
+Requires the Cocoa (NS) build on macOS; ignored on GNUstep.
|
+Requires the Cocoa (NS) build on macOS; ignored on GNUstep.
|
||||||
+Default is nil. Set to t to enable VoiceOver support. */);
|
+The initial value is nil. Emacs sets this automatically at startup
|
||||||
|
+when macOS Zoom is active or any assistive technology is connected. */);
|
||||||
+ ns_accessibility_enabled = NO;
|
+ ns_accessibility_enabled = NO;
|
||||||
+
|
+
|
||||||
DEFVAR_BOOL ("ns-use-mwheel-acceleration",
|
DEFVAR_BOOL ("ns-use-mwheel-acceleration",
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
From ba093f98d3bb1281278170f01f0792c2b24cf94f Mon Sep 17 00:00:00 2001
|
From 64859d37421bdaabe2ec416285b6f1847da0737c Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
Date: Wed, 4 Mar 2026 15:23:54 +0100
|
||||||
Subject: [PATCH 3/9] ns: implement buffer accessibility element (core
|
Subject: [PATCH 2/8] ns: implement buffer accessibility element
|
||||||
protocol)
|
|
||||||
|
|
||||||
Implement the NSAccessibility text protocol for Emacs buffer windows.
|
Implement the NSAccessibility text protocol for Emacs buffer windows.
|
||||||
|
|
||||||
@@ -10,37 +9,35 @@ Implement the NSAccessibility text protocol for Emacs buffer windows.
|
|||||||
(ns_ax_event_is_line_nav_key, ns_ax_completion_text_for_span): New
|
(ns_ax_event_is_line_nav_key, ns_ax_completion_text_for_span): New
|
||||||
functions.
|
functions.
|
||||||
(EmacsAccessibilityBuffer): Implement core NSAccessibility protocol.
|
(EmacsAccessibilityBuffer): Implement core NSAccessibility protocol.
|
||||||
(ensureTextCache): Validity gated on BUF_CHARS_MODIFF, not BUF_MODIFF,
|
(ensureTextCache): Validity gated on BUF_MODIFF to catch fold/unfold
|
||||||
to avoid O(buffer-size) rebuilds on every font-lock pass. Add
|
commands (org-mode, outline-mode, hideshow-mode) that change the
|
||||||
explanatory comment on why lineRangeForRange: in the lineStartOffsets
|
'invisible text property without modifying character content.
|
||||||
loop is safe: it runs only on actual character modifications.
|
BUF_CHARS_MODIFF would serve stale AX text after org-cycle or similar.
|
||||||
(accessibilityIndexForCharpos:): O(1) fast path for pure-ASCII runs
|
ensureTextCache is called only from AX getters at human interaction
|
||||||
(ax_length == length); fall back to sequence walk for multi-byte runs.
|
speed, not from the redisplay notification path.
|
||||||
|
(accessibilityIndexForCharpos:): O(1) fast path for pure-ASCII runs.
|
||||||
(charposForAccessibilityIndex:): Symmetric O(1) fast path.
|
(charposForAccessibilityIndex:): Symmetric O(1) fast path.
|
||||||
(accessibilityRole, accessibilityLabel, accessibilityValue)
|
(accessibilityRole, accessibilityLabel, accessibilityValue)
|
||||||
(accessibilityNumberOfCharacters, accessibilitySelectedText)
|
(accessibilityNumberOfCharacters, accessibilitySelectedText)
|
||||||
(accessibilitySelectedTextRange, accessibilityInsertionPointLineNumber)
|
(accessibilitySelectedTextRange, accessibilityInsertionPointLineNumber)
|
||||||
(accessibilityRangeForLine:, accessibilityRangeForIndex:)
|
(accessibilityLineForIndex:, accessibilityRangeForLine:)
|
||||||
(accessibilityStyleRangeForIndex:, accessibilityFrameForRange:)
|
(accessibilityRangeForIndex:, accessibilityStyleRangeForIndex:)
|
||||||
(accessibilityRangeForPosition:, accessibilityVisibleCharacterRange)
|
(accessibilityFrameForRange:, accessibilityRangeForPosition:)
|
||||||
(accessibilityFrame, setAccessibilitySelectedTextRange:)
|
(accessibilityVisibleCharacterRange, accessibilityFrame)
|
||||||
|
(setAccessibilitySelectedTextRange:)
|
||||||
(setAccessibilityFocused:): Implement NSAccessibility protocol methods.
|
(setAccessibilityFocused:): Implement NSAccessibility protocol methods.
|
||||||
---
|
---
|
||||||
src/nsterm.m | 1115 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
src/nsterm.m | 1135 +++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||||
1 file changed, 1115 insertions(+)
|
1 file changed, 1133 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index 9d36de66f9..6256dbc22e 100644
|
index 9c53001e37..e4b3fb17a0 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -7625,6 +7625,1121 @@ - (id)accessibilityTopLevelUIElement
|
@@ -7648,6 +7648,1137 @@ - (void)invalidateInteractiveSpans
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static BOOL
|
+static BOOL
|
||||||
+ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
|
+ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
|
||||||
+ ptrdiff_t *out_start,
|
+ ptrdiff_t *out_start,
|
||||||
@@ -152,15 +149,15 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ {
|
+ {
|
||||||
+ Lisp_Object cmd = Vthis_command;
|
+ Lisp_Object cmd = Vthis_command;
|
||||||
+ /* Forward line commands. */
|
+ /* Forward line commands. */
|
||||||
+ if (EQ (cmd, Qns_ax_next_line)
|
+ if (EQ (cmd, Qnext_line)
|
||||||
+ || EQ (cmd, Qns_ax_dired_next_line))
|
+ || EQ (cmd, Qdired_next_line))
|
||||||
+ {
|
+ {
|
||||||
+ if (which) *which = 1;
|
+ if (which) *which = 1;
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ /* Backward line commands. */
|
+ /* Backward line commands. */
|
||||||
+ if (EQ (cmd, Qns_ax_previous_line)
|
+ if (EQ (cmd, Qprevious_line)
|
||||||
+ || EQ (cmd, Qns_ax_dired_previous_line))
|
+ || EQ (cmd, Qdired_previous_line))
|
||||||
+ {
|
+ {
|
||||||
+ if (which) *which = -1;
|
+ if (which) *which = -1;
|
||||||
+ return true;
|
+ return true;
|
||||||
@@ -355,7 +352,7 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ NSTRACE ("EmacsAccessibilityBuffer ensureTextCache");
|
+ NSTRACE ("EmacsAccessibilityBuffer ensureTextCache");
|
||||||
+ /* This method is only called from the main thread (AX getters
|
+ /* This method is only called from the main thread (AX getters
|
||||||
+ dispatch_sync to main first). Reads of cachedText/cachedTextModiff
|
+ dispatch_sync to main first). Reads of cachedText/cachedTextModiff
|
||||||
+ below are therefore safe without @synchronized — only the
|
+ below are therefore safe without @synchronized --- only the
|
||||||
+ write section at the end needs synchronization to protect
|
+ write section at the end needs synchronization to protect
|
||||||
+ against concurrent reads from AX server thread. */
|
+ against concurrent reads from AX server thread. */
|
||||||
+ eassert ([NSThread isMainThread]);
|
+ eassert ([NSThread isMainThread]);
|
||||||
@@ -367,25 +364,25 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ if (!b)
|
+ if (!b)
|
||||||
+ return;
|
+ return;
|
||||||
+
|
+
|
||||||
+ /* Use BUF_CHARS_MODIFF, not BUF_MODIFF, for cache validity.
|
+ /* Use BUF_MODIFF, not BUF_CHARS_MODIFF, for cache validity.
|
||||||
+ BUF_MODIFF is bumped by every text-property change, including
|
+ Fold/unfold commands (org-mode, outline-mode, hideshow-mode) change
|
||||||
+ font-lock face applications on every redisplay. AX text contains
|
+ text visibility by modifying the 'invisible text property via
|
||||||
+ only characters, not face data, so property-only changes do not
|
+ put-text-property or add-text-properties. These bump BUF_MODIFF
|
||||||
+ affect the cached value. Rebuilding the full buffer text on
|
+ but not BUF_CHARS_MODIFF. Using BUF_CHARS_MODIFF would serve stale
|
||||||
+ each font-lock pass is O(buffer-size) per redisplay --- this
|
+ AX text across fold/unfold, causing VoiceOver to read the wrong
|
||||||
+ causes progressive slowdown when scrolling through large files.
|
+ content after an org-cycle or similar command.
|
||||||
+ BUF_CHARS_MODIFF is bumped only on actual character insertions
|
+ ensureTextCache is called exclusively from AX getters at human
|
||||||
+ and deletions, matching the semantic of "did the text change".
|
+ interaction speed (never from the redisplay notification path), so
|
||||||
+ This is the pattern used by WebKit and NSTextView.
|
+ font-lock passes cause zero rebuild cost via the notification path.
|
||||||
+ Do NOT track BUF_OVERLAY_MODIFF here --- overlay text is not
|
+ Do NOT track BUF_OVERLAY_MODIFF here --- overlay text is not
|
||||||
+ included in the cached AX text (it is handled separately via
|
+ included in the cached AX text (it is handled separately via
|
||||||
+ explicit announcements in postAccessibilityNotificationsForFrame).
|
+ explicit announcements in postAccessibilityNotificationsForFrame).
|
||||||
+ Including overlay_modiff would silently update cachedOverlayModiff
|
+ Including overlay_modiff would silently update cachedOverlayModiff
|
||||||
+ and prevent the notification dispatch from detecting changes. */
|
+ and prevent the notification dispatch from detecting changes. */
|
||||||
+ ptrdiff_t chars_modiff = BUF_CHARS_MODIFF (b);
|
+ ptrdiff_t modiff = BUF_MODIFF (b);
|
||||||
+ ptrdiff_t pt = BUF_PT (b);
|
+ ptrdiff_t pt = BUF_PT (b);
|
||||||
+ NSUInteger textLen = cachedText ? [cachedText length] : 0;
|
+ NSUInteger textLen = cachedText ? [cachedText length] : 0;
|
||||||
+ if (cachedText && cachedTextModiff == chars_modiff
|
+ if (cachedText && cachedTextModiff == modiff
|
||||||
+ && cachedTextStart == BUF_BEGV (b)
|
+ && cachedTextStart == BUF_BEGV (b)
|
||||||
+ && pt >= cachedTextStart
|
+ && pt >= cachedTextStart
|
||||||
+ && (textLen == 0
|
+ && (textLen == 0
|
||||||
@@ -401,7 +398,7 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ {
|
+ {
|
||||||
+ [cachedText release];
|
+ [cachedText release];
|
||||||
+ cachedText = [text retain];
|
+ cachedText = [text retain];
|
||||||
+ cachedTextModiff = chars_modiff;
|
+ cachedTextModiff = modiff;
|
||||||
+ cachedTextStart = start;
|
+ cachedTextStart = start;
|
||||||
+
|
+
|
||||||
+ if (visibleRuns)
|
+ if (visibleRuns)
|
||||||
@@ -413,10 +410,9 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ Walk the cached text once, recording the start offset of each
|
+ Walk the cached text once, recording the start offset of each
|
||||||
+ line. Uses NSString lineRangeForRange: --- O(N) in the total
|
+ line. Uses NSString lineRangeForRange: --- O(N) in the total
|
||||||
+ text --- but this loop runs only on cache rebuild, which is
|
+ text --- but this loop runs only on cache rebuild, which is
|
||||||
+ gated on BUF_CHARS_MODIFF: actual character insertions or
|
+ gated on BUF_MODIFF. Font-lock passes trigger a rebuild only
|
||||||
+ deletions. Font-lock (text property changes) does not trigger
|
+ when called from AX getters (human interaction speed), never
|
||||||
+ a rebuild, so the hot path (cursor movement, redisplay) never
|
+ from the notification path. */
|
||||||
+ enters this code. */
|
|
||||||
+ if (lineStartOffsets)
|
+ if (lineStartOffsets)
|
||||||
+ xfree (lineStartOffsets);
|
+ xfree (lineStartOffsets);
|
||||||
+ lineStartOffsets = NULL;
|
+ lineStartOffsets = NULL;
|
||||||
@@ -470,7 +466,7 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ /* Binary search: runs are sorted by charpos (ascending). Find the
|
+ /* Binary search: runs are sorted by charpos (ascending). Find the
|
||||||
+ run whose [charpos, charpos+length) range contains the target,
|
+ run whose [charpos, charpos+length) range contains the target,
|
||||||
+ or the nearest run after an invisible gap. O(log n) instead of
|
+ or the nearest run after an invisible gap. O(log n) instead of
|
||||||
+ O(n) — matters for org-mode with many folded sections. */
|
+ O(n) --- matters for org-mode with many folded sections. */
|
||||||
+ NSUInteger lo = 0, hi = visibleRunCount;
|
+ NSUInteger lo = 0, hi = visibleRunCount;
|
||||||
+ while (lo < hi)
|
+ while (lo < hi)
|
||||||
+ {
|
+ {
|
||||||
@@ -519,10 +515,10 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+
|
+
|
||||||
+/* Convert accessibility string index to buffer charpos.
|
+/* Convert accessibility string index to buffer charpos.
|
||||||
+ Safe to call from any thread: uses only cachedText (NSString) and
|
+ Safe to call from any thread: uses only cachedText (NSString) and
|
||||||
+ visibleRuns — no Lisp calls. */
|
+ visibleRuns --- no Lisp calls. */
|
||||||
+- (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
|
+- (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
|
||||||
+{
|
+{
|
||||||
+ /* May be called from AX server thread — synchronize. */
|
+ /* May be called from AX server thread --- synchronize. */
|
||||||
+ @synchronized (self)
|
+ @synchronized (self)
|
||||||
+ {
|
+ {
|
||||||
+ if (visibleRunCount == 0)
|
+ if (visibleRunCount == 0)
|
||||||
@@ -564,7 +560,7 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ return cp;
|
+ return cp;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ /* Past end — return last charpos. */
|
+ /* Past end --- return last charpos. */
|
||||||
+ if (lo > 0)
|
+ if (lo > 0)
|
||||||
+ {
|
+ {
|
||||||
+ ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
|
+ ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
|
||||||
@@ -586,7 +582,7 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ deadlocking the AX server thread. This is prevented by:
|
+ deadlocking the AX server thread. This is prevented by:
|
||||||
+
|
+
|
||||||
+ 1. validWindow checks WINDOW_LIVE_P and BUFFERP before every
|
+ 1. validWindow checks WINDOW_LIVE_P and BUFFERP before every
|
||||||
+ Lisp access — the window and buffer are verified live.
|
+ Lisp access --- the window and buffer are verified live.
|
||||||
+ 2. All dispatch_sync blocks run on the main thread where no
|
+ 2. All dispatch_sync blocks run on the main thread where no
|
||||||
+ concurrent Lisp code can modify state between checks.
|
+ concurrent Lisp code can modify state between checks.
|
||||||
+ 3. block_input prevents timer events and process output from
|
+ 3. block_input prevents timer events and process output from
|
||||||
@@ -954,6 +950,27 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ return [self rangeForLine:(NSUInteger)line textLength:len];
|
+ return [self rangeForLine:(NSUInteger)line textLength:len];
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
+- (NSInteger)accessibilityLineForIndex:(NSInteger)index
|
||||||
|
+{
|
||||||
|
+ if (![NSThread isMainThread])
|
||||||
|
+ {
|
||||||
|
+ __block NSInteger result;
|
||||||
|
+ dispatch_sync (dispatch_get_main_queue (), ^{
|
||||||
|
+ result = [self accessibilityLineForIndex:index];
|
||||||
|
+ });
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
|
+ [self ensureTextCache];
|
||||||
|
+ if (!cachedText || index < 0)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ NSUInteger idx = (NSUInteger) index;
|
||||||
|
+ if (idx > [cachedText length])
|
||||||
|
+ idx = [cachedText length];
|
||||||
|
+
|
||||||
|
+ return [self lineForAXIndex:idx];
|
||||||
|
+}
|
||||||
|
+
|
||||||
+- (NSRange)accessibilityRangeForIndex:(NSInteger)index
|
+- (NSRange)accessibilityRangeForIndex:(NSInteger)index
|
||||||
+{
|
+{
|
||||||
+ if (![NSThread isMainThread])
|
+ if (![NSThread isMainThread])
|
||||||
@@ -1036,9 +1053,9 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
+ glyph matrix while we traverse it. Use specpdl unwind protection
|
+ glyph matrix while we traverse it. Use specpdl unwind protection
|
||||||
+ so block_input is always matched by unblock_input, even if
|
+ so block_input is always matched by unblock_input, even if
|
||||||
+ ensureTextCache triggers a Lisp signal (longjmp). */
|
+ ensureTextCache triggers a Lisp signal (longjmp). */
|
||||||
|
+ block_input ();
|
||||||
+ specpdl_ref count = SPECPDL_INDEX ();
|
+ specpdl_ref count = SPECPDL_INDEX ();
|
||||||
+ record_unwind_protect_void (unblock_input);
|
+ record_unwind_protect_void (unblock_input);
|
||||||
+ block_input ();
|
|
||||||
+
|
+
|
||||||
+ /* Find the glyph row at this y coordinate. */
|
+ /* Find the glyph row at this y coordinate. */
|
||||||
+ struct glyph_matrix *matrix = w->current_matrix;
|
+ struct glyph_matrix *matrix = w->current_matrix;
|
||||||
@@ -1155,6 +1172,20 @@ index 9d36de66f9..6256dbc22e 100644
|
|||||||
#endif /* NS_IMPL_COCOA */
|
#endif /* NS_IMPL_COCOA */
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8918,13 +10049,13 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
|
||||||
|
if (old_title == 0)
|
||||||
|
{
|
||||||
|
char *t = strdup ([[[self window] title] UTF8String]);
|
||||||
|
char *pos = strstr (t, " — ");
|
||||||
|
if (pos)
|
||||||
|
*pos = '\0';
|
||||||
|
old_title = t;
|
||||||
|
}
|
||||||
|
size_title = xmalloc (strlen (old_title) + 40);
|
||||||
|
esprintf (size_title, "%s — (%d × %d)", old_title, cols, rows);
|
||||||
|
[window setTitle: [NSString stringWithUTF8String: size_title]];
|
||||||
|
[window display];
|
||||||
|
xfree (size_title);
|
||||||
--
|
--
|
||||||
2.43.0
|
2.43.0
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
From 0566d2cf3bc1b6309b3b3dd1a048bac7c63937e9 Mon Sep 17 00:00:00 2001
|
From 11aa323081fd9117381413b6d8e477659d6afc29 Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
Date: Wed, 4 Mar 2026 15:23:55 +0100
|
||||||
Subject: [PATCH 4/9] ns: add buffer notification dispatch and mode-line
|
Subject: [PATCH 3/8] ns: add AX notifications and mode-line element
|
||||||
element
|
|
||||||
|
|
||||||
Add VoiceOver notification dispatch and mode-line readout.
|
Add VoiceOver notification dispatch and mode-line readout.
|
||||||
|
|
||||||
@@ -26,10 +25,10 @@ mode line.
|
|||||||
1 file changed, 606 insertions(+)
|
1 file changed, 606 insertions(+)
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index 6256dbc22e..9e0e317237 100644
|
index e4b3fb17a0..84a32a05cb 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -8740,6 +8740,612 @@ - (NSRect)accessibilityFrame
|
@@ -8779,6 +8779,612 @@ - (NSRect)accessibilityFrame
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From ce123c5b0c25467dd6fb6d4a2aeda59687fadefc Mon Sep 17 00:00:00 2001
|
From 9d99df6f95ac2011a1a9f3de448f2f0ec4c27145 Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
Date: Wed, 4 Mar 2026 15:23:55 +0100
|
||||||
Subject: [PATCH 5/9] ns: add interactive span elements for Tab navigation
|
Subject: [PATCH 4/8] ns: add interactive span elements for Tab
|
||||||
|
|
||||||
* src/nsterm.m (ns_ax_scan_interactive_spans): New function; scans the
|
* src/nsterm.m (ns_ax_scan_interactive_spans): New function; scans the
|
||||||
visible portion of a buffer for interactive text properties
|
visible portion of a buffer for interactive text properties
|
||||||
@@ -14,14 +14,32 @@ elements with an AXPress action that sends a synthetic TAB keystroke.
|
|||||||
(accessibilityChildrenInNavigationOrder): Return cached span array,
|
(accessibilityChildrenInNavigationOrder): Return cached span array,
|
||||||
rebuilding lazily when interactiveSpansDirty is set.
|
rebuilding lazily when interactiveSpansDirty is set.
|
||||||
---
|
---
|
||||||
src/nsterm.m | 293 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
src/nsterm.m | 304 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
1 file changed, 293 insertions(+)
|
1 file changed, 293 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index 9e0e317237..d65609cc79 100644
|
index 84a32a05cb..b327102521 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -9346,6 +9346,299 @@ - (NSRect)accessibilityFrame
|
@@ -7637,17 +7637,6 @@ - (id)accessibilityTopLevelUIElement
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
-/* Stub implementation of InteractiveSpans category.
|
||||||
|
- The full implementation is added in a later patch. */
|
||||||
|
-@implementation EmacsAccessibilityBuffer (InteractiveSpans)
|
||||||
|
-
|
||||||
|
-- (void)invalidateInteractiveSpans
|
||||||
|
-{
|
||||||
|
- /* Stub: full implementation added in patch 0004. */
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-@end
|
||||||
|
-
|
||||||
|
static BOOL
|
||||||
|
ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
|
||||||
|
ptrdiff_t *out_start,
|
||||||
|
@@ -9385,6 +9374,299 @@ - (NSRect)accessibilityFrame
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
From 3f894218b771f2aa098f19dfb4bdc8b13408c8c8 Mon Sep 17 00:00:00 2001
|
From cba3eda4d3c50dcd77c73353c6a8d2713bfcb8ae Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
Date: Wed, 4 Mar 2026 15:23:55 +0100
|
||||||
Subject: [PATCH 6/9] ns: integrate accessibility with EmacsView and redisplay
|
Subject: [PATCH 5/8] ns: wire accessibility into EmacsView and redisplay
|
||||||
|
|
||||||
Wire the accessibility element tree into EmacsView and hook it into
|
Wire the accessibility element tree into EmacsView and hook it into
|
||||||
the redisplay cycle.
|
the redisplay cycle.
|
||||||
@@ -23,8 +23,8 @@ com.apple.accessibility.api distributed notification.
|
|||||||
(accessibilityAttributeValue:forParameter:): New methods.
|
(accessibilityAttributeValue:forParameter:): New methods.
|
||||||
---
|
---
|
||||||
etc/NEWS | 13 ++
|
etc/NEWS | 13 ++
|
||||||
src/nsterm.m | 474 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
src/nsterm.m | 475 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
2 files changed, 477 insertions(+), 10 deletions(-)
|
2 files changed, 478 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
diff --git a/etc/NEWS b/etc/NEWS
|
diff --git a/etc/NEWS b/etc/NEWS
|
||||||
index 4c149e41d6..7f917f93b2 100644
|
index 4c149e41d6..7f917f93b2 100644
|
||||||
@@ -51,10 +51,10 @@ index 4c149e41d6..7f917f93b2 100644
|
|||||||
** Re-introduced dictation, lost in Emacs v30 (macOS).
|
** Re-introduced dictation, lost in Emacs v30 (macOS).
|
||||||
We lost macOS dictation in v30 when migrating to NSTextInputClient.
|
We lost macOS dictation in v30 when migrating to NSTextInputClient.
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index d65609cc79..4ba9b41b3b 100644
|
index b327102521..e003bca5bd 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -1393,7 +1393,8 @@ so the visual offset is (ov_line + 1) * line_h from
|
@@ -1405,7 +1405,8 @@ so the visual offset is (ov_line + 1) * line_h from
|
||||||
(zoomCursorUpdated is NO). */
|
(zoomCursorUpdated is NO). */
|
||||||
#if defined (MAC_OS_X_VERSION_MIN_REQUIRED) \
|
#if defined (MAC_OS_X_VERSION_MIN_REQUIRED) \
|
||||||
&& MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
|
&& MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
|
||||||
@@ -64,17 +64,18 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
&& !NSIsEmptyRect (view->lastCursorRect))
|
&& !NSIsEmptyRect (view->lastCursorRect))
|
||||||
{
|
{
|
||||||
NSRect r = view->lastCursorRect;
|
NSRect r = view->lastCursorRect;
|
||||||
@@ -1420,6 +1421,9 @@ so the visual offset is (ov_line + 1) * line_h from
|
@@ -1432,6 +1433,10 @@ so the visual offset is (ov_line + 1) * line_h from
|
||||||
if (view)
|
if (view)
|
||||||
ns_zoom_track_completion (f, view);
|
ns_zoom_track_completion (f, view);
|
||||||
#endif /* NS_IMPL_COCOA */
|
#endif /* NS_IMPL_COCOA */
|
||||||
+
|
+
|
||||||
+ /* Post accessibility notifications after each redisplay cycle. */
|
+ /* Post accessibility notifications after each redisplay cycle. */
|
||||||
|
+ if (view)
|
||||||
+ [view postAccessibilityUpdates];
|
+ [view postAccessibilityUpdates];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -6723,9 +6727,56 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
|
@@ -6735,9 +6740,56 @@ - (void)applicationDidFinishLaunching: (NSNotification *)notification
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -131,15 +132,7 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
- (void)antialiasThresholdDidChange:(NSNotification *)notification
|
- (void)antialiasThresholdDidChange:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
#ifdef NS_IMPL_COCOA
|
#ifdef NS_IMPL_COCOA
|
||||||
@@ -7628,7 +7679,6 @@ - (id)accessibilityTopLevelUIElement
|
@@ -8769,7 +8821,6 @@ - (NSRect)accessibilityFrame
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-
|
|
||||||
static BOOL
|
|
||||||
ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
|
|
||||||
ptrdiff_t *out_start,
|
|
||||||
@@ -8741,7 +8791,6 @@ - (NSRect)accessibilityFrame
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@@ -147,7 +140,7 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
/* ===================================================================
|
/* ===================================================================
|
||||||
EmacsAccessibilityBuffer (Notifications) — AX event dispatch
|
EmacsAccessibilityBuffer (Notifications) — AX event dispatch
|
||||||
|
|
||||||
@@ -9235,6 +9284,54 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
@@ -9263,6 +9314,54 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
||||||
granularity = ns_ax_text_selection_granularity_line;
|
granularity = ns_ax_text_selection_granularity_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +195,7 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
/* Post notifications for focused and non-focused elements. */
|
/* Post notifications for focused and non-focused elements. */
|
||||||
if ([self isAccessibilityFocused])
|
if ([self isAccessibilityFocused])
|
||||||
[self postFocusedCursorNotification:point
|
[self postFocusedCursorNotification:point
|
||||||
@@ -9347,7 +9444,6 @@ - (NSRect)accessibilityFrame
|
@@ -9375,7 +9474,6 @@ - (NSRect)accessibilityFrame
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@@ -210,7 +203,7 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
/* ===================================================================
|
/* ===================================================================
|
||||||
EmacsAccessibilityInteractiveSpan --- helpers and implementation
|
EmacsAccessibilityInteractiveSpan --- helpers and implementation
|
||||||
=================================================================== */
|
=================================================================== */
|
||||||
@@ -9684,6 +9780,7 @@ - (void)dealloc
|
@@ -9712,6 +9810,7 @@ - (void)dealloc
|
||||||
[layer release];
|
[layer release];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -218,7 +211,7 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
[[self menu] release];
|
[[self menu] release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@@ -11032,6 +11129,32 @@ - (void)windowDidBecomeKey /* for direct calls */
|
@@ -11060,6 +11159,32 @@ - (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
|
||||||
@@ -251,7 +244,7 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -12269,6 +12392,332 @@ - (int) fullscreenState
|
@@ -12297,6 +12422,332 @@ - (int) fullscreenState
|
||||||
return fs_state;
|
return fs_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +577,7 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
@end /* EmacsView */
|
@end /* EmacsView */
|
||||||
|
|
||||||
|
|
||||||
@@ -14265,12 +14714,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
|
@@ -14293,13 +14744,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
|
||||||
ns_use_srgb_colorspace = YES;
|
ns_use_srgb_colorspace = YES;
|
||||||
|
|
||||||
DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled,
|
DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled,
|
||||||
@@ -593,7 +586,8 @@ index d65609cc79..4ba9b41b3b 100644
|
|||||||
-When nil, the accessibility virtual element tree is not built and no
|
-When nil, the accessibility virtual element tree is not built and no
|
||||||
-notifications are posted, eliminating the associated overhead.
|
-notifications are posted, eliminating the associated overhead.
|
||||||
-Requires the Cocoa (NS) build on macOS; ignored on GNUstep.
|
-Requires the Cocoa (NS) build on macOS; ignored on GNUstep.
|
||||||
-Default is nil. Set to t to enable VoiceOver support. */);
|
-The initial value is nil. Emacs sets this automatically at startup
|
||||||
|
-when macOS Zoom is active or any assistive technology is connected. */);
|
||||||
+ doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support.
|
+ doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support.
|
||||||
+Emacs sets this automatically at startup when macOS Zoom is active or
|
+Emacs sets this automatically at startup when macOS Zoom is active or
|
||||||
+any assistive technology (VoiceOver, Switch Control, etc.) is connected,
|
+any assistive technology (VoiceOver, Switch Control, etc.) is connected,
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
From 23139d3e63a0d97cf1fdf0421fd7c41acce0bd6b Mon Sep 17 00:00:00 2001
|
From a1ea69133e5a5c04076901dce47cd54683c4ca2e Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Sat, 28 Feb 2026 12:58:11 +0100
|
Date: Wed, 4 Mar 2026 15:23:55 +0100
|
||||||
Subject: [PATCH 7/9] doc: add VoiceOver accessibility section to macOS
|
Subject: [PATCH 6/8] doc: add VoiceOver section to macOS appendix
|
||||||
appendix
|
|
||||||
|
|
||||||
* doc/emacs/macos.texi (VoiceOver Accessibility): New node between
|
* doc/emacs/macos.texi (VoiceOver Accessibility): New node between
|
||||||
'Mac / GNUstep Events' and 'GNUstep Support'. Document screen reader
|
'Mac / GNUstep Events' and 'GNUstep Support'. Document screen reader
|
||||||
usage, keyboard navigation, completion announcements, ns-accessibility-
|
usage, keyboard navigation, completion announcements, ns-accessibility-
|
||||||
enabled, and known limitations. Use @xref for cross-reference at
|
enabled, and known limitations. Correct description of ns-accessibility-enabled
|
||||||
sentence start. Correct description of ns-accessibility-enabled
|
|
||||||
default: initial value is nil, set automatically at startup.
|
default: initial value is nil, set automatically at startup.
|
||||||
---
|
---
|
||||||
doc/emacs/macos.texi | 77 ++++++++++++++++++++++++++++++++++++++++++++
|
doc/emacs/macos.texi | 77 ++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@@ -27,7 +25,7 @@ index 6bd334f48e..72ac3a9aa9 100644
|
|||||||
* GNUstep Support:: Details on status of GNUstep support.
|
* GNUstep Support:: Details on status of GNUstep support.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@@ -272,6 +273,82 @@ and return the result as a string. You can also use the Lisp function
|
@@ -272,6 +273,78 @@ and return the result as a string. You can also use the Lisp function
|
||||||
services and receive the results back. Note that you may need to
|
services and receive the results back. Note that you may need to
|
||||||
restart Emacs to access newly-available services.
|
restart Emacs to access newly-available services.
|
||||||
|
|
||||||
@@ -97,10 +95,6 @@ index 6bd334f48e..72ac3a9aa9 100644
|
|||||||
+Right-to-left (bidi) text is exposed correctly as buffer content,
|
+Right-to-left (bidi) text is exposed correctly as buffer content,
|
||||||
+but @code{accessibilityRangeForPosition} hit-testing assumes
|
+but @code{accessibilityRangeForPosition} hit-testing assumes
|
||||||
+left-to-right glyph layout.
|
+left-to-right glyph layout.
|
||||||
+@item
|
|
||||||
+Block-style cursors are handled correctly: character navigation
|
|
||||||
+announces the character at the cursor position, not the character
|
|
||||||
+before it.
|
|
||||||
+@end itemize
|
+@end itemize
|
||||||
+
|
+
|
||||||
+ This support is available only on the Cocoa build. GNUstep has a
|
+ This support is available only on the Cocoa build. GNUstep has a
|
||||||
@@ -111,10 +105,10 @@ index 6bd334f48e..72ac3a9aa9 100644
|
|||||||
@section GNUstep Support
|
@section GNUstep Support
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index 4ba9b41b3b..a0419bb5df 100644
|
index e003bca5bd..705c3ece06 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -14715,9 +14715,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
|
@@ -14745,9 +14745,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
|
||||||
|
|
||||||
DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled,
|
DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled,
|
||||||
doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support.
|
doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support.
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
From 217177caefc709c37ae04732ec595ace903e4cc4 Mon Sep 17 00:00:00 2001
|
From b6bc1d102334e32dbc3e284d9e65b0f304c3e694 Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Mon, 2 Mar 2026 18:39:46 +0100
|
Date: Wed, 4 Mar 2026 15:23:56 +0100
|
||||||
Subject: [PATCH 8/9] ns: announce overlay completion candidates for VoiceOver
|
Subject: [PATCH 7/8] ns: announce overlay completions to VoiceOver
|
||||||
|
|
||||||
Completion frameworks such as Vertico, Ivy, and Icomplete render
|
Completion frameworks such as Vertico, Ivy, and Icomplete render
|
||||||
candidates via overlay before-string/after-string properties. Without
|
candidates via overlay before-string/after-string properties. Without
|
||||||
this change VoiceOver cannot read overlay-based completion UIs.
|
this change VoiceOver cannot read overlay-based completion UIs.
|
||||||
|
|
||||||
* src/nsterm.m (ns_ax_face_is_selected): New static function; matches
|
|
||||||
'current', 'selected', 'selection' in face symbol names.
|
|
||||||
(ns_ax_selected_overlay_text): New function; scan overlay strings in
|
(ns_ax_selected_overlay_text): New function; scan overlay strings in
|
||||||
the window for a line with a selected face; return its text.
|
the window for a line with a selected face; return its text.
|
||||||
(ensureTextCache): Switch cache-validity counter from BUF_CHARS_MODIFF
|
(ensureTextCache): Switch cache-validity counter from BUF_CHARS_MODIFF
|
||||||
@@ -27,11 +25,11 @@ granularity_unknown when the cache is absent), so font-lock passes
|
|||||||
cannot trigger O(buffer-size) rebuilds via the notification path.
|
cannot trigger O(buffer-size) rebuilds via the notification path.
|
||||||
---
|
---
|
||||||
src/nsterm.h | 1 +
|
src/nsterm.h | 1 +
|
||||||
src/nsterm.m | 358 ++++++++++++++++++++++++++++++++++++++++++++-------
|
src/nsterm.m | 301 ++++++++++++++++++++++++++++++++++++++++++++-------
|
||||||
2 files changed, 316 insertions(+), 43 deletions(-)
|
2 files changed, 262 insertions(+), 40 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/nsterm.h b/src/nsterm.h
|
diff --git a/src/nsterm.h b/src/nsterm.h
|
||||||
index f245675513..a210ceba14 100644
|
index d9ae6efc2e..ff81675bb5 100644
|
||||||
--- a/src/nsterm.h
|
--- a/src/nsterm.h
|
||||||
+++ b/src/nsterm.h
|
+++ b/src/nsterm.h
|
||||||
@@ -510,6 +510,7 @@ typedef struct ns_ax_visible_run
|
@@ -510,6 +510,7 @@ typedef struct ns_ax_visible_run
|
||||||
@@ -43,41 +41,13 @@ index f245675513..a210ceba14 100644
|
|||||||
@property (nonatomic, assign) BOOL cachedMarkActive;
|
@property (nonatomic, assign) BOOL cachedMarkActive;
|
||||||
@property (nonatomic, copy) NSString *cachedCompletionAnnouncement;
|
@property (nonatomic, copy) NSString *cachedCompletionAnnouncement;
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index a0419bb5df..b9d3a0eb53 100644
|
index 705c3ece06..209b8a0a1d 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -7263,11 +7263,154 @@ Accessibility virtual elements (macOS / Cocoa only)
|
@@ -7276,11 +7276,126 @@ Accessibility virtual elements (macOS / Cocoa only)
|
||||||
|
|
||||||
/* ---- Helper: extract buffer text for accessibility ---- */
|
/* ---- Helper: extract buffer text for accessibility ---- */
|
||||||
|
|
||||||
+/* Return true if FACE is or contains a face symbol whose name
|
|
||||||
+ includes "current" or "selected", indicating a highlighted
|
|
||||||
+ completion candidate. Works for vertico-current,
|
|
||||||
+ icomplete-selected-match, ivy-current-match, etc. */
|
|
||||||
+static bool
|
|
||||||
+ns_ax_face_is_selected (Lisp_Object face)
|
|
||||||
+{
|
|
||||||
+ if (SYMBOLP (face) && !NILP (face))
|
|
||||||
+ {
|
|
||||||
+ const char *name = SSDATA (SYMBOL_NAME (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 since this runs only on overlay strings during
|
|
||||||
+ completion. */
|
|
||||||
+ 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;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Extract the currently selected candidate text from overlay display
|
+/* Extract the currently selected candidate text from overlay display
|
||||||
+ strings. Completion frameworks render candidates as overlay
|
+ strings. Completion frameworks render candidates as overlay
|
||||||
+ before-string/after-string and highlight the current candidate
|
+ before-string/after-string and highlight the current candidate
|
||||||
@@ -167,7 +137,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
+ Lisp_Object face
|
+ Lisp_Object face
|
||||||
+ = Fget_text_property (make_fixnum (line_starts[li]),
|
+ = Fget_text_property (make_fixnum (line_starts[li]),
|
||||||
+ Qface, str);
|
+ Qface, str);
|
||||||
+ if (ns_ax_face_is_selected (face))
|
+ if (ns_face_name_matches_selected_p (face))
|
||||||
+ {
|
+ {
|
||||||
+ Lisp_Object line
|
+ Lisp_Object line
|
||||||
+ = Fsubstring_no_properties (
|
+ = Fsubstring_no_properties (
|
||||||
@@ -202,25 +172,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
static NSString *
|
static NSString *
|
||||||
ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start,
|
ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start,
|
||||||
ns_ax_visible_run **out_runs, NSUInteger *out_nruns)
|
ns_ax_visible_run **out_runs, NSUInteger *out_nruns)
|
||||||
@@ -7340,7 +7483,7 @@ Accessibility virtual elements (macOS / Cocoa only)
|
@@ -7906,6 +8021,7 @@ @implementation EmacsAccessibilityBuffer
|
||||||
|
|
||||||
/* Extract this visible run's text. Use
|
|
||||||
Fbuffer_substring_no_properties which correctly handles the
|
|
||||||
- buffer gap — raw BUF_BYTE_ADDRESS reads across the gap would
|
|
||||||
+ buffer gap --- raw BUF_BYTE_ADDRESS reads across the gap would
|
|
||||||
include garbage bytes when the run spans the gap position. */
|
|
||||||
Lisp_Object lstr = Fbuffer_substring_no_properties (
|
|
||||||
make_fixnum (pos), make_fixnum (run_end));
|
|
||||||
@@ -7421,7 +7564,7 @@ Mode lines using icon fonts (e.g. nerd-font icons)
|
|
||||||
return NSZeroRect;
|
|
||||||
|
|
||||||
/* charpos_start and charpos_len are already in buffer charpos
|
|
||||||
- space — the caller maps AX string indices through
|
|
||||||
+ space --- the caller maps AX string indices through
|
|
||||||
charposForAccessibilityIndex which handles invisible text. */
|
|
||||||
ptrdiff_t cp_start = charpos_start;
|
|
||||||
ptrdiff_t cp_end = cp_start + charpos_len;
|
|
||||||
@@ -7896,6 +8039,7 @@ @implementation EmacsAccessibilityBuffer
|
|
||||||
@synthesize cachedOverlayModiff;
|
@synthesize cachedOverlayModiff;
|
||||||
@synthesize cachedTextStart;
|
@synthesize cachedTextStart;
|
||||||
@synthesize cachedModiff;
|
@synthesize cachedModiff;
|
||||||
@@ -228,39 +180,25 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
@synthesize cachedPoint;
|
@synthesize cachedPoint;
|
||||||
@synthesize cachedMarkActive;
|
@synthesize cachedMarkActive;
|
||||||
@synthesize cachedCompletionAnnouncement;
|
@synthesize cachedCompletionAnnouncement;
|
||||||
@@ -7993,7 +8137,7 @@ - (void)ensureTextCache
|
@@ -8016,20 +8132,33 @@ - (void)ensureTextCache
|
||||||
NSTRACE ("EmacsAccessibilityBuffer ensureTextCache");
|
|
||||||
/* This method is only called from the main thread (AX getters
|
|
||||||
dispatch_sync to main first). Reads of cachedText/cachedTextModiff
|
|
||||||
- below are therefore safe without @synchronized — only the
|
|
||||||
+ below are therefore safe without @synchronized --- only the
|
|
||||||
write section at the end needs synchronization to protect
|
|
||||||
against concurrent reads from AX server thread. */
|
|
||||||
eassert ([NSThread isMainThread]);
|
|
||||||
@@ -8005,25 +8149,38 @@ - (void)ensureTextCache
|
|
||||||
if (!b)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
- /* Use BUF_CHARS_MODIFF, not BUF_MODIFF, for cache validity.
|
/* Use BUF_MODIFF, not BUF_CHARS_MODIFF, for cache validity.
|
||||||
- BUF_MODIFF is bumped by every text-property change, including
|
+
|
||||||
- font-lock face applications on every redisplay. AX text contains
|
Fold/unfold commands (org-mode, outline-mode, hideshow-mode) change
|
||||||
- only characters, not face data, so property-only changes do not
|
text visibility by modifying the 'invisible text property via
|
||||||
- affect the cached value. Rebuilding the full buffer text on
|
- put-text-property or add-text-properties. These bump BUF_MODIFF
|
||||||
- each font-lock pass is O(buffer-size) per redisplay --- this
|
- but not BUF_CHARS_MODIFF. Using BUF_CHARS_MODIFF would serve stale
|
||||||
- causes progressive slowdown when scrolling through large files.
|
- AX text across fold/unfold, causing VoiceOver to read the wrong
|
||||||
- BUF_CHARS_MODIFF is bumped only on actual character insertions
|
- content after an org-cycle or similar command.
|
||||||
- and deletions, matching the semantic of "did the text change".
|
- ensureTextCache is called exclusively from AX getters at human
|
||||||
- This is the pattern used by WebKit and NSTextView.
|
- interaction speed (never from the redisplay notification path), so
|
||||||
|
- font-lock passes cause zero rebuild cost via the notification path.
|
||||||
- Do NOT track BUF_OVERLAY_MODIFF here --- overlay text is not
|
- Do NOT track BUF_OVERLAY_MODIFF here --- overlay text is not
|
||||||
- included in the cached AX text (it is handled separately via
|
- included in the cached AX text (it is handled separately via
|
||||||
- explicit announcements in postAccessibilityNotificationsForFrame).
|
- explicit announcements in postAccessibilityNotificationsForFrame).
|
||||||
- Including overlay_modiff would silently update cachedOverlayModiff
|
- Including overlay_modiff would silently update cachedOverlayModiff
|
||||||
- and prevent the notification dispatch from detecting changes. */
|
- and prevent the notification dispatch from detecting changes. */
|
||||||
- ptrdiff_t chars_modiff = BUF_CHARS_MODIFF (b);
|
|
||||||
+ /* Use BUF_MODIFF, not BUF_CHARS_MODIFF, for cache validity.
|
|
||||||
+
|
|
||||||
+ Fold/unfold commands (org-mode, outline-mode, hideshow-mode) change
|
|
||||||
+ text visibility by modifying the 'invisible text property via
|
|
||||||
+ `put-text-property' or `add-text-properties'. These bump BUF_MODIFF
|
+ `put-text-property' or `add-text-properties'. These bump BUF_MODIFF
|
||||||
+ but NOT BUF_CHARS_MODIFF, because no characters are inserted or
|
+ but NOT BUF_CHARS_MODIFF, because no characters are inserted or
|
||||||
+ deleted. Using only BUF_CHARS_MODIFF would serve stale AX text
|
+ deleted. Using only BUF_CHARS_MODIFF would serve stale AX text
|
||||||
@@ -285,128 +223,90 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
+ like hl-line-mode bump BUF_OVERLAY_MODIFF on every
|
+ like hl-line-mode bump BUF_OVERLAY_MODIFF on every
|
||||||
+ post-command-hook, yielding the same per-keystroke rebuild cost as
|
+ post-command-hook, yielding the same per-keystroke rebuild cost as
|
||||||
+ BUF_MODIFF, with none of its correctness guarantee. */
|
+ BUF_MODIFF, with none of its correctness guarantee. */
|
||||||
+ ptrdiff_t modiff = BUF_MODIFF (b);
|
ptrdiff_t modiff = BUF_MODIFF (b);
|
||||||
ptrdiff_t pt = BUF_PT (b);
|
ptrdiff_t pt = BUF_PT (b);
|
||||||
NSUInteger textLen = cachedText ? [cachedText length] : 0;
|
NSUInteger textLen = cachedText ? [cachedText length] : 0;
|
||||||
- if (cachedText && cachedTextModiff == chars_modiff
|
@@ -8061,9 +8190,8 @@ included in the cached AX text (it is handled separately via
|
||||||
+ if (cachedText && cachedTextModiff == modiff
|
|
||||||
&& cachedTextStart == BUF_BEGV (b)
|
|
||||||
&& pt >= cachedTextStart
|
|
||||||
&& (textLen == 0
|
|
||||||
@@ -8039,7 +8196,7 @@ included in the cached AX text (it is handled separately via
|
|
||||||
{
|
|
||||||
[cachedText release];
|
|
||||||
cachedText = [text retain];
|
|
||||||
- cachedTextModiff = chars_modiff;
|
|
||||||
+ cachedTextModiff = modiff;
|
|
||||||
cachedTextStart = start;
|
|
||||||
|
|
||||||
if (visibleRuns)
|
|
||||||
@@ -8051,9 +8208,9 @@ included in the cached AX text (it is handled separately via
|
|
||||||
Walk the cached text once, recording the start offset of each
|
Walk the cached text once, recording the start offset of each
|
||||||
line. Uses NSString lineRangeForRange: --- O(N) in the total
|
line. Uses NSString lineRangeForRange: --- O(N) in the total
|
||||||
text --- but this loop runs only on cache rebuild, which is
|
text --- but this loop runs only on cache rebuild, which is
|
||||||
- gated on BUF_CHARS_MODIFF: actual character insertions or
|
- gated on BUF_MODIFF. Font-lock passes trigger a rebuild only
|
||||||
- deletions. Font-lock (text property changes) does not trigger
|
- when called from AX getters (human interaction speed), never
|
||||||
- a rebuild, so the hot path (cursor movement, redisplay) never
|
- from the notification path. */
|
||||||
+ gated on BUF_MODIFF changes. Rebuilds happen when any buffer
|
+ gated on BUF_MODIFF changes, ensuring the line index always
|
||||||
+ modification occurs (including fold/unfold), ensuring the line
|
+ matches the currently visible text (including after fold/unfold). */
|
||||||
+ index always matches the currently visible text.
|
|
||||||
enters this code. */
|
|
||||||
if (lineStartOffsets)
|
if (lineStartOffsets)
|
||||||
xfree (lineStartOffsets);
|
xfree (lineStartOffsets);
|
||||||
@@ -8108,7 +8265,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
|
lineStartOffsets = NULL;
|
||||||
/* Binary search: runs are sorted by charpos (ascending). Find the
|
@@ -8579,26 +8707,26 @@ - (NSInteger)accessibilityInsertionPointLineNumber
|
||||||
run whose [charpos, charpos+length) range contains the target,
|
|
||||||
or the nearest run after an invisible gap. O(log n) instead of
|
|
||||||
- O(n) — matters for org-mode with many folded sections. */
|
|
||||||
+ O(n) --- matters for org-mode with many folded sections. */
|
|
||||||
NSUInteger lo = 0, hi = visibleRunCount;
|
|
||||||
while (lo < hi)
|
|
||||||
{
|
|
||||||
@@ -8157,10 +8314,10 @@ by run length (visible window), not total buffer size. */
|
|
||||||
|
|
||||||
/* Convert accessibility string index to buffer charpos.
|
|
||||||
Safe to call from any thread: uses only cachedText (NSString) and
|
|
||||||
- visibleRuns — no Lisp calls. */
|
|
||||||
+ visibleRuns --- no Lisp calls. */
|
|
||||||
- (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
|
|
||||||
{
|
|
||||||
- /* May be called from AX server thread — synchronize. */
|
|
||||||
+ /* May be called from AX server thread --- synchronize. */
|
|
||||||
@synchronized (self)
|
|
||||||
{
|
|
||||||
if (visibleRunCount == 0)
|
|
||||||
@@ -8202,7 +8359,7 @@ the slow path (composed character sequence walk), which is
|
|
||||||
return cp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- /* Past end — return last charpos. */
|
|
||||||
+ /* Past end --- return last charpos. */
|
|
||||||
if (lo > 0)
|
|
||||||
{
|
|
||||||
ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
|
|
||||||
@@ -8224,7 +8381,7 @@ the slow path (composed character sequence walk), which is
|
|
||||||
deadlocking the AX server thread. This is prevented by:
|
|
||||||
|
|
||||||
1. validWindow checks WINDOW_LIVE_P and BUFFERP before every
|
|
||||||
- Lisp access — the window and buffer are verified live.
|
|
||||||
+ Lisp access --- the window and buffer are verified live.
|
|
||||||
2. All dispatch_sync blocks run on the main thread where no
|
|
||||||
concurrent Lisp code can modify state between checks.
|
|
||||||
3. block_input prevents timer events and process output from
|
|
||||||
@@ -8570,6 +8727,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
|
|
||||||
return [self lineForAXIndex:point_idx];
|
return [self lineForAXIndex:point_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- (NSRange)accessibilityRangeForLine:(NSInteger)line
|
||||||
+- (NSString *)accessibilityStringForRange:(NSRange)range
|
+- (NSString *)accessibilityStringForRange:(NSRange)range
|
||||||
+{
|
{
|
||||||
+ if (![NSThread isMainThread])
|
if (![NSThread isMainThread])
|
||||||
+ {
|
{
|
||||||
|
- __block NSRange result;
|
||||||
+ __block NSString *result;
|
+ __block NSString *result;
|
||||||
+ dispatch_sync (dispatch_get_main_queue (), ^{
|
dispatch_sync (dispatch_get_main_queue (), ^{
|
||||||
|
- result = [self accessibilityRangeForLine:line];
|
||||||
+ result = [self accessibilityStringForRange:range];
|
+ result = [self accessibilityStringForRange:range];
|
||||||
+ });
|
});
|
||||||
+ return result;
|
return result;
|
||||||
+ }
|
}
|
||||||
+ [self ensureTextCache];
|
[self ensureTextCache];
|
||||||
|
- if (!cachedText || line < 0)
|
||||||
|
- return NSMakeRange (NSNotFound, 0);
|
||||||
|
-
|
||||||
|
- NSUInteger len = [cachedText length];
|
||||||
|
- if (len == 0)
|
||||||
|
- return (line == 0) ? NSMakeRange (0, 0)
|
||||||
|
- : NSMakeRange (NSNotFound, 0);
|
||||||
+ if (!cachedText || range.location + range.length > [cachedText length])
|
+ if (!cachedText || range.location + range.length > [cachedText length])
|
||||||
+ return @"";
|
+ return @"";
|
||||||
+ return [cachedText substringWithRange:range];
|
+ return [cachedText substringWithRange:range];
|
||||||
+}
|
+}
|
||||||
+
|
|
||||||
|
- return [self rangeForLine:(NSUInteger)line textLength:len];
|
||||||
+- (NSAttributedString *)accessibilityAttributedStringForRange:(NSRange)range
|
+- (NSAttributedString *)accessibilityAttributedStringForRange:(NSRange)range
|
||||||
+{
|
+{
|
||||||
+ NSString *str = [self accessibilityStringForRange:range];
|
+ NSString *str = [self accessibilityStringForRange:range];
|
||||||
+ return [[[NSAttributedString alloc] initWithString:str] autorelease];
|
+ return [[[NSAttributedString alloc] initWithString:str] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger)accessibilityLineForIndex:(NSInteger)index
|
||||||
|
@@ -8620,6 +8748,29 @@ - (NSInteger)accessibilityLineForIndex:(NSInteger)index
|
||||||
|
idx = [cachedText length];
|
||||||
|
|
||||||
|
return [self lineForAXIndex:idx];
|
||||||
|
+
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+- (NSInteger)accessibilityLineForIndex:(NSInteger)index
|
+- (NSRange)accessibilityRangeForLine:(NSInteger)line
|
||||||
+{
|
+{
|
||||||
+ if (![NSThread isMainThread])
|
+ if (![NSThread isMainThread])
|
||||||
+ {
|
+ {
|
||||||
+ __block NSInteger result;
|
+ __block NSRange result;
|
||||||
+ dispatch_sync (dispatch_get_main_queue (), ^{
|
+ dispatch_sync (dispatch_get_main_queue (), ^{
|
||||||
+ result = [self accessibilityLineForIndex:index];
|
+ result = [self accessibilityRangeForLine:line];
|
||||||
+ });
|
+ });
|
||||||
+ return result;
|
+ return result;
|
||||||
+ }
|
+ }
|
||||||
+ [self ensureTextCache];
|
+ [self ensureTextCache];
|
||||||
+ if (!cachedText || index < 0)
|
+ if (!cachedText || line < 0)
|
||||||
+ return 0;
|
+ return NSMakeRange (NSNotFound, 0);
|
||||||
+
|
+
|
||||||
+ NSUInteger idx = (NSUInteger) index;
|
+ NSUInteger len = [cachedText length];
|
||||||
+ if (idx > [cachedText length])
|
+ if (len == 0)
|
||||||
+ idx = [cachedText length];
|
+ return (line == 0) ? NSMakeRange (0, 0)
|
||||||
|
+ : NSMakeRange (NSNotFound, 0);
|
||||||
+
|
+
|
||||||
+ return [self lineForAXIndex:idx];
|
+ return [self rangeForLine:(NSUInteger)line textLength:len];
|
||||||
+
|
}
|
||||||
+}
|
|
||||||
+
|
- (NSRange)accessibilityRangeForIndex:(NSInteger)index
|
||||||
- (NSRange)accessibilityRangeForLine:(NSInteger)line
|
@@ -8822,7 +8973,7 @@ - (NSRect)accessibilityFrame
|
||||||
{
|
|
||||||
if (![NSThread isMainThread])
|
|
||||||
@@ -8792,7 +8993,7 @@ - (NSRect)accessibilityFrame
|
|
||||||
|
|
||||||
|
|
||||||
/* ===================================================================
|
/* ===================================================================
|
||||||
@@ -415,7 +315,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
|
|
||||||
These methods notify VoiceOver of text and selection changes.
|
These methods notify VoiceOver of text and selection changes.
|
||||||
Called from the redisplay cycle (postAccessibilityUpdates).
|
Called from the redisplay cycle (postAccessibilityUpdates).
|
||||||
@@ -8807,7 +9008,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
|
@@ -8837,7 +8988,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
|
||||||
if (point > self.cachedPoint
|
if (point > self.cachedPoint
|
||||||
&& point - self.cachedPoint == 1)
|
&& point - self.cachedPoint == 1)
|
||||||
{
|
{
|
||||||
@@ -424,7 +324,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
[self invalidateTextCache];
|
[self invalidateTextCache];
|
||||||
[self ensureTextCache];
|
[self ensureTextCache];
|
||||||
if (cachedText)
|
if (cachedText)
|
||||||
@@ -8826,7 +9027,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
|
@@ -8856,7 +9007,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
|
||||||
/* Update cachedPoint here so the selection-move branch does NOT
|
/* Update cachedPoint here so the selection-move branch does NOT
|
||||||
fire for point changes caused by edits. WebKit and Chromium
|
fire for point changes caused by edits. WebKit and Chromium
|
||||||
never send both ValueChanged and SelectedTextChanged for the
|
never send both ValueChanged and SelectedTextChanged for the
|
||||||
@@ -433,7 +333,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
self.cachedPoint = point;
|
self.cachedPoint = point;
|
||||||
|
|
||||||
NSDictionary *change = @{
|
NSDictionary *change = @{
|
||||||
@@ -9220,16 +9421,80 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
@@ -9250,16 +9401,80 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
||||||
BOOL markActive = !NILP (BVAR (b, mark_active));
|
BOOL markActive = !NILP (BVAR (b, mark_active));
|
||||||
|
|
||||||
/* --- Text changed (edit) --- */
|
/* --- Text changed (edit) --- */
|
||||||
@@ -518,7 +418,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
{
|
{
|
||||||
ptrdiff_t oldPoint = self.cachedPoint;
|
ptrdiff_t oldPoint = self.cachedPoint;
|
||||||
BOOL oldMarkActive = self.cachedMarkActive;
|
BOOL oldMarkActive = self.cachedMarkActive;
|
||||||
@@ -9247,8 +9512,15 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
@@ -9277,8 +9492,14 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
||||||
bool isCtrlNP = ns_ax_event_is_line_nav_key (&ctrlNP);
|
bool isCtrlNP = ns_ax_event_is_line_nav_key (&ctrlNP);
|
||||||
|
|
||||||
/* --- Granularity detection --- */
|
/* --- Granularity detection --- */
|
||||||
@@ -531,11 +431,10 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
+ to VoiceOver via the AX getter path (accessibilityValue etc.). */
|
+ to VoiceOver via the AX getter path (accessibilityValue etc.). */
|
||||||
NSInteger granularity = ns_ax_text_selection_granularity_unknown;
|
NSInteger granularity = ns_ax_text_selection_granularity_unknown;
|
||||||
- [self ensureTextCache];
|
- [self ensureTextCache];
|
||||||
+ BOOL singleLineMove = NO;
|
|
||||||
if (cachedText && oldPoint > 0)
|
if (cachedText && oldPoint > 0)
|
||||||
{
|
{
|
||||||
NSUInteger tlen = [cachedText length];
|
NSUInteger tlen = [cachedText length];
|
||||||
@@ -12408,7 +12680,7 @@ - (int) fullscreenState
|
@@ -12438,7 +12659,7 @@ - (int) fullscreenState
|
||||||
|
|
||||||
if (WINDOW_LEAF_P (w))
|
if (WINDOW_LEAF_P (w))
|
||||||
{
|
{
|
||||||
@@ -544,7 +443,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
EmacsAccessibilityBuffer *elem
|
EmacsAccessibilityBuffer *elem
|
||||||
= [existing objectForKey:[NSValue valueWithPointer:w]];
|
= [existing objectForKey:[NSValue valueWithPointer:w]];
|
||||||
if (!elem)
|
if (!elem)
|
||||||
@@ -12442,7 +12714,7 @@ - (int) fullscreenState
|
@@ -12472,7 +12693,7 @@ - (int) fullscreenState
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -553,7 +452,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
Lisp_Object child = w->contents;
|
Lisp_Object child = w->contents;
|
||||||
while (!NILP (child))
|
while (!NILP (child))
|
||||||
{
|
{
|
||||||
@@ -12554,7 +12826,7 @@ - (void)postAccessibilityUpdates
|
@@ -12584,7 +12805,7 @@ - (void)postAccessibilityUpdates
|
||||||
accessibilityUpdating = YES;
|
accessibilityUpdating = YES;
|
||||||
|
|
||||||
/* Detect window tree change (split, delete, new buffer). Compare
|
/* Detect window tree change (split, delete, new buffer). Compare
|
||||||
@@ -562,7 +461,7 @@ index a0419bb5df..b9d3a0eb53 100644
|
|||||||
Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe);
|
Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe);
|
||||||
if (!EQ (curRoot, lastRootWindow))
|
if (!EQ (curRoot, lastRootWindow))
|
||||||
{
|
{
|
||||||
@@ -12563,12 +12835,12 @@ - (void)postAccessibilityUpdates
|
@@ -12593,12 +12814,12 @@ - (void)postAccessibilityUpdates
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If tree is stale, rebuild FIRST so we don't iterate freed
|
/* If tree is stale, rebuild FIRST so we don't iterate freed
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
From b54ed57b93cb47250695106021d6e96030ffdd59 Mon Sep 17 00:00:00 2001
|
From a6b1def9a83e23cc0e3325d795ac22b46eb16a5d Mon Sep 17 00:00:00 2001
|
||||||
From: Martin Sukany <martin@sukany.cz>
|
From: Martin Sukany <martin@sukany.cz>
|
||||||
Date: Mon, 2 Mar 2026 18:49:13 +0100
|
Date: Wed, 4 Mar 2026 15:23:56 +0100
|
||||||
Subject: [PATCH 9/9] ns: announce child frame completion candidates for
|
Subject: [PATCH 8/8] ns: announce child frame completions to VoiceOver
|
||||||
VoiceOver
|
|
||||||
|
|
||||||
Child frame popups (Corfu, Company-mode child frames) render completion
|
Child frame popups (Corfu, Company-mode child frames) render completion
|
||||||
candidates in a separate frame whose buffer is not accessible via the
|
candidates in a separate frame whose buffer is not accessible via the
|
||||||
@@ -35,10 +34,10 @@ echo area announcements and VoiceOver rotor cursor synchronization.
|
|||||||
Remove Zoom section (covered by patch 0000). Fix dangling paragraph.
|
Remove Zoom section (covered by patch 0000). Fix dangling paragraph.
|
||||||
---
|
---
|
||||||
doc/emacs/macos.texi | 13 +-
|
doc/emacs/macos.texi | 13 +-
|
||||||
etc/NEWS | 25 +-
|
etc/NEWS | 22 +-
|
||||||
src/nsterm.h | 21 ++
|
src/nsterm.h | 21 ++
|
||||||
src/nsterm.m | 560 +++++++++++++++++++++++++++++++++++++------
|
src/nsterm.m | 562 +++++++++++++++++++++++++++++++++++++------
|
||||||
4 files changed, 528 insertions(+), 91 deletions(-)
|
4 files changed, 528 insertions(+), 90 deletions(-)
|
||||||
|
|
||||||
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
|
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
|
||||||
index 72ac3a9aa9..cf5ed0ff28 100644
|
index 72ac3a9aa9..cf5ed0ff28 100644
|
||||||
@@ -65,24 +64,20 @@ index 72ac3a9aa9..cf5ed0ff28 100644
|
|||||||
@vindex ns-accessibility-enabled
|
@vindex ns-accessibility-enabled
|
||||||
To disable the accessibility interface entirely (for instance, to
|
To disable the accessibility interface entirely (for instance, to
|
||||||
diff --git a/etc/NEWS b/etc/NEWS
|
diff --git a/etc/NEWS b/etc/NEWS
|
||||||
index 7f917f93b2..bbec21b635 100644
|
index 7f917f93b2..c6bb4cc5ad 100644
|
||||||
--- a/etc/NEWS
|
--- a/etc/NEWS
|
||||||
+++ b/etc/NEWS
|
+++ b/etc/NEWS
|
||||||
@@ -88,10 +88,9 @@ When macOS Zoom is enabled (System Settings, Accessibility, Zoom,
|
@@ -88,8 +88,7 @@ When macOS Zoom is enabled (System Settings, Accessibility, Zoom,
|
||||||
Follow keyboard focus), Emacs informs Zoom of the text cursor position
|
Follow keyboard focus), Emacs informs Zoom of the text cursor position
|
||||||
after every cursor redraw via 'UAZoomChangeFocus'. The zoomed viewport
|
after every cursor redraw via 'UAZoomChangeFocus'. The zoomed viewport
|
||||||
automatically tracks the insertion point across window splits and
|
automatically tracks the insertion point across window splits and
|
||||||
-switches. Completion frameworks (Vertico, Icomplete, Ivy for overlay
|
-switches. Completion frameworks (Vertico, Icomplete, Ivy for overlay
|
||||||
-candidates; Corfu, Company-box for child frame popups) are also
|
-candidates; Corfu, Company-box for child frame popups) are also
|
||||||
-tracked: Zoom follows the selected candidate rather than the text
|
+switches. Overlay-based and child-frame completion frameworks are also
|
||||||
-cursor during completion.
|
tracked: Zoom follows the selected candidate rather than the text
|
||||||
+switches. Overlay-based completion frameworks and child-frame popup completions
|
cursor during completion.
|
||||||
+are also tracked: Zoom follows the selected candidate rather than the
|
|
||||||
+text cursor during completion.
|
|
||||||
|
|
||||||
+++
|
@@ -4385,16 +4384,19 @@ allowing Emacs users access to speech recognition utilities.
|
||||||
** 'line-spacing' now supports specifying spacing above the line.
|
|
||||||
@@ -4385,16 +4384,20 @@ allowing Emacs users access to speech recognition utilities.
|
|
||||||
Note: Accepting this permission allows the use of system APIs, which may
|
Note: Accepting this permission allows the use of system APIs, which may
|
||||||
send user data to Apple's speech recognition servers.
|
send user data to Apple's speech recognition servers.
|
||||||
|
|
||||||
@@ -90,28 +85,28 @@ index 7f917f93b2..bbec21b635 100644
|
|||||||
++++
|
++++
|
||||||
** VoiceOver accessibility support on macOS.
|
** VoiceOver accessibility support on macOS.
|
||||||
Emacs now exposes buffer content, cursor position, and interactive
|
Emacs now exposes buffer content, cursor position, and interactive
|
||||||
elements to the macOS accessibility subsystem (VoiceOver). This
|
-elements to the macOS accessibility subsystem (VoiceOver). This
|
||||||
-includes AXBoundsForRange for macOS Zoom cursor tracking, line and
|
-includes AXBoundsForRange for macOS Zoom cursor tracking, line and
|
||||||
-word navigation announcements, Tab-navigable interactive spans
|
-word navigation announcements, Tab-navigable interactive spans
|
||||||
-(buttons, links, completion candidates), and completion announcements
|
-(buttons, links, completion candidates), and completion announcements
|
||||||
-for the *Completions* buffer. The implementation uses a virtual
|
-for the *Completions* buffer. The implementation uses a virtual
|
||||||
-accessibility tree with per-window elements, hybrid SelectedTextChanged
|
-accessibility tree with per-window elements, hybrid SelectedTextChanged
|
||||||
-and AnnouncementRequested notifications, and thread-safe text caching.
|
-and AnnouncementRequested notifications, and thread-safe text caching.
|
||||||
+includes:
|
+elements to the macOS accessibility subsystem (VoiceOver). Standard
|
||||||
+- Line and word navigation announcements via standard movement keys.
|
+navigation keys produce speech feedback: arrow keys read characters and
|
||||||
+- Echo area messages (e.g., "Wrote file", "Git finished") announced
|
+lines, 'M-f'/'M-b' announce words, and shift-modified movement reports
|
||||||
+ automatically as they appear, without user interaction.
|
+selected text. Echo area messages (e.g., "Wrote file", "Git finished")
|
||||||
+- VoiceOver rotor cursor synchronization after large programmatic
|
+are announced automatically without user interaction. The VoiceOver
|
||||||
+ jumps (]], M-<, xref, imenu, etc.).
|
+rotor cursor stays synchronized after large programmatic jumps such as
|
||||||
+- Tab-navigable interactive spans (buttons, links, completion
|
+xref, imenu, or Org heading navigation. Pressing 'TAB' navigates
|
||||||
+ candidates) within a buffer.
|
+interactive spans (buttons, links, completion candidates) within a
|
||||||
+- Completion announcements for the *Completions* buffer, overlay
|
+buffer. Completion frameworks that render via overlays or child frames
|
||||||
+ completion UIs, and child-frame completion popup UIs.
|
+(Vertico, Ivy, Corfu, etc.) announce the selected candidate.
|
||||||
Set 'ns-accessibility-enabled' to nil to disable the accessibility
|
Set 'ns-accessibility-enabled' to nil to disable the accessibility
|
||||||
interface and eliminate the associated overhead.
|
interface and eliminate the associated overhead.
|
||||||
|
|
||||||
diff --git a/src/nsterm.h b/src/nsterm.h
|
diff --git a/src/nsterm.h b/src/nsterm.h
|
||||||
index a210ceba14..2edd7cd6e0 100644
|
index ff81675bb5..9ee6c86f18 100644
|
||||||
--- a/src/nsterm.h
|
--- a/src/nsterm.h
|
||||||
+++ b/src/nsterm.h
|
+++ b/src/nsterm.h
|
||||||
@@ -504,9 +504,20 @@ typedef struct ns_ax_visible_run
|
@@ -504,9 +504,20 @@ typedef struct ns_ax_visible_run
|
||||||
@@ -160,10 +155,10 @@ index a210ceba14..2edd7cd6e0 100644
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||||
index b9d3a0eb53..5e48710930 100644
|
index 209b8a0a1d..13696786ab 100644
|
||||||
--- a/src/nsterm.m
|
--- a/src/nsterm.m
|
||||||
+++ b/src/nsterm.m
|
+++ b/src/nsterm.m
|
||||||
@@ -1275,6 +1275,12 @@ If a completion candidate is selected (overlay or child frame),
|
@@ -1287,6 +1287,12 @@ If a completion candidate is selected (overlay or child frame),
|
||||||
static void
|
static void
|
||||||
ns_zoom_track_completion (struct frame *f, EmacsView *view)
|
ns_zoom_track_completion (struct frame *f, EmacsView *view)
|
||||||
{
|
{
|
||||||
@@ -176,7 +171,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
if (!ns_zoom_enabled_p ())
|
if (!ns_zoom_enabled_p ())
|
||||||
return;
|
return;
|
||||||
if (!WINDOWP (f->selected_window))
|
if (!WINDOWP (f->selected_window))
|
||||||
@@ -7407,6 +7413,117 @@ visual line index for Zoom (skip whitespace-only lines
|
@@ -7392,6 +7398,117 @@ visual line index for Zoom (skip whitespace-only lines
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -223,17 +218,17 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
+ The data pointer is used only in this loop, before Lisp calls. */
|
+ The data pointer is used only in this loop, before Lisp calls. */
|
||||||
+ const unsigned char *data = SDATA (str);
|
+ const unsigned char *data = SDATA (str);
|
||||||
+ ptrdiff_t byte_len = SBYTES (str);
|
+ ptrdiff_t byte_len = SBYTES (str);
|
||||||
+ /* 128 lines is a safe upper bound for a completion child frame.
|
+ /* 512 lines is a safe upper bound for a completion child frame.
|
||||||
+ The caller rejects buffers larger than 10,000 characters
|
+ The caller rejects buffers larger than 10,000 characters
|
||||||
+ (BUF_ZV(b) - BUF_BEGV(b) > 10000 guard in announceChildFrameCompletion),
|
+ (BUF_ZV(b) - BUF_BEGV(b) > 10000 guard in announceChildFrameCompletion),
|
||||||
+ so the worst case is ~10 KB / 1 byte per line < 128. If a future
|
+ so the worst case is ~10 KB / 1 byte per line < 512. If a future
|
||||||
+ caller removes that guard, lines beyond 128 are silently skipped; */
|
+ caller removes that guard, lines beyond 512 are silently skipped; */
|
||||||
+ ptrdiff_t line_starts[128];
|
+ ptrdiff_t line_starts[512];
|
||||||
+ ptrdiff_t line_ends[128];
|
+ ptrdiff_t line_ends[512];
|
||||||
+ int nlines = 0;
|
+ int nlines = 0;
|
||||||
+ ptrdiff_t char_pos = 0, byte_pos = 0, lstart = 0;
|
+ ptrdiff_t char_pos = 0, byte_pos = 0, lstart = 0;
|
||||||
+
|
+
|
||||||
+ while (byte_pos < byte_len && nlines < 128)
|
+ while (byte_pos < byte_len && nlines < 512)
|
||||||
+ {
|
+ {
|
||||||
+ if (data[byte_pos] == '\n')
|
+ if (data[byte_pos] == '\n')
|
||||||
+ {
|
+ {
|
||||||
@@ -251,7 +246,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
+ byte_pos++;
|
+ byte_pos++;
|
||||||
+ char_pos++;
|
+ char_pos++;
|
||||||
+ }
|
+ }
|
||||||
+ if (char_pos > lstart && nlines < 128)
|
+ if (char_pos > lstart && nlines < 512)
|
||||||
+ {
|
+ {
|
||||||
+ line_starts[nlines] = lstart;
|
+ line_starts[nlines] = lstart;
|
||||||
+ line_ends[nlines] = char_pos;
|
+ line_ends[nlines] = char_pos;
|
||||||
@@ -267,7 +262,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
+ Lisp_Object face
|
+ Lisp_Object face
|
||||||
+ = Fget_char_property (make_fixnum (buf_pos), Qface, buf_obj);
|
+ = Fget_char_property (make_fixnum (buf_pos), Qface, buf_obj);
|
||||||
+
|
+
|
||||||
+ if (ns_ax_face_is_selected (face))
|
+ if (ns_face_name_matches_selected_p (face))
|
||||||
+ {
|
+ {
|
||||||
+ Lisp_Object line
|
+ Lisp_Object line
|
||||||
+ = Fsubstring_no_properties (str,
|
+ = Fsubstring_no_properties (str,
|
||||||
@@ -294,7 +289,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
/* Build accessibility text for window W, skipping invisible text.
|
/* Build accessibility text for window W, skipping invisible text.
|
||||||
Populates *OUT_START with the buffer start charpos.
|
Populates *OUT_START with the buffer start charpos.
|
||||||
Populates *OUT_RUNS with an array of visible runs and *OUT_NRUNS
|
Populates *OUT_RUNS with an array of visible runs and *OUT_NRUNS
|
||||||
@@ -7440,9 +7557,13 @@ visual line index for Zoom (skip whitespace-only lines
|
@@ -7425,9 +7542,13 @@ visual line index for Zoom (skip whitespace-only lines
|
||||||
return @"";
|
return @"";
|
||||||
|
|
||||||
specpdl_ref count = SPECPDL_INDEX ();
|
specpdl_ref count = SPECPDL_INDEX ();
|
||||||
@@ -309,7 +304,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
if (b != current_buffer)
|
if (b != current_buffer)
|
||||||
set_buffer_internal_1 (b);
|
set_buffer_internal_1 (b);
|
||||||
|
|
||||||
@@ -8609,6 +8730,11 @@ - (void)setAccessibilitySelectedTextRange:(NSRange)range
|
@@ -8589,6 +8710,11 @@ - (void)setAccessibilitySelectedTextRange:(NSRange)range
|
||||||
|
|
||||||
[self ensureTextCache];
|
[self ensureTextCache];
|
||||||
|
|
||||||
@@ -321,7 +316,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
specpdl_ref count = SPECPDL_INDEX ();
|
specpdl_ref count = SPECPDL_INDEX ();
|
||||||
record_unwind_current_buffer ();
|
record_unwind_current_buffer ();
|
||||||
/* Ensure block_input is always matched by unblock_input even if
|
/* Ensure block_input is always matched by unblock_input even if
|
||||||
@@ -9057,20 +9183,38 @@ - (void)postFocusedCursorNotification:(ptrdiff_t)point
|
@@ -9037,20 +9163,38 @@ - (void)postFocusedCursorNotification:(ptrdiff_t)point
|
||||||
&& granularity
|
&& granularity
|
||||||
== ns_ax_text_selection_granularity_character);
|
== ns_ax_text_selection_granularity_character);
|
||||||
|
|
||||||
@@ -370,7 +365,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
ns_ax_post_notification_with_info (
|
ns_ax_post_notification_with_info (
|
||||||
self,
|
self,
|
||||||
NSAccessibilitySelectedTextChangedNotification,
|
NSAccessibilitySelectedTextChangedNotification,
|
||||||
@@ -9170,12 +9314,17 @@ user expectation ("w" jumps to next word and reads it). */
|
@@ -9150,12 +9294,17 @@ user expectation ("w" jumps to next word and reads it). */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +388,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
if (cachedText
|
if (cachedText
|
||||||
&& granularity == ns_ax_text_selection_granularity_line)
|
&& granularity == ns_ax_text_selection_granularity_line)
|
||||||
{
|
{
|
||||||
@@ -9240,6 +9389,11 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
|
@@ -9220,6 +9369,11 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
|
||||||
|
|
||||||
block_input ();
|
block_input ();
|
||||||
specpdl_ref count2 = SPECPDL_INDEX ();
|
specpdl_ref count2 = SPECPDL_INDEX ();
|
||||||
@@ -405,7 +400,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
record_unwind_protect_void (unblock_input);
|
record_unwind_protect_void (unblock_input);
|
||||||
record_unwind_current_buffer ();
|
record_unwind_current_buffer ();
|
||||||
if (b != current_buffer)
|
if (b != current_buffer)
|
||||||
@@ -9416,12 +9570,29 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
@@ -9396,12 +9550,29 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
||||||
if (!b)
|
if (!b)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -413,7 +408,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
+ postEchoAreaAnnouncementIfNeeded (called from postAccessibilityUpdates
|
+ postEchoAreaAnnouncementIfNeeded (called from postAccessibilityUpdates
|
||||||
+ before this per-element loop) so that they are never lost to a
|
+ before this per-element loop) so that they are never lost to a
|
||||||
+ concurrent tree rebuild. For the inactive minibuffer (minibuf_level
|
+ concurrent tree rebuild. For the inactive minibuffer (minibuf_level
|
||||||
+ == 0), skip normal cursor and completion processing — there is no
|
+ == 0), skip normal cursor and completion processing --- there is no
|
||||||
+ meaningful cursor to track. */
|
+ meaningful cursor to track. */
|
||||||
+ if (MINI_WINDOW_P (w) && minibuf_level == 0)
|
+ if (MINI_WINDOW_P (w) && minibuf_level == 0)
|
||||||
+ return;
|
+ return;
|
||||||
@@ -435,7 +430,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
if (modiff != self.cachedModiff)
|
if (modiff != self.cachedModiff)
|
||||||
{
|
{
|
||||||
self.cachedModiff = modiff;
|
self.cachedModiff = modiff;
|
||||||
@@ -9435,6 +9606,7 @@ Text property changes (e.g. face updates from
|
@@ -9415,6 +9586,7 @@ Text property changes (e.g. face updates from
|
||||||
{
|
{
|
||||||
self.cachedCharsModiff = chars_modiff;
|
self.cachedCharsModiff = chars_modiff;
|
||||||
[self postTextChangedNotification:point];
|
[self postTextChangedNotification:point];
|
||||||
@@ -443,7 +438,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9457,37 +9629,44 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
|
@@ -9437,41 +9609,48 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
|
||||||
displayed in the minibuffer. In normal editing buffers,
|
displayed in the minibuffer. In normal editing buffers,
|
||||||
font-lock and other modes change BUF_OVERLAY_MODIFF on
|
font-lock and other modes change BUF_OVERLAY_MODIFF on
|
||||||
every redisplay, triggering O(overlays) work per keystroke.
|
every redisplay, triggering O(overlays) work per keystroke.
|
||||||
@@ -457,67 +452,44 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
+ echo produced by postTextChangedNotification, making typed
|
+ echo produced by postTextChangedNotification, making typed
|
||||||
+ characters inaudible. VoiceOver should read the overlay
|
+ characters inaudible. VoiceOver should read the overlay
|
||||||
+ candidate only when the user navigates (C-n/C-p), not types. */
|
+ candidate only when the user navigates (C-n/C-p), not types. */
|
||||||
+ if (!MINI_WINDOW_P (w) || didTextChange)
|
+ if (MINI_WINDOW_P (w) && !didTextChange)
|
||||||
+ goto skip_overlay_scan;
|
|
||||||
+
|
|
||||||
+ int selected_line = -1;
|
|
||||||
+ NSString *candidate
|
|
||||||
+ = ns_ax_selected_overlay_text (b, BUF_BEGV (b), BUF_ZV (b),
|
|
||||||
+ &selected_line);
|
|
||||||
+ if (candidate)
|
|
||||||
{
|
{
|
||||||
- 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)
|
||||||
+ /* Deduplicate: only announce when the candidate changed. */
|
|
||||||
+ if (![candidate isEqualToString:
|
|
||||||
+ self.cachedCompletionAnnouncement])
|
|
||||||
{
|
{
|
||||||
- /* Deduplicate: only announce when the candidate changed. */
|
/* Deduplicate: only announce when the candidate changed. */
|
||||||
- if (![candidate isEqualToString:
|
if (![candidate isEqualToString:
|
||||||
- self.cachedCompletionAnnouncement])
|
self.cachedCompletionAnnouncement])
|
||||||
- {
|
{
|
||||||
- self.cachedCompletionAnnouncement = candidate;
|
self.cachedCompletionAnnouncement = candidate;
|
||||||
-
|
|
||||||
- /* Announce the candidate text directly via NSApp.
|
/* Announce the candidate text directly via NSApp.
|
||||||
- Do NOT post SelectedTextChanged --- that would cause
|
Do NOT post SelectedTextChanged --- that would cause
|
||||||
- VoiceOver to read the AX text at the cursor position
|
VoiceOver to read the AX text at the cursor position
|
||||||
- (the minibuffer input line), not the overlay candidate.
|
(the minibuffer input line), not the overlay candidate.
|
||||||
- AnnouncementRequested with High priority interrupts
|
AnnouncementRequested with High priority interrupts
|
||||||
- any current speech and announces our text. */
|
any current speech and announces our text. */
|
||||||
- NSDictionary *annInfo = @{
|
NSDictionary *annInfo = @{
|
||||||
- NSAccessibilityAnnouncementKey: candidate,
|
NSAccessibilityAnnouncementKey: candidate,
|
||||||
- NSAccessibilityPriorityKey:
|
NSAccessibilityPriorityKey:
|
||||||
- @(NSAccessibilityPriorityHigh)
|
@(NSAccessibilityPriorityHigh)
|
||||||
- };
|
};
|
||||||
- ns_ax_post_notification_with_info (
|
ns_ax_post_notification_with_info (
|
||||||
- NSApp,
|
NSApp,
|
||||||
- NSAccessibilityAnnouncementRequestedNotification,
|
NSAccessibilityAnnouncementRequestedNotification,
|
||||||
- annInfo);
|
annInfo);
|
||||||
- }
|
|
||||||
+ self.cachedCompletionAnnouncement = candidate;
|
|
||||||
+
|
|
||||||
+ /* Announce the candidate text directly via NSApp.
|
|
||||||
+ Do NOT post SelectedTextChanged --- that would cause
|
|
||||||
+ VoiceOver to read the AX text at the cursor position
|
|
||||||
+ (the minibuffer input line), not the overlay candidate.
|
|
||||||
+ AnnouncementRequested with High priority interrupts
|
|
||||||
+ any current speech and announces our text. */
|
|
||||||
+ NSDictionary *annInfo = @{
|
|
||||||
+ NSAccessibilityAnnouncementKey: candidate,
|
|
||||||
+ NSAccessibilityPriorityKey:
|
|
||||||
+ @(NSAccessibilityPriorityHigh)
|
|
||||||
+ };
|
|
||||||
+ ns_ax_post_notification_with_info (
|
|
||||||
+ NSApp,
|
|
||||||
+ NSAccessibilityAnnouncementRequestedNotification,
|
|
||||||
+ annInfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9501,7 +9680,18 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
|
}
|
||||||
|
|
||||||
|
/* --- Cursor moved or selection changed ---
|
||||||
|
Independent check from the overlay branch above. */
|
||||||
|
if (point != self.cachedPoint || markActive != self.cachedMarkActive)
|
||||||
|
@@ -9481,7 +9661,18 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property
|
||||||
self.cachedPoint = point;
|
self.cachedPoint = point;
|
||||||
self.cachedMarkActive = markActive;
|
self.cachedMarkActive = markActive;
|
||||||
|
|
||||||
@@ -537,7 +509,15 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
NSInteger direction = ns_ax_text_selection_direction_discontiguous;
|
NSInteger direction = ns_ax_text_selection_direction_discontiguous;
|
||||||
if (point > oldPoint)
|
if (point > oldPoint)
|
||||||
direction = ns_ax_text_selection_direction_next;
|
direction = ns_ax_text_selection_direction_next;
|
||||||
@@ -9534,7 +9724,18 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */
|
@@ -9500,6 +9691,7 @@ granularity hint (defaulting to unknown), which causes VoiceOver
|
||||||
|
to make its own determination. Fresh text is always available
|
||||||
|
to VoiceOver via the AX getter path (accessibilityValue etc.). */
|
||||||
|
NSInteger granularity = ns_ax_text_selection_granularity_unknown;
|
||||||
|
+ BOOL singleLineMove = NO;
|
||||||
|
if (cachedText && oldPoint > 0)
|
||||||
|
{
|
||||||
|
NSUInteger tlen = [cachedText length];
|
||||||
|
@@ -9513,7 +9705,18 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */
|
||||||
NSRange newLine = [cachedText lineRangeForRange:
|
NSRange newLine = [cachedText lineRangeForRange:
|
||||||
NSMakeRange (newIdx, 0)];
|
NSMakeRange (newIdx, 0)];
|
||||||
if (oldLine.location != newLine.location)
|
if (oldLine.location != newLine.location)
|
||||||
@@ -557,7 +537,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSUInteger dist = (newIdx > oldIdx
|
NSUInteger dist = (newIdx > oldIdx
|
||||||
@@ -9556,38 +9757,23 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */
|
@@ -9535,38 +9738,23 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */
|
||||||
granularity = ns_ax_text_selection_granularity_line;
|
granularity = ns_ax_text_selection_granularity_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,7 +589,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
{
|
{
|
||||||
NSWindow *win = [self.emacsView window];
|
NSWindow *win = [self.emacsView window];
|
||||||
if (win)
|
if (win)
|
||||||
@@ -9746,6 +9932,13 @@ - (NSRect)accessibilityFrame
|
@@ -9725,6 +9913,13 @@ - (NSRect)accessibilityFrame
|
||||||
if (vis_start >= vis_end)
|
if (vis_start >= vis_end)
|
||||||
return @[];
|
return @[];
|
||||||
|
|
||||||
@@ -623,7 +603,7 @@ index b9d3a0eb53..5e48710930 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);
|
||||||
@@ -10053,6 +10246,10 @@ - (void)dealloc
|
@@ -10032,6 +10227,10 @@ - (void)dealloc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[accessibilityElements release];
|
[accessibilityElements release];
|
||||||
@@ -634,7 +614,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
[[self menu] release];
|
[[self menu] release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@@ -11502,6 +11699,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
|
@@ -11481,6 +11680,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
|
||||||
|
|
||||||
windowClosing = NO;
|
windowClosing = NO;
|
||||||
processingCompose = NO;
|
processingCompose = NO;
|
||||||
@@ -644,7 +624,7 @@ index b9d3a0eb53..5e48710930 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;
|
||||||
@@ -12810,6 +13010,156 @@ - (id)accessibilityFocusedUIElement
|
@@ -12789,6 +12991,155 @@ - (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. */
|
||||||
@@ -712,7 +692,6 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
+ in the minibuffer. */
|
+ in the minibuffer. */
|
||||||
+- (void)announceChildFrameCompletion
|
+- (void)announceChildFrameCompletion
|
||||||
+{
|
+{
|
||||||
+
|
|
||||||
+ /* Validate frame state --- child frames may be partially
|
+ /* Validate frame state --- child frames may be partially
|
||||||
+ initialized during creation. */
|
+ initialized during creation. */
|
||||||
+ if (!WINDOWP (emacsframe->selected_window))
|
+ if (!WINDOWP (emacsframe->selected_window))
|
||||||
@@ -801,7 +780,7 @@ index b9d3a0eb53..5e48710930 100644
|
|||||||
- (void)postAccessibilityUpdates
|
- (void)postAccessibilityUpdates
|
||||||
{
|
{
|
||||||
NSTRACE ("[EmacsView postAccessibilityUpdates]");
|
NSTRACE ("[EmacsView postAccessibilityUpdates]");
|
||||||
@@ -12820,11 +13170,69 @@ - (void)postAccessibilityUpdates
|
@@ -12799,11 +13151,69 @@ - (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
|
||||||
Reference in New Issue
Block a user