emacs/test/lisp
Andrea Alberti ca5e9976b1 Pixel-direct alignment in visual-wrap-prefix-mode (bug#81039)
`visual-wrap--content-prefix' previously returned a column count
computed as

    (max (string-width prefix)
         (ceiling (string-pixel-width prefix) avg-space-width))

with two problems:

* `string-width' ignores `buffer-invisibility-spec', so an invisible
  prefix (hidden ATX markers under `markdown-ts-hide-markup', for
  example) still reserved its character count on line 1 via a
  `min-width' display property, shifting the visible heading right.

* With variable-pitch fonts, rounding the prefix width up to whole
  columns added visible padding whenever the natural width did not
  fall on an exact column boundary.

Return the prefix's natural pixel width via `string-pixel-width'
instead, which accounts for any display transformation applied to
the prefix (invisibility, `display' replacements, text scaling,
proportional fonts).  Drop the `min-width' property from
`visual-wrap--apply-to-line' so line 1 renders at its natural width.
Switch the continuation `wrap-prefix' to a mixed-unit `:align-to'
sum form:

    (space :align-to (+ (PIX) (EXTRA-INDENT . width)))

where PIX is the prefix's pixel width and EXTRA-INDENT is
`visual-wrap-extra-indent' in canonical character widths.  The
display engine resolves each term per the active frame and sums
them, so no Lisp-level unit conversion is needed.

Since `min-width' is no longer installed, the accumulation cycle
that commit 81a5beb8af (bug#73882) worked around cannot recur.
Drop the `min-width' strip from `visual-wrap--content-prefix' and
the `min-width' removal from `visual-wrap--remove-properties'.
Keep `min-width' in `visual-wrap--safe-display-specs' so that
lines where other modes install it are not skipped.

* lisp/visual-wrap.el (visual-wrap--content-prefix): Return pixel
width instead of column count; drop the `min-width' strip.
(visual-wrap--apply-to-line): Drop `min-width' on line 1; use
mixed-unit `:align-to' sum form for the continuation wrap-prefix.
(visual-wrap--adjust-prefix): Handle only string prefixes; the
numeric (pixel) case is now handled inline in `--apply-to-line'
via the mixed-unit `:align-to' sum form.
(visual-wrap--remove-properties): Drop `min-width' removal.
(visual-wrap--safe-display-specs): Add note about `min-width'.
* test/lisp/visual-wrap-tests.el: Update expected `wrap-prefix'
values to the new sum form.
(visual-wrap-tests/invisible-prefix): New test motivated by bug#81039.
(visual-wrap-tests/negative-extra-indent): New test; verify that a
large negative `visual-wrap-extra-indent' produces a valid
wrap-prefix (the display engine clamps the stretch to zero).
* test/manual/visual-wrap-test.el: New file.  Manual test suite
for visual-eyeball verification of prefix alignment behavior.

Reported-by: Andrea Alberti <a.alberti82@gmail.com>
Co-authored-by: Stefan Monnier <monnier@iro.umontreal.ca>
2026-05-26 16:56:32 -04:00
..
align-resources Support lua-ts-mode in align.el 2023-10-21 12:25:25 +02:00
auth-source-resources
bookmark-resources
calc calc: Improve handling of invalid 'calc-string-maximum-character' 2026-01-17 14:48:06 +02:00
calendar Rename `icalendar-recur' type and related functions 2026-05-23 13:25:19 +03:00
cedet ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
custom-resources
dabbrev-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dired-resources/insert-directory
emacs-lisp Add lexical-binding cookies to multi-file-0.2.3.tar 2026-04-27 11:48:58 +02:00
emulation ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
epg-resources
erc Merge from origin/emacs-31 2026-05-21 00:24:52 +01:00
eshell Revert "Repair serious breakage in the batch tests." 2026-03-04 19:24:52 +01:00
faces-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
files-resources Ensure .dir-locals-2.el behavior as documented (bug#75890) 2025-03-22 16:47:27 -04:00
gnus Update gnus-icalendar to use new iCalendar library 2026-03-28 15:43:16 +03:00
hfy-cmap-resources
image ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
international ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
jsonrpc-resources Jsonrpc: migrate more tests to Python subprocess fixtures 2026-05-17 19:28:07 +01:00
language ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
loadhist-resources ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
mail Make Rmail summary address display customizable 2026-02-21 19:30:25 +02:00
mh-e ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
minibuffer-resources
net ; Minor Tramp changes 2026-05-23 10:25:46 +02:00
nxml ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
obsolete ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
org ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
pcmpl-linux-resources
play ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
progmodes ;cperl-mode.el: Fix fontification edge cases 2026-05-25 11:23:34 +02:00
saveplace-resources
so-long-tests ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
term ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
textmodes ; Fix one of ispell-tests 2026-01-18 22:15:18 +02:00
time-resources
url ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
use-package ; Adjust use-package tests for :vc 2026-03-19 21:38:29 +01:00
vc vc-test--rename-file: Disable part of test for SCCS 2026-05-23 16:53:36 +01:00
xdg-resources
abbrev-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
align-tests.el Fix aligning buffer regions containing multiple alignment sections 2026-02-05 10:51:16 +02:00
allout-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
allout-widgets-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ansi-color-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ansi-osc-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
apropos-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
arc-mode-tests.el test subdirectory: Use new error-API 2026-03-10 10:48:22 -04:00
auth-source-pass-tests.el Improve last change to auth-source-pass 2026-03-26 15:05:22 +01:00
auth-source-tests.el Test read-passwd behavior (bug#80838) 2026-05-10 20:00:41 +00:00
autoinsert-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
autorevert-tests.el test subdirectory: Use new error-API 2026-03-10 10:48:22 -04:00
battery-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
bookmark-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
buff-menu-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
button-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
calculator-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
char-fold-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
color-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
comint-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
completion-preview-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
completion-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
cus-edit-tests.el ; Fix cus-edit setopt test 2026-04-03 12:44:54 +02:00
custom-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dabbrev-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
delim-col-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
descr-text-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
desktop-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dired-aux-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dired-tests.el ; Spelling fixes. 2026-04-29 22:45:51 -07:00
dired-x-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dnd-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
dom-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
edmacro-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
electric-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
elide-head-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
env-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
epg-config-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
epg-tests.el Revert "Repair serious breakage in the batch tests." 2026-03-04 19:24:52 +01:00
faces-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ffap-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
filenotify-tests.el ; Instrument filenotify test 2026-01-27 18:49:37 +01:00
files-tests.el Fix file-name-non-special implementation of get-file-buffer 2026-05-12 08:48:43 +02:00
files-x-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
find-cmd-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
follow-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
font-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
format-spec-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
help-fns-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
help-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
help-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hfy-cmap-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hi-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
hl-line-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
htmlfontify-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ibuffer-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ido-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
image-file-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
image-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
imenu-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
info-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
info-xref-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
isearch-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
jit-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
json-tests.el Prefer value< with new 'sort' in json.el 2026-02-14 18:56:44 +01:00
jsonrpc-tests.el ; * test/lisp/jsonrpc-tests.el: Adjust timeouts for CI EMBA testing 2026-05-18 17:22:30 +01:00
kmacro-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
loadhist-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
lpr-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
ls-lisp-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
man-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
md4-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
minibuffer-tests.el Rewrite flex completion with Gotoh algorithm 2026-02-13 23:46:11 +00:00
misc-tests.el ; Minor changes to 'truncate-string-pixelwise' (bug#80244) 2026-02-07 14:49:15 +02:00
mouse-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
mwheel-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
newcomment-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
obarray-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
paren-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
password-cache-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
pcmpl-linux-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
pcomplete-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
proced-tests.el test subdirectory: Use new error-API 2026-03-10 10:48:22 -04:00
ps-print-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
register-tests.el (register--get-method-type): Fix one more case (bug#80894) 2026-04-26 12:18:44 -04:00
repeat-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
replace-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
rot13-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
savehist-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
saveplace-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
scroll-lock-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
server-tests.el Revert "Repair serious breakage in the batch tests." 2026-03-04 19:24:52 +01:00
ses-tests.el Check all SES local variables are always set locally. 2026-03-24 18:18:10 +01:00
shadowfile-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
shell-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
simple-tests.el ert-play-keys function 2026-04-16 13:30:42 +02:00
sort-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
soundex-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
speedbar-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
sqlite-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
startup-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
subr-tests.el Detect some API violations in combine-change-calls (bug#80877) 2026-05-20 11:27:40 +00:00
tab-bar-tests.el Revert "Repair serious breakage in the batch tests." 2026-03-04 19:24:52 +01:00
tabify-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
tar-mode-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
tempo-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
term-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
thingatpt-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
thread-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
time-stamp-tests.el ; time-stamp: rename some internal functions to include "--" 2026-04-07 09:28:32 -07:00
time-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
timezone-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
uniquify-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
version-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
visual-wrap-tests.el Pixel-direct alignment in visual-wrap-prefix-mode (bug#81039) 2026-05-26 16:56:32 -04:00
wdired-tests.el Revert "Repair serious breakage in the batch tests." 2026-03-04 19:24:52 +01:00
which-key-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
whitespace-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
wid-edit-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
winner-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
x-dnd-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xdg-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xml-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00
xt-mouse-tests.el Add predicate for initial_terminal 2026-03-26 15:19:56 +01:00
yank-media-tests.el ; Add 2026 to copyright years. 2026-01-01 12:54:34 +00:00