Commit Graph

174 Commits

Author SHA1 Message Date
0110670734 patches: fix broken function insertion (build error) 2026-02-27 11:06:14 +01:00
f306599d94 patches: fix completion announcement (CONSP completion--string, focused+unfocused paths) 2026-02-27 11:01:22 +01:00
c138bdc6d5 patches: remove accessibilityChildren override (C-n/C-p line nav regression fix) 2026-02-27 10:47:54 +01:00
5f08e0a315 patches: fix completion span boundary (completion--string vs mouse-face) 2026-02-27 10:42:31 +01:00
23102444d4 patches: fix build errors (Fplist_get arity, MRC weak, duplicate decl) 2026-02-27 10:31:02 +01:00
92ef24332f patches: add EmacsAccessibilityInteractiveSpan (VoiceOver Tab nav, buttons, links, completions) 2026-02-27 10:26:29 +01:00
7a0e7722f7 patches: fix Tab navigation in completion buffer (probe order + Tab detection) 2026-02-27 10:10:39 +01:00
1245253e15 patches: fix B1 (live window ref), B2 (matrix guard), B3 (invisibility-spec), H1 (thread safety), H4 (main thread assert) 2026-02-27 09:57:10 +01:00
081d1c01e7 patches: restore postAccessibilityUpdates in ns_update_end (VoiceOver broken after rebase) 2026-02-27 09:39:42 +01:00
d11aa168b9 patches: fix Vreal_this_command linker error, squash into single patch 2026-02-27 07:43:13 +01:00
f37e06b00f patches: rebase on upstream f0dbe25 + fix NSRange return type 2026-02-27 07:38:18 +01:00
7419d9b0e4 patches: regenerate from actual emacs repo (fix src/ path prefix) 2026-02-27 07:31:44 +01:00
368f9600df patches: fix NSRange return type bug in accessibilitySelectedTextRange 2026-02-27 07:29:56 +01:00
97776b5141 Fix patch after 3-reviewer pipeline review
- BLOCKER: real_this_command → Vreal_this_command (DEFVAR_LISP uses V prefix)
- Thread safety: setAccessibilitySelectedTextRange dispatches to main thread
- Defensive: 7 new BUFFERP(w->contents) guards before XBUFFER calls

Reviewed by: symbol checker, logic/memory reviewer, ABI/build reviewer
Verified: git apply --check OK, zero real_this_command refs, dispatch_async present
2026-02-26 22:27:25 +01:00
3c0a68cfb9 Fix patch: adjust subsequent hunk offsets after 2-line removal 2026-02-26 21:52:48 +01:00
Martin Sukany
9a08f01066 removed 2026-02-26 21:51:50 +01:00
35a5326c18 Fix corrupt patch: correct hunk line counts after extern removal 2026-02-26 21:50:23 +01:00
220e90144f Fix build errors in Zoom/VoiceOver patch
- Remove 'extern Lisp_Object last_command_event' - last_command_event
  is a macro in globals.h (expands to globals.f_last_command_event),
  so an extern declaration conflicts with the existing
  'extern struct emacs_globals globals'
- Replace invalid C escape sequences '\C-n' and '\C-p' with
  ('n' & 0x1f) and ('p' & 0x1f) respectively
2026-02-26 21:43:04 +01:00
3bad798541 patches: fix v16.4 build errors (extern redecl + invalid C-n/C-p escape) 2026-02-26 21:37:41 +01:00
7c01587079 patches: isolate C-n/C-p keypath from arrow navigation 2026-02-26 18:41:35 +01:00
059ee5a0ea patches: target C-n/C-p vs arrow VoiceOver line-read mismatch 2026-02-26 18:37:06 +01:00
1b42d553a2 patches: completion candidate-aware VoiceOver announce fix 2026-02-26 18:25:04 +01:00
74b9691856 patches: fix AX enum mapping + completion announcement source 2026-02-26 18:06:14 +01:00
b3a6141831 patches: robust AX/VoiceOver fix after full audit pipeline 2026-02-26 17:49:56 +01:00
8720a43d04 patches: fix paths to src/nsterm.{m,h} 2026-02-26 17:32:31 +01:00
8ae3f0b367 patches: update VoiceOver patch (v15.9 candidate) 2026-02-26 17:30:21 +01:00
fa4748eb4c voiceover: refresh ns accessibility patch to v15.8 2026-02-26 17:02:49 +01:00
25e2a21245 v15.7: fix buffer gap corruption in visible text extraction
Root cause: ns_ax_buffer_text used BUF_BYTE_ADDRESS + raw pointer
read which crosses the buffer gap when visible runs span it. The gap
follows point, so completion cycling and dired navigation reliably
trigger corruption — VoiceOver reads wrong text.

