ekp/.phrase/phases/phase-kp-overhaul-20260726/issue_natural_live_editing_20260729.md
Kinneyzhang 83352c4571 feat!: add source-clean live buffer layout
Replace the physical ekp-region renderer with ekp-buffer text-property projection backed by shared semantic layout plans and stable live-edit transactions.

Optimize the C-backed resize hot path, and add deterministic performance, ERT, GUI, fuzz, release, and documentation coverage for task017 through task032.

BREAKING CHANGE: require ekp-buffer instead of ekp-region and rename module-owned ekp-region-* settings to ekp-buffer-*.
2026-07-30 01:07:25 +08:00

3.1 KiB

Issue: Natural Live Editing 2026-07-29

issue014 [ ] Near-edge editing publishes premature KP layout

  • Status: Implemented and independently verified; user-visible confirmation is pending.
  • Summary: With ekp-auto-justify-mode enabled, typing near the right edge can publish several visual KP breaks and a discretionary hyphen while the user is still composing the current hard paragraph. The result does not feel like ordinary Emacs editing.
  • Environment: Text-property live-flow renderer after task024; graphical Emacs 30.2; mixed Latin/CJK prose.
  • Repro:
    1. Enable ekp-auto-justify-mode in a graphical window.
    2. Type mixed Latin/CJK prose continuously toward the right edge.
    3. Observe the transition one character at a time as Emacs naturally wraps.
  • Expected vs Actual:
    • Expected: the source tail containing point is displayed exactly as ordinary Emacs would display it. Before natural wrap, EKP publishes no layout property there. After natural wrap, EKP may align only the row the user has left. A complete KP pass runs only after the hard paragraph ends or point leaves it.
    • Actual: bounded KP flow selects and publishes display breaks during typing. natural-p suppresses glue projection only; it still permits prefix and break/hyphen projection.
  • Root Cause: The live model treats an unfinished paragraph as a continuously maintained partial KP plan. “Natural active line” is only a glue exception inside that plan, not native Emacs display ownership.
  • Required Outcome: Replace partial live KP with three explicit states: a natural active tail, locally aligned rows already left by natural wrapping, and a complete KP paragraph after completion. No live row may add a discretionary hyphen or replacing visual break.
  • Fix: task025 deletes the partial-KP anchor/lookahead/convergence/push-pull state machine. The active hard paragraph is restored to native display before each source edit. After the edit, EKP derives completed native visual rows from Emacs redisplay and projects only their internal gap widths. The point-containing tail stays native, and only hard-paragraph completion or paragraph exit runs the complete KP planner. Live projection cannot install replacing breaks, prefixes, or discretionary hyphens.
  • Verification: Focused live contract ERT passes 4/4; buffer ERT passes 75/75; default, seeded-permuted, and isolated full ERT pass 164/164; fuzz passes 300/300. Warning-as-error compilation, checkdoc, pinned package-lint, release, dictionary, pinned-source, static ownership, no-overlay, and diff gates pass. The retained clean Emacs 30.2 dynamic artifact at /private/tmp/ekp-native-live-2dYu2U proves native mixed-text wrap, exact deletion restoration, and the sole full-KP transition after hard newline; every immediate and redisplay checkpoint passes, with zero live owned breaks and no black recording segment.
  • User Confirmation: Pending after the visible fix is delivered.
  • Resolved At: Unresolved.
  • Resolved By: Implementation complete; awaiting user confirmation.
  • Commit: Pending.