ekp/tests
Kinneyzhang 29cef97ef8 fix: justified lines fit the real display, not an idealized one
Two root causes made justified text overrun the window's right edge
in real user sessions (every line ending in the "$" truncation
marker), while emacs -Q looked fine:

1. Windows WITHOUT fringes draw the truncation/continuation
   indicator in the text area's LAST COLUMN, so the usable width is
   one character less than window-body-width.  ekp reserved only a
   2px margin: with fringes disabled (a common minimal setup, and
   all ttys) every line that hit the target width exactly had its
   final glyph displaced by the "$".  ekp-region--window-pixel now
   reserves one frame-char-width when the window has no right
   fringe.  (The same lesson ebox-playground encodes in its
   viewport-width reserve.)

2. Measurement was blind to the buffer's display context:
   string-pixel-width works in a bare hidden buffer, ignoring
   face-remapping-alist — which is where text-scale-mode, themes
   and per-buffer font tweaks live.  Under a remap, the DP laid
   lines out with one font's metrics and the display rendered them
   with another's: scale +3 made 5 of 7 sample lines overflow a
   1330px window by up to 900px (GUI-measured).  Measurement now
   runs with the destination buffer's face-remapping-alist (the
   29/30-compatible equivalent of Emacs 31's string-pixel-width
   BUFFER argument), and the width/paragraph caches key on that
   context so buffers at different scales never alias.  text-scale
   changes also trigger a re-flow in ekp-auto-justify-mode.

Ground truth, measured with window-text-pixel-size in GUI Emacs
across 7 display contexts (plain / text-scale ±| face remap /
no-fringes / no-fringes+scale / narrow+scale): the widest justified
line equals the target width exactly in every case, zero lines
overflow.  Verbatim code blocks are exempt by design (they never
reflow, like any code line in a narrow window).

New tooling so this never regresses invisibly:
- M-x ekp-diagnose: renders a probe line in YOUR buffer and reports
  target vs rendered width — run it in any session where justified
  text looks wrong.
- tests/ekp-gui-verify.el: M-x ekp-gui-verify (single check in a
  customized session) and ekp-gui-verify-matrix (the 7-case table,
  for emacs -Q).
- 2 new batch ERT tests pin the context-keyed caches (94 total).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-27 03:19:27 +08:00
..
ekp-bench.el refactor!: overhaul KP core — correctness, C parity, performance, tests, docs 2026-07-26 18:44:02 +08:00
ekp-demo.el feat: whole-buffer commands, DWIM, M-q remap, org/markdown wiring 2026-07-27 01:08:40 +08:00
ekp-fuzz.el refactor!: overhaul KP core — correctness, C parity, performance, tests, docs 2026-07-26 18:44:02 +08:00
ekp-gui-verify.el fix: justified lines fit the real display, not an idealized one 2026-07-27 03:19:27 +08:00
ekp-region-tests.el perf(region): smarter lazy re-flow scheduling 2026-07-27 01:11:05 +08:00
ekp-showcase.el fix(showcase): follow-window right-edge truncation; checkdoc clean 2026-07-27 02:28:29 +08:00
ekp-tests.el fix: justified lines fit the real display, not an idealized one 2026-07-27 03:19:27 +08:00
run-tests.sh feat: buffer-level justification — region commands and auto-justify mode 2026-07-26 20:23:03 +08:00
text-de_DE.txt update readme 2025-07-27 21:35:44 +08:00
text-en_US.txt update readme 2025-07-27 21:35:44 +08:00
text-fr.txt update readme 2025-07-27 21:35:44 +08:00
text-zh2-en_US.txt fix _ local variable bug 2025-07-28 16:58:30 +08:00
text-zh-en_US.txt fix bug when text is blank string 2025-09-26 00:18:37 +08:00
text-zh.txt add chinese example 2025-07-28 00:33:53 +08:00