M1.1: text buffer with UTF-16 positions, edit batches and line endings

lutra-text gets Buffer on a ropey rope: byte/char/UTF-16/line counts,
byte offset <-> (line, column) in UTF-16 code units or chars, absolute
UTF-16 offsets, atomic Edit batches in LSP TextEdit[] semantics, and
\n / \r\n / \r detection with a keep-the-file's-ending save policy.
All conversions return TextError instead of panicking.

ropey 1.6.1 (MIT) without unicode_lines, so only the LSP/CodeMirror
line breaks split lines. proptest moves into workspace deps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-14 19:20:18 +02:00
parent faadb05eb3
commit 5dac918b14
12 changed files with 1278 additions and 3 deletions

View file

@ -1,6 +1,6 @@
# Gaps
> **Status:** M0 closed G1; estimates added · **Last updated:** 2026-10-14
> **Status:** M0 closed G1; G2 under way (text buffer) · **Last updated:** 2026-10-14
Every known shortfall, ranked. This is the work list: unless the owner gives a task, take the highest open gap. Hours are agent wall-clock hours for one agent, all estimated.
@ -23,6 +23,8 @@ Every known shortfall, ranked. This is the work list: unless the owner gives a t
| G15 | Database tools, HTTP client, Docker and remote | later | ~430 h |
| G16 | Plug-ins and ecosystem | later | ~120 h |
G2 progress: the engine text buffer landed (M1.1, `crates/text`: rope, UTF-16 and char positions, atomic edit batches, line ending policy). Engine buffers, undo, multi-caret, save and the recovery journal are still open; the estimate stays ~30 h.
Known smaller items from M0:
- The CI workflow has never run: the repository has no remote until the owner decides on hosting.
@ -33,5 +35,6 @@ Known smaller items from M0:
| Date | Change | Summary |
|---|---|---|
| 2026-10-14 | minor | G2 note: text buffer landed (M1.1) |
| 2026-10-14 | minor | G1 closed; estimates for G2–G16; M0 follow-ups |
| 2026-10-13 | major | Initial gap list |

View file

@ -1,6 +1,6 @@
# Target-app parity
> **Status:** baseline after M0, no PHP feature ships · **Last updated:** 2026-10-14 · **Target:** PhpStorm 2026.x
> **Status:** M1 in progress (text buffer landed), no PHP feature ships · **Last updated:** 2026-10-14 · **Target:** PhpStorm 2026.x
## How this is measured
@ -12,7 +12,7 @@ Hours are the estimated agent wall-clock hours for one agent to reach behaviour
| Area | Weight | Score | Missing | Hours (one agent) | Evidence |
|---|---:|---:|---|---:|---|
| Editor core | 12 | 0% | everything | ~120 (est.) | — |
| Editor core | 12 | 0% | everything user-visible; only the engine text buffer exists | ~120 (est.) | `crates/text`: rope buffer, positions, edits (M1.1, unit tests + proptests) |
| Project view, VFS | 6 | 0% | everything | ~40 (est.) | — |
| Navigation | 10 | 0% | everything | ~120 (est.) | — |
| Search and replace | 6 | 0% | everything | ~80 (est.) | — |
@ -48,9 +48,18 @@ No PHP feature. The foundation, verified on Windows 11:
- Control channel: `app.ping`, `engine.execute`, `engine.listCommands`, `ui.screenshot`, with proptests and a TCP integration test (`crates/control`), and checked against the running app.
- The desktop window opens themed from Rust tokens and shows the product name and version that the frontend gets from `app.about` over IPC.
## What ships (M1, in progress)
Nothing user-visible yet, so every score stays 0%.
- M1.1 text buffer (`crates/text`): `Buffer` on a `ropey` rope with byte, char, UTF-16 and line counts; byte offset to line and column in UTF-16 code units or chars and back, all fallible (out of range, inside a character, inside a CRLF, inside a surrogate pair); atomic `Edit` batches in LSP `TextEdit[]` semantics that reject reversed, out-of-range and overlapping ranges; `
` / `
` / ` ` detection with a keep-the-file's-ending save policy. 23 unit tests and 6 proptests (round-trips on emoji, ZWJ sequences, CJK and combining marks; random edit batches checked against a `String` model, never panicking).
## Revision history
| Date | Change | Summary |
|---|---|---|
| 2026-10-14 | minor | M1.1 text buffer evidence (Editor core, score unchanged) |
| 2026-10-14 | minor | Hours per area, weights reviewed, M0 evidence |
| 2026-10-13 | major | Baseline |