From 33981a647e977d5f3b6b8ff2077473878a774ef2 Mon Sep 17 00:00:00 2001 From: Kinneyzhang Date: Sun, 26 Jul 2026 20:25:03 +0800 Subject: [PATCH] docs: describe lossless renderer markers in developer docs Co-Authored-By: Claude Fable 5 --- DEVELOPER.md | 17 +++++++++++++++++ DEVELOPER_ZH.md | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/DEVELOPER.md b/DEVELOPER.md index 513776c..e85a606 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -148,6 +148,23 @@ already excluded them (§3). Glues become `(space :width (N))` display properties, so justification is pixel-exact in GUI Emacs and column-exact in batch/tty. +The output is **lossless**: boxes are located in the source string +(`ekp--box-offsets`), and every synthesized or hidden piece records the +original text it stands for — + +| property | on | value / meaning | +|-------------------|-----------------------|--------------------------------| +| `ekp-glue` | synthesized glue space| original text it replaced | +| `ekp-soft-break` | inserted `\n` | whitespace swallowed at break | +| `ekp-soft-hyphen` | inserted hyphen | marker only | +| `ekp-hidden` | paragraph-edge text | kept verbatim, `display ""` | + +Zero-width glue with a non-empty original renders as the hidden +original itself, so no character is ever dropped. `ekp-region.el` +inverts these four structurally (`ekp-unjustify-region`) — exact even +after the justified text was edited — and builds +`ekp-justify-region` / `ekp-auto-justify-mode` on top. + ## 6. Looseness `ekp-looseness` ≠ 0 switches to `ekp--dp-run-loose`, a full diff --git a/DEVELOPER_ZH.md b/DEVELOPER_ZH.md index 0d25420..fab3fa6 100644 --- a/DEVELOPER_ZH.md +++ b/DEVELOPER_ZH.md @@ -132,6 +132,21 @@ penalty/flagged 断点),主流程无 `q`/looseness(见 §6),相邻松紧惩 Glue 渲染为 `(space :width (N))` display 属性,GUI 下像素级精确, batch/tty 下按字符列精确。 +渲染输出是**无损**的:先用 `ekp--box-offsets` 在原串中定位每个盒子, +然后每一处合成/隐藏内容都记录它所对应的原文—— + +| 属性 | 位置 | 值 / 含义 | +|-------------------|-----------------|----------------------------| +| `ekp-glue` | 合成的 glue 空格| 它所替换的原文 | +| `ekp-soft-break` | 插入的 `\n` | 断点处被吞掉的空白 | +| `ekp-soft-hyphen` | 插入的连字符 | 仅作标记 | +| `ekp-hidden` | 段落边缘文本 | 原样保留,`display ""` 隐藏| + +零宽 glue 若对应非空原文,直接渲染为隐藏的原文本身,因此任何字符都 +不会丢失。`ekp-region.el` 对这四类标记做纯结构逆变换 +(`ekp-unjustify-region`)——即使排版后又被编辑过也能精确还原——并在 +其上实现 `ekp-justify-region` / `ekp-auto-justify-mode`。 + ## 6. Looseness `ekp-looseness` ≠ 0 时切换到 `ekp--dp-run-loose`:完整的