Fix: Replace raw pointer extraction with Fbuffer_substring_no_properties
which handles the gap internally. Add ax_length field to visible run
struct for accurate UTF-16 length tracking (fixes supplementary
Unicode character offset drift).

Secondary: ax_offset accumulation now uses NSString length (UTF-16
units) instead of Emacs char count, preventing progressive drift in
index mapping for subsequent visible runs.
2026-02-26 16:07:42 +01:00
f09f6dd0f3 v15.6: replace TEXT_PROP_MEANS_INVISIBLE (xdisp.c only) with !NILP check 2026-02-26 15:44:55 +01:00
4a0c35a52c v15.6: skip invisible text, charpos↔index mapping, completions overlay
Major architectural change: ns_ax_buffer_text now skips text with
the 'invisible' property using TEXT_PROP_MEANS_INVISIBLE. Accessibility
text matches what the user sees on screen.

New ns_ax_visible_run struct tracks charpos↔ax-index mapping for each
visible text run. All 8 index conversion sites updated. Fixes wrong
line reading in dired, completions, and any buffer with invisible text.

Completions announcement now detects completions-highlight overlay
and reads the full highlighted candidate text instead of partial line.

2000-line patch, 54 references to new mapping infrastructure.
2026-02-26 15:40:28 +01:00
9cf5382bc7 v15.5: fix Fset_mark -> Fset_marker(BVAR(b,mark), pos, buf) 2026-02-26 15:22:02 +01:00
31e452ed5c v15.5: VoiceOver cursor tracking — setAccessibilitySelectedTextRange, interaction mode, completions announcement
1. setAccessibilitySelectedTextRange: — enables bidirectional cursor
   sync. Converts AX index to buffer charpos, moves point via
   SET_PT_BOTH. VoiceOver can now place cursor in text interaction mode.

2. setAccessibilityFocused: — handles VO+Shift+Down interaction entry.
   Ensures NS window focus, posts SelectedTextChanged so VoiceOver
   reads current line.

3. Completions announcement — when point changes in a non-focused
   buffer (e.g. *Completions* during Tab), posts
   AnnouncementRequestedNotification with the current line text.
   VoiceOver speaks the selected completion while minibuffer keeps focus.
2026-02-26 15:16:44 +01:00
f961f46b9a v15.4: comprehensive VoiceOver fix — 9 bugs from 4-reviewer audit
P0 fixes (critical):
- accessibilityRangeForLine: include trailing newline — fixes
  zero-length ranges for empty lines causing 'end of text'
- accessibilityVisibleCharacterRange: return full buffer range —
  VoiceOver was treating visible window boundary as end of text
- ensureTextCache: invalidate when point moves outside cached region
  (stale cachedTextStart after scrolling without editing)
- ns_ax_frame_for_range: use row->height not visible_height, clip
  to text area — fixes VoiceOver cursor bleeding into adjacent lines

P1 fixes (important):
- Post SelectedTextChanged after FocusedUIElementChanged on focus
  acquisition (windowDidBecomeKey) and window switch (C-x o)
- Post LayoutChangedNotification after tree rebuild
- accessibilityRangeForIndex: rangeOfComposedCharacterSequenceAtIndex
  for emoji/combining marks
- Buffer accessibilityFrame excludes mode line height
- New elements init cachedPoint/cachedModiff=-1 to force first
  notification

Reviewed by: architect + 3 reviewers (text, notifications, frames)
2026-02-26 14:53:47 +01:00
fd523f501f v15.3: fix VoiceOver cursor not following during typing
Root cause (confirmed via WebKit/Chromium source): ValueChanged (edit)
and SelectedTextChanged (cursor move) are MUTUALLY EXCLUSIVE — apps
must never send both for the same user action. VoiceOver enters
'typing mode' on Edit notifications and suppresses/ignores concurrent
SelectionMove notifications, causing the cursor to appear stuck.

Fix: (1) Update cachedPoint inside the modiff branch so the
selection-move check doesn't trigger for edit-caused point changes.
(2) Change 'if' to 'else if' for explicit mutual exclusion.

Source: WebKit AXObjectCacheMac.mm — postTextStateChangePlatformNotification
vs postTextSelectionChangePlatformNotification are separate code paths
that never fire for the same event.
2026-02-26 14:32:19 +01:00
9d963a6ab1 v15.2: fix all AXTextStateChange enum values (off-by-one from Unknown=0)
Root cause: Apple's AXTextStateChange enums start with Unknown=0,
shifting all named constants by +1 vs our values. WebKit source
(AXObjectCacheMac.mm) confirms:
- kAXTextStateChangeTypeEdit = 1 (was 0)
- kAXTextStateChangeTypeSelectionMove = 2 (was 1)
- kAXTextSelectionDirectionPrevious = 3 (was 2)
- kAXTextSelectionDirectionNext = 4 (was 3)
- kAXTextSelectionDirectionDiscontiguous = 5 (was 4)
- kAXTextSelectionGranularityCharacter = 1 (was 0)
- kAXTextSelectionGranularityLine = 3 (was 2)

