Subject: bug#73600: closed (Re: bug#73600: 31.0.50; Visual wrap prefix mode and image display)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 26 May 2025 23:31:02 +0000

Your bug report

#73600: 31.0.50; Visual wrap prefix mode and image display

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73600: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73600
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73600: 31.0.50; Visual wrap prefix mode and image display
From: Jim Porter <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 26 May 2025 16:30:22 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 10/19/2024 1:23 AM, Eli Zaretskii wrote:
> I think at this stage it is basically up to you which version to
> install.  Adding tests is always welcome, of course, regardless of
> which version is installed.

This is much-delayed, but now that I'm back from an extended break, I've 
now merged the "safer" version of my change as <>.

Here's a short summary of the issue: the new visual-wrap code inserts a 
'min-width' display property to make sure everything lines up. This 
usually works ok, but fails when a "replacing" display spec spans 
multiple lines of the buffer text. That comes up in 'image-mode', where 
the buffer text is the image data, and we apply a display spec to show 
the image. If the image data contains a 0x0a byte (line feed), then the 
visual-wrap code would insert a 'min-width' property on *part* of the 
buffer contents, confusing the display engine into thinking should be 
multiple images.

The fix is to skip past any replacing display specs when scanning the 
buffer. The new code also includes a list of known-safe display specs 
that don't have this problem: 'visual-wrap--safe-display-specs'. I was 
intentionally conservative with that list, but we could add more to it 
as needed.

I've tried many different variations to try to break the "safe" version 
of my patch (which I still think is less strictly-correct than the other 
version), but I couldn't. Since the difference likely won't come up, I 
opted to merge the patch that Eli felt more comfortable with.

I've marked this bug as done, but if I've missed anything, just let me know.

Subject: 31.0.50; Visual wrap prefix mode and image display
From: Gautier Ponsinet <[email-masked]>
To: [email-masked]
Date: Wed, 02 Oct 2024 16:04:02 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello everyone,

The mode visual-wrap-prefix-mode sometimes causes images to be displayed
incorrectly in emacs (in a mosaic-like way).

To this mail are attached screenshots of the problem and the image file
used in the screenshots which is from wikipedia:
- https://fr.wikipedia.org/wiki/Olcades
- https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Iberia_300BC-fr.svg/langfr-873px-Iberia_300BC-fr.svg.png

Note that the error does not occur with all images, but I am not able to
identify which characteristic of an image makes the problem appear.
Still, I have encountered the problem with multiple image files.

In emacs -Q:
- enable global-visual-wrap-prefix-mode,
- open the attached image.

All the best,
Gautier.

========================================================================
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.2, Xaw3d scroll bars) of 2024-10-02 built on
 gautier-laptop
Repository revision: 4bb62af3263057312021e076dc7e0c8ff195e38f
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-m17n-flt --without-gconf
 --with-native-compilation=yes --with-xinput2 --with-x-toolkit=lucid
 --without-xft --with-xaw3d --with-sound=no --with-tree-sitter
 --without-gpm --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -g
 -ffile-prefix-map=/home/gautier/Documents/Sources/AUR/emacs-git/src=/usr/src/debug/emacs-git
 -flto=auto' 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed
 -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Splash Screen

Minor modes in effect:
  visual-fill-column-mode: t
  pdf-occur-global-minor-mode: t
  TeX-PDF-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  recentf-mode: t
  marginalia-mode: t
  global-corfu-mode: t
  corfu-mode: t
  vertico-mouse-mode: t
  vertico-mode: t
  minibuffer-depth-indicate-mode: t
  delete-selection-mode: t
  global-goto-address-mode: t
  goto-address-mode: t
  pulsar-global-mode: t
  pulsar-mode: t
  lin-global-mode: t
  override-global-mode: t
  winner-mode: t
  repeat-mode: t
  global-visual-wrap-prefix-mode: t
  visual-wrap-prefix-mode: t
  global-word-wrap-whitespace-mode: t
  word-wrap-whitespace-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/gautier/.local/share/emacs/packages/ef-themes-1.8.0/theme-loaddefs hides /home/gautier/.local/share/emacs/packages/modus-themes-20240921.616/theme-loaddefs
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-tag hides /usr/share/emacs/site-lisp/notmuch-tag
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch hides /usr/share/emacs/site-lisp/notmuch
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-wash hides /usr/share/emacs/site-lisp/notmuch-wash
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-maildir-fcc hides /usr/share/emacs/site-lisp/notmuch-maildir-fcc
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-hello hides /usr/share/emacs/site-lisp/notmuch-hello
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-jump hides /usr/share/emacs/site-lisp/notmuch-jump
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-mua hides /usr/share/emacs/site-lisp/notmuch-mua
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-query hides /usr/share/emacs/site-lisp/notmuch-query
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-print hides /usr/share/emacs/site-lisp/notmuch-print
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-compat hides /usr/share/emacs/site-lisp/notmuch-compat
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-company hides /usr/share/emacs/site-lisp/notmuch-company
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-message hides /usr/share/emacs/site-lisp/notmuch-message
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-parser hides /usr/share/emacs/site-lisp/notmuch-parser
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-crypto hides /usr/share/emacs/site-lisp/notmuch-crypto
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-address hides /usr/share/emacs/site-lisp/notmuch-address
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-tree hides /usr/share/emacs/site-lisp/notmuch-tree
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-show hides /usr/share/emacs/site-lisp/notmuch-show
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/coolj hides /usr/share/emacs/site-lisp/coolj
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-draft hides /usr/share/emacs/site-lisp/notmuch-draft
/home/gautier/.local/share/emacs/packages/notmuch-20240816.2039/notmuch-lib hides /usr/share/emacs/site-lisp/notmuch-lib
/home/gautier/.local/share/emacs/packages/transient-20241001.1031/transient hides /usr/share/emacs/31.0.50/lisp/transient
/home/gautier/.local/share/emacs/packages/ef-themes-1.8.0/theme-loaddefs hides /usr/share/emacs/31.0.50/lisp/theme-loaddefs

