patches: fix org fold/unfold VoiceOver refresh; revert to BUF_MODIFF

REGRESSION: fold/unfold in org-mode, outline-mode and hideshow-mode did
not refresh VoiceOver text because ensureTextCache used BUF_CHARS_MODIFF
which is NOT bumped by (put-text-property ... 'invisible), the mechanism
used by modern org-fold-core (org >= 29) and outline-mode to hide text.

VoiceOver would continue reading folded content as if visible, or miss
newly unfolded content entirely, because the text cache was considered
valid despite the visible-text having changed.

Revert ensureTextCache to BUF_MODIFF with an explanatory comment:

- BUF_CHARS_MODIFF is bumped only on character insertions/deletions, not
  text-property changes.  Fold/unfold uses text properties for visibility.
- BUF_OVERLAY_MODIFF alone is also insufficient: org >= 29 uses text
  properties, not overlays, for folding.  Also hl-line-mode bumps
  BUF_OVERLAY_MODIFF every post-command-hook --- same per-keystroke cost
  as BUF_MODIFF, with none of its correctness guarantee.
- BUF_MODIFF cost is acceptable: ensureTextCache is called only when
  VoiceOver queries AX properties (human interaction speed, not redisplay
  speed).  Rebuild cost is O(visible-buffer-text).

Also retain C-n/C-p line-read fix from previous commit (7a0b4f6):
FocusedUIElementChanged excluded for sequential isCtrlNP moves.
This commit is contained in:
2026-03-02 20:57:32 +01:00
parent 7a0b4f6cf2
commit a5ff8d391b
9 changed files with 94 additions and 81 deletions

View File

@@ -1,4 +1,4 @@
From 234da3ced54798fe9e4bafb0eae08d571a4ffcfc Mon Sep 17 00:00:00 2001
From 01f32063667eb000b95b1514b0f78056aaa53c28 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 1/8] ns: add accessibility base classes and text extraction