Typing echo worked by coincidence (kAXTextEditTypeTyping=3 unchanged).
SelectionMove=1 mapped to Edit, so VoiceOver ignored cursor movement.

Completions two-line reading is expected (columnar buffer layout).
2026-02-26 14:11:16 +01:00
cd48418a3c v15.1: fix freeze on window split, C-n/C-p cursor tracking, new window detection
- Re-entrance guard (accessibilityUpdating) prevents infinite recursion
  when VoiceOver callbacks trigger redisplay during notification posting
- Detect window tree change via FRAME_ROOT_WINDOW comparison; rebuild
  tree BEFORE iterating elements (prevents accessing freed windows)
- Validate window+buffer pointers before posting notifications
- Dynamic direction (Previous/Next/Discontiguous) and granularity
  (Character/Line) in SelectedTextChanged notifications based on
  actual point movement — fixes C-n/C-p not moving VoiceOver cursor
- New windows (completions, splits) detected via lastRootWindow change
2026-02-26 13:43:34 +01:00
64c40f4867 v15: fix w->start_charpos -> marker_position(w->start), remove unused line_start 2026-02-26 13:27:15 +01:00
0dbcde3acb v15: fix missing @synthesize in patch (re-staged from working tree) 2026-02-26 13:21:49 +01:00
b7c750ff71 v15: regenerate patch from git diff (fix corrupt hunk headers) 2026-02-26 12:57:44 +01:00
046ea8cf7e v15: add @synthesize for MRC ivar access (no underscore prefix) 2026-02-26 12:56:23 +01:00
0570ee6717 v15: fix patch paths (src/nsterm.*), replace into original patch file 2026-02-26 12:51:02 +01:00
bc3731112f v15: buffer-relative accessibility rewrite (patch file)
Complete rewrite from glyph-based (v14) to buffer-relative design:
- ns_ax_buffer_text() with BUF_BEGV/ZV/PT, 100KB cap
- EmacsAccessibilityBuffer (AXTextArea per window)
- EmacsAccessibilityModeLine (AXStaticText per mode line)
- Enum fix: Edit=0, SelectionMove=1
- Text cache by BUF_MODIFF
- Tree rebuild on window config change only
- Minibuffer included
- Zoom code preserved (UAZoomChangeFocus)
- 1142 lines (nsterm.h +47, nsterm.m +1017)
2026-02-26 12:47:33 +01:00
8849a726a3 ns: fix VoiceOver cursor sync — 8 changes from pipeline review
Changes applied (from vo-cursor pipeline review, 7 workers):

1. (Change 8) Add ns_ax_index_for_charpos helper, refactor
   ns_ax_index_for_point as thin wrapper — shared coordinate
   mapping for all accessibility attribute methods.

2. (Change 1) Remove Site A notifications from ns_draw_window_cursor.
   Eliminates duplicate VoiceOver notifications (Site A + Site B both
   fired for same events). Zoom cursor tracking (UAZoomChangeFocus)
   preserved.

3. (Change 7) Remove redundant bare ValueChanged before rich
   userInfo version in postAccessibilityUpdatesForWindow:.

4. (Change 2) Fix typing echo character extraction to use glyph-based
   index (ns_ax_index_for_point) instead of buffer-relative
   (pt - BUF_BEGV - 1).

5. (Change 3) Add AXTextStateChangeType:@2 (SelectionMove) userInfo
   to SelectedTextChanged notification for cursor movement —
   enables VoiceOver line-by-line reading on arrow keys.

6. (Change 4) Fix accessibilityRangeForPosition: to return
   glyph-based index via ns_ax_index_for_charpos instead of
   buffer-relative (charpos - BUF_BEGV).

7. (Change 5) Fix accessibilitySelectedTextRange mark branch to use
   ns_ax_index_for_charpos for both endpoints instead of mixing
   glyph-based point with buffer-relative mark.

8. Remove 10 redundant text methods from EmacsView (Group role
   should not expose text attributes — eliminates coordinate
   system divergence with EmacsAccessibilityBuffer).

9. Fix MRC leak: release EmacsAccessibilityBuffer after addObject:
   in ns_ax_collect_windows.

10. Remove dead lastAccessibilityModiff ivar (was only used by
    removed Site A).

Enum values verified from WebKit AXTextStateChangeIntent.h:
  AXTextStateChangeTypeEdit = 1
  AXTextStateChangeTypeSelectionMove = 2
  AXTextEditTypeTyping = 3