Features:
(shadow sort mail-extr emacsbug char-fold mule-util visual-fill-column
nov esxml-query pdf-sync pdf-occur ibuf-ext ibuffer ibuffer-loaddefs
tablist advice tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet pdf-isearch
let-alist pdf-misc pdf-tools pdf-view pdf-cache pdf-info tq pdf-util
pdf-macs tex texmathp elfeed-show elfeed-search elfeed-csv elfeed
elfeed-curl elfeed-log elfeed-db elfeed-lib xml-query ol-notmuch notmuch
notmuch-tree notmuch-jump notmuch-hello notmuch-show notmuch-print
notmuch-crypto notmuch-mua notmuch-message notmuch-draft
notmuch-maildir-fcc notmuch-address notmuch-company notmuch-parser
notmuch-wash coolj icalendar notmuch-tag notmuch-lib notmuch-version
notmuch-compat org-duration vc-git vc-dispatcher org-contacts
org-capture quail oc-basic disp-table org-habit ol-eww eww url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus
gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time gnus-spec
gnus-int gnus-range gnus-win gnus nnheader range ol-docview doc-view
jka-compr image-mode exif ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi
org-link-doi org-agenda embark-org org-element org-persist org-id
org-refile org-element-ast inline avl-tree generator org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie treesit
executable ob-comint org-pcomplete org-list org-footnote org-faces
org-entities noutline outline org-version ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs
find-func org-compat org-macs notifications dbus compile xml appt
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs project
magit-extras magit-bookmark magit-submodule magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff diff-mode track-changes
git-commit log-edit message sendmail yank-media puny rfc822 mml mml-sec
epa derived epg rfc6068 epg-config gnus-util time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process with-editor comp comp-cstr
warnings comp-run comp-common rx shell pcomplete comint ansi-osc server
ansi-color magit-mode transient benchmark magit-git magit-base
magit-section format-spec cursor-sensor crm dash recentf tree-widget
gnus-dired dired dired-loaddefs embark-consult embark ffap consult
orderless marginalia cape corfu vertico-mouse vertico-directory vertico
mb-depth jinx tempel compat delsel fontaine goto-addr
modus-operandi-theme pulsar pulse color cus-edit cus-load wid-edit lin
hl-line face-remap modus-themes ef-themes edmacro kmacro
use-package-bind-key bind-key easy-mmode use-package-ensure
use-package-core burly frameset thingatpt bookmark text-property-search
pp winner ace-window avy ring repeat visual-wrap word-wrap-mode
ace-window-autoloads auctex-autoloads tex-site avy-autoloads
bbdb-autoloads beframe-autoloads bufferlo-autoloads burly-autoloads
cape-autoloads citar-embark-autoloads citar-autoloads citeproc-autoloads
corfu-autoloads cursory-autoloads debbugs-autoloads
dired-preview-autoloads eat-autoloads ebdb-autoloads cl-extra help-mode
ef-themes-autoloads elfeed-autoloads embark-consult-autoloads
consult-autoloads embark-autoloads expand-region-autoloads f-autoloads
fontaine-autoloads forge-autoloads closql-autoloads emacsql-autoloads
fountain-mode-autoloads ghub-autoloads gnuplot-autoloads
htmlize-autoloads hyperbole-autoloads kotl-autoloads hact set hhist
indent-bars-autoloads jinx-autoloads ledger-mode-autoloads lin-autoloads
magit-autoloads pcase magit-section-autoloads dash-autoloads
marginalia-autoloads markdown-mode-autoloads modus-themes-autoloads
nov-autoloads esxml-autoloads kv-autoloads ol-notmuch-autoloads
notmuch-autoloads orderless-autoloads org-contacts-autoloads
org-modern-autoloads osm-autoloads parsebib-autoloads
pdf-tools-autoloads popper-autoloads pulsar-autoloads queue-autoloads
rainbow-mode-autoloads s-autoloads spacious-padding-autoloads
string-inflection-autoloads tablist-autoloads tempel-autoloads
tmr-autoloads transient-autoloads trashed-autoloads treepy-autoloads
vertico-autoloads visual-fill-column-autoloads wgrep-autoloads info
with-editor-autoloads yaml-autoloads xdg package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs icons password-cache json
subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 641073 63157) (symbols 48 42867 0) (strings 32 167248 6724)
 (string-bytes 1 5185552) (vectors 16 237023)
 (vector-slots 8 3126477 384380) (floats 8 770 1)
 (intervals 56 1489 224) (buffers 992 15))