2026-02-26 11:58:03 +01:00
946b138a0a v14.1: post notifications on focused virtual element, not EmacsView
Root cause of typing echo + cursor movement failure:
VoiceOver tracks the focused element (EmacsAccessibilityBuffer, AXTextArea).
Notifications from EmacsView (AXGroup) were ignored because VoiceOver
doesn't monitor non-focused elements for text changes.

Fix: ns_draw_window_cursor now calls [view accessibilityFocusedUIElement]
to find the right EmacsAccessibilityBuffer, and posts ValueChanged +
SelectedTextChanged on IT instead of on the view.

Also: postAccessibilityUpdatesForWindow now uses [self accessibilityStringForRange:]
instead of [view accessibilityStringForRange:] for typing echo text.
2026-02-26 10:47:12 +01:00
8fbdb2406d v14: fix VoiceOver virtual tree plumbing (based on Chromium analysis)
Root cause: VoiceOver ignored our virtual elements because they were
missing critical hierarchy metadata.  Chromium's AXPlatformNodeCocoa
(also an NSAccessibilityElement subclass) works because it provides
all of these.  Fixes based on VS Code/Chromium analysis:

1. Add accessibilityWindow + accessibilityTopLevelUIElement on base class
   (EmacsAccessibilityElement) — VoiceOver needs these to associate
   notifications with a window context
2. Add accessibilityParent on base class — unbroken chain to EmacsView
3. Add isAccessibilityFocused on EmacsAccessibilityBuffer — returns YES
   for active buffer
4. Post FocusedUIElementChangedNotification in windowDidBecomeKey —
   tells VoiceOver to start tracking the virtual element on app focus
5. Remove duplicate isAccessibilityFocused, deduplicate accessibilityParent
6. Keep all v13.3 features: Zoom, typing echo, full text protocol
2026-02-26 10:20:03 +01:00
ce31b94bb9 revert to v9 patch - virtual tree broke VoiceOver text interaction
v13 virtual element tree (EmacsAccessibilityBuffer) broke:
- typing echo (VoiceOver ignores notifications from virtual elements)
- buffer reading (AXGroup role on EmacsView confused VoiceOver)
- text navigation (dual text protocol = conflicting responses)

Reverting to v9 which has confirmed working:
- Zoom cursor tracking (UAZoomChangeFocus)
- typing echo (rich ValueChanged on EmacsView)
- buffer reading (accessibilityValue on AXTextArea)

Window detection (the only v13 improvement) not worth the regression.
2026-02-26 09:30:49 +01:00
ebf611bf19 v13.3: restore typing echo + add full text protocol on EmacsView
Key changes:
- Typing echo notifications back in ns_draw_window_cursor (on EmacsView,
  synchronous with cursor draw — this is how v9 did it and it worked)
- Rich userInfo: AXTextEditType=3, AXTextChangeValues with actual char
- SelectedTextChangedNotification on every cursor draw
- Full text protocol on EmacsView: accessibilityNumberOfCharacters,
  accessibilitySelectedText, accessibilityInsertionPointLineNumber,
  accessibilityVisibleCharacterRange, accessibilityLineForIndex:,
  accessibilityRangeForLine:, accessibilityAttributedStringForRange:
- accessibilityAttributedStringForRange: on EmacsAccessibilityBuffer too
- Virtual tree kept for VoiceOver window/buffer detection
2026-02-26 09:23:39 +01:00
f41fe14772 v13.2: fix protected ivar access (@public for lastAccessibilityCursorRect) 2026-02-26 09:09:09 +01:00
46265bdaa6 v13.2 patch: restore Zoom cursor tracking + fix MRC + fix typing echo
- Restore UAZoomChangeFocus() in ns_draw_window_cursor (was missing in v13)
- Restore accessibilityBoundsForRange: on EmacsView (Zoom queries the view)
- Restore legacy parameterized attribute APIs (Zoom uses these)
- Add lastAccessibilityCursorRect ivar for cursor position tracking
- Fix typing echo: AXTextEditType=3 (not 0), add AXTextChangeValues array
- Keep virtual element tree (EmacsAccessibilityBuffer) for VoiceOver
- MRC fixes: retain/release for accessibilityElements array
2026-02-26 09:03:10 +01:00
e5bfce500f v13 patch: fix MRC retain/release for accessibilityElements array
- arrayWithCapacity: returns autorelease object, must retain for ivar
- Release old array before reassigning in rebuildAccessibilityTree
- Release in EmacsView dealloc
- Fixes crash: _NSPasteboardTypeCache countByEnumeratingWithState (dangling pointer)
2026-02-26 08:52:46 +01:00