* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers @ 2024-08-19 21:39 Gautier Ponsinet 2024-08-20 0:46 ` Jim Porter 0 siblings, 1 reply; 18+ messages in thread From: Gautier Ponsinet @ 2024-08-19 21:39 UTC (permalink / raw) To: 72721 Hello everyone, The new visual-wrap-prefix-mode breaks the rendering of the Magit Log buffers. In emacs -Q: * Install Magit and its dependencies and load Magit. * Go to a local repository (via M-x dired or M-x cd). * M-x global-visual-wrap-prefix-mode * M-x magit-log-current Could someone please confirm/reproduce? All the best, Gautier. ------------------------------------------------------------------------ In GNU Emacs 31.0.50 (build 67, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2024-08-19 built on gautier-laptop Repository revision: a876c4d7a17df152e3e78800c76ddf158f632ee5 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=no --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/.packages/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 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: notmuch-hello Minor modes in effect: 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 global-corfu-mode: t corfu-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-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/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-20240819.1250/transient hides /usr/share/emacs/31.0.50/lisp/transient /home/gautier/.local/share/emacs/packages/modus-themes-20240811.502/theme-loaddefs hides /usr/share/emacs/31.0.50/lisp/theme-loaddefs /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-makefile hides /usr/share/emacs/31.0.50/lisp/org/ob-makefile /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-processing hides /usr/share/emacs/31.0.50/lisp/org/ob-processing /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-table hides /usr/share/emacs/31.0.50/lisp/org/ob-table /home/gautier/.local/share/emacs/packages/org-9.7.10/org-src hides /usr/share/emacs/31.0.50/lisp/org/org-src /home/gautier/.local/share/emacs/packages/org-9.7.10/org-clock hides /usr/share/emacs/31.0.50/lisp/org/org-clock /home/gautier/.local/share/emacs/packages/org-9.7.10/org-lint hides /usr/share/emacs/31.0.50/lisp/org/org-lint /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-eww hides /usr/share/emacs/31.0.50/lisp/org/ol-eww /home/gautier/.local/share/emacs/packages/org-9.7.10/org-mobile hides /usr/share/emacs/31.0.50/lisp/org/org-mobile /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-plantuml hides /usr/share/emacs/31.0.50/lisp/org/ob-plantuml /home/gautier/.local/share/emacs/packages/org-9.7.10/org-table hides /usr/share/emacs/31.0.50/lisp/org/org-table /home/gautier/.local/share/emacs/packages/org-9.7.10/org-tempo hides /usr/share/emacs/31.0.50/lisp/org/org-tempo /home/gautier/.local/share/emacs/packages/org-9.7.10/oc-bibtex hides /usr/share/emacs/31.0.50/lisp/org/oc-bibtex /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-texinfo hides /usr/share/emacs/31.0.50/lisp/org/ox-texinfo /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-C hides /usr/share/emacs/31.0.50/lisp/org/ob-C /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-w3m hides /usr/share/emacs/31.0.50/lisp/org/ol-w3m /home/gautier/.local/share/emacs/packages/org-9.7.10/org hides /usr/share/emacs/31.0.50/lisp/org/org /home/gautier/.local/share/emacs/packages/org-9.7.10/org-feed hides /usr/share/emacs/31.0.50/lisp/org/org-feed /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-emacs-lisp hides /usr/share/emacs/31.0.50/lisp/org/ob-emacs-lisp /home/gautier/.local/share/emacs/packages/org-9.7.10/org-goto hides /usr/share/emacs/31.0.50/lisp/org/org-goto /home/gautier/.local/share/emacs/packages/org-9.7.10/org-macs hides /usr/share/emacs/31.0.50/lisp/org/org-macs /home/gautier/.local/share/emacs/packages/org-9.7.10/org-attach hides /usr/share/emacs/31.0.50/lisp/org/org-attach /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-ruby hides /usr/share/emacs/31.0.50/lisp/org/ob-ruby /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-maxima hides /usr/share/emacs/31.0.50/lisp/org/ob-maxima /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-lilypond hides /usr/share/emacs/31.0.50/lisp/org/ob-lilypond /home/gautier/.local/share/emacs/packages/org-9.7.10/org-fold-core hides /usr/share/emacs/31.0.50/lisp/org/org-fold-core /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-python hides /usr/share/emacs/31.0.50/lisp/org/ob-python /home/gautier/.local/share/emacs/packages/org-9.7.10/oc hides /usr/share/emacs/31.0.50/lisp/org/oc /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-odt hides /usr/share/emacs/31.0.50/lisp/org/ox-odt /home/gautier/.local/share/emacs/packages/org-9.7.10/oc-natbib hides /usr/share/emacs/31.0.50/lisp/org/oc-natbib /home/gautier/.local/share/emacs/packages/org-9.7.10/oc-basic hides /usr/share/emacs/31.0.50/lisp/org/oc-basic /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-info hides /usr/share/emacs/31.0.50/lisp/org/ol-info /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-man hides /usr/share/emacs/31.0.50/lisp/org/ol-man /home/gautier/.local/share/emacs/packages/org-9.7.10/org-element hides /usr/share/emacs/31.0.50/lisp/org/org-element /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-fortran hides /usr/share/emacs/31.0.50/lisp/org/ob-fortran /home/gautier/.local/share/emacs/packages/org-9.7.10/oc-csl hides /usr/share/emacs/31.0.50/lisp/org/oc-csl /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-ascii hides /usr/share/emacs/31.0.50/lisp/org/ox-ascii /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-gnuplot hides /usr/share/emacs/31.0.50/lisp/org/ob-gnuplot /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-calc hides /usr/share/emacs/31.0.50/lisp/org/ob-calc /home/gautier/.local/share/emacs/packages/org-9.7.10/ol hides /usr/share/emacs/31.0.50/lisp/org/ol /home/gautier/.local/share/emacs/packages/org-9.7.10/org-pcomplete hides /usr/share/emacs/31.0.50/lisp/org/org-pcomplete /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-java hides /usr/share/emacs/31.0.50/lisp/org/ob-java /home/gautier/.local/share/emacs/packages/org-9.7.10/org-loaddefs hides /usr/share/emacs/31.0.50/lisp/org/org-loaddefs /home/gautier/.local/share/emacs/packages/org-9.7.10/org-macro hides /usr/share/emacs/31.0.50/lisp/org/org-macro /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-bbdb hides /usr/share/emacs/31.0.50/lisp/org/ol-bbdb /home/gautier/.local/share/emacs/packages/org-9.7.10/org-fold hides /usr/share/emacs/31.0.50/lisp/org/org-fold /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-publish hides /usr/share/emacs/31.0.50/lisp/org/ox-publish /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-forth hides /usr/share/emacs/31.0.50/lisp/org/ob-forth /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-icalendar hides /usr/share/emacs/31.0.50/lisp/org/ox-icalendar /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-octave hides /usr/share/emacs/31.0.50/lisp/org/ob-octave /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-lob hides /usr/share/emacs/31.0.50/lisp/org/ob-lob /home/gautier/.local/share/emacs/packages/org-9.7.10/org-keys hides /usr/share/emacs/31.0.50/lisp/org/org-keys /home/gautier/.local/share/emacs/packages/org-9.7.10/org-plot hides /usr/share/emacs/31.0.50/lisp/org/org-plot /home/gautier/.local/share/emacs/packages/org-9.7.10/org-agenda hides /usr/share/emacs/31.0.50/lisp/org/org-agenda /home/gautier/.local/share/emacs/packages/org-9.7.10/org-compat hides /usr/share/emacs/31.0.50/lisp/org/org-compat /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-lisp hides /usr/share/emacs/31.0.50/lisp/org/ob-lisp /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-ditaa hides /usr/share/emacs/31.0.50/lisp/org/ob-ditaa /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-beamer hides /usr/share/emacs/31.0.50/lisp/org/ox-beamer /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-rmail hides /usr/share/emacs/31.0.50/lisp/org/ol-rmail /home/gautier/.local/share/emacs/packages/org-9.7.10/org-refile hides /usr/share/emacs/31.0.50/lisp/org/org-refile /home/gautier/.local/share/emacs/packages/org-9.7.10/org-datetree hides /usr/share/emacs/31.0.50/lisp/org/org-datetree /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-mhe hides /usr/share/emacs/31.0.50/lisp/org/ol-mhe /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-html hides /usr/share/emacs/31.0.50/lisp/org/ox-html /home/gautier/.local/share/emacs/packages/org-9.7.10/org-timer hides /usr/share/emacs/31.0.50/lisp/org/org-timer /home/gautier/.local/share/emacs/packages/org-9.7.10/org-habit hides /usr/share/emacs/31.0.50/lisp/org/org-habit /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-ocaml hides /usr/share/emacs/31.0.50/lisp/org/ob-ocaml /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-tangle hides /usr/share/emacs/31.0.50/lisp/org/ob-tangle /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-eshell hides /usr/share/emacs/31.0.50/lisp/org/ol-eshell /home/gautier/.local/share/emacs/packages/org-9.7.10/org-mouse hides /usr/share/emacs/31.0.50/lisp/org/org-mouse /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-css hides /usr/share/emacs/31.0.50/lisp/org/ob-css /home/gautier/.local/share/emacs/packages/org-9.7.10/org-protocol hides /usr/share/emacs/31.0.50/lisp/org/org-protocol /home/gautier/.local/share/emacs/packages/org-9.7.10/org-crypt hides /usr/share/emacs/31.0.50/lisp/org/org-crypt /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-doi hides /usr/share/emacs/31.0.50/lisp/org/ol-doi /home/gautier/.local/share/emacs/packages/org-9.7.10/org-colview hides /usr/share/emacs/31.0.50/lisp/org/org-colview /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-eval hides /usr/share/emacs/31.0.50/lisp/org/ob-eval /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-scheme hides /usr/share/emacs/31.0.50/lisp/org/ob-scheme /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-irc hides /usr/share/emacs/31.0.50/lisp/org/ol-irc /home/gautier/.local/share/emacs/packages/org-9.7.10/ox hides /usr/share/emacs/31.0.50/lisp/org/ox /home/gautier/.local/share/emacs/packages/org-9.7.10/org-list hides /usr/share/emacs/31.0.50/lisp/org/org-list /home/gautier/.local/share/emacs/packages/org-9.7.10/org-capture hides /usr/share/emacs/31.0.50/lisp/org/org-capture /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-sql hides /usr/share/emacs/31.0.50/lisp/org/ob-sql /home/gautier/.local/share/emacs/packages/org-9.7.10/org-cycle hides /usr/share/emacs/31.0.50/lisp/org/org-cycle /home/gautier/.local/share/emacs/packages/org-9.7.10/ob hides /usr/share/emacs/31.0.50/lisp/org/ob /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-sqlite hides /usr/share/emacs/31.0.50/lisp/org/ob-sqlite /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-sed hides /usr/share/emacs/31.0.50/lisp/org/ob-sed /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-lua hides /usr/share/emacs/31.0.50/lisp/org/ob-lua /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-eshell hides /usr/share/emacs/31.0.50/lisp/org/ob-eshell /home/gautier/.local/share/emacs/packages/org-9.7.10/org-inlinetask hides /usr/share/emacs/31.0.50/lisp/org/org-inlinetask /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-org hides /usr/share/emacs/31.0.50/lisp/org/ob-org /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-docview hides /usr/share/emacs/31.0.50/lisp/org/ol-docview /home/gautier/.local/share/emacs/packages/org-9.7.10/org-id hides /usr/share/emacs/31.0.50/lisp/org/org-id /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-R hides /usr/share/emacs/31.0.50/lisp/org/ob-R /home/gautier/.local/share/emacs/packages/org-9.7.10/org-indent hides /usr/share/emacs/31.0.50/lisp/org/org-indent /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-latex hides /usr/share/emacs/31.0.50/lisp/org/ob-latex /home/gautier/.local/share/emacs/packages/org-9.7.10/org-duration hides /usr/share/emacs/31.0.50/lisp/org/org-duration /home/gautier/.local/share/emacs/packages/org-9.7.10/org-ctags hides /usr/share/emacs/31.0.50/lisp/org/org-ctags /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-exp hides /usr/share/emacs/31.0.50/lisp/org/ob-exp /home/gautier/.local/share/emacs/packages/org-9.7.10/org-persist hides /usr/share/emacs/31.0.50/lisp/org/org-persist /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-comint hides /usr/share/emacs/31.0.50/lisp/org/ob-comint /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-core hides /usr/share/emacs/31.0.50/lisp/org/ob-core /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-haskell hides /usr/share/emacs/31.0.50/lisp/org/ob-haskell /home/gautier/.local/share/emacs/packages/org-9.7.10/org-num hides /usr/share/emacs/31.0.50/lisp/org/org-num /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-perl hides /usr/share/emacs/31.0.50/lisp/org/ob-perl /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-groovy hides /usr/share/emacs/31.0.50/lisp/org/ob-groovy /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-awk hides /usr/share/emacs/31.0.50/lisp/org/ob-awk /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-shell hides /usr/share/emacs/31.0.50/lisp/org/ob-shell /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-md hides /usr/share/emacs/31.0.50/lisp/org/ox-md /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-gnus hides /usr/share/emacs/31.0.50/lisp/org/ol-gnus /home/gautier/.local/share/emacs/packages/org-9.7.10/oc-biblatex hides /usr/share/emacs/31.0.50/lisp/org/oc-biblatex /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-org hides /usr/share/emacs/31.0.50/lisp/org/ox-org /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-screen hides /usr/share/emacs/31.0.50/lisp/org/ob-screen /home/gautier/.local/share/emacs/packages/org-9.7.10/org-element-ast hides /usr/share/emacs/31.0.50/lisp/org/org-element-ast /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-julia hides /usr/share/emacs/31.0.50/lisp/org/ob-julia /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-ref hides /usr/share/emacs/31.0.50/lisp/org/ob-ref /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-man hides /usr/share/emacs/31.0.50/lisp/org/ox-man /home/gautier/.local/share/emacs/packages/org-9.7.10/ol-bibtex hides /usr/share/emacs/31.0.50/lisp/org/ol-bibtex /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-js hides /usr/share/emacs/31.0.50/lisp/org/ob-js /home/gautier/.local/share/emacs/packages/org-9.7.10/org-attach-git hides /usr/share/emacs/31.0.50/lisp/org/org-attach-git /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-koma-letter hides /usr/share/emacs/31.0.50/lisp/org/ox-koma-letter /home/gautier/.local/share/emacs/packages/org-9.7.10/ox-latex hides /usr/share/emacs/31.0.50/lisp/org/ox-latex /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-dot hides /usr/share/emacs/31.0.50/lisp/org/ob-dot /home/gautier/.local/share/emacs/packages/org-9.7.10/org-faces hides /usr/share/emacs/31.0.50/lisp/org/org-faces /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-sass hides /usr/share/emacs/31.0.50/lisp/org/ob-sass /home/gautier/.local/share/emacs/packages/org-9.7.10/org-entities hides /usr/share/emacs/31.0.50/lisp/org/org-entities /home/gautier/.local/share/emacs/packages/org-9.7.10/org-footnote hides /usr/share/emacs/31.0.50/lisp/org/org-footnote /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-clojure hides /usr/share/emacs/31.0.50/lisp/org/ob-clojure /home/gautier/.local/share/emacs/packages/org-9.7.10/ob-matlab hides /usr/share/emacs/31.0.50/lisp/org/ob-matlab /home/gautier/.local/share/emacs/packages/org-9.7.10/org-archive hides /usr/share/emacs/31.0.50/lisp/org/org-archive /home/gautier/.local/share/emacs/packages/org-9.7.10/org-version hides /usr/share/emacs/31.0.50/lisp/org/org-version Features: (shadow sort mail-extr emacsbug cus-start modus-vivendi-theme debbugs-gnu debbugs-compat debbugs soap-client rng-xsd rng-dt rng-util xsd-regexp sqlite emacsql-sqlite-common warnings emacsql emacsql-compiler loaddefs-gen lisp-mnt radix-tree tar-mode arc-mode archive-mode mm-archive mule-util network-stream url-cache url-http url-auth url-gw nsm display-line-numbers finder-inf char-fold view 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 compile 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 vc-git vc-dispatcher visual-wrap 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 ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core org-keys oc org-loaddefs find-func org-version org-compat org-macs notifications dbus 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 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 cape corfu vertico-directory vertico mb-depth jinx tempel compat delsel goto-addr modus-operandi-theme pulsar pulse color cus-edit cus-load wid-edit lin hl-line face-remap modus-themes edmacro kmacro cl-extra help-mode use-package-bind-key bind-key easy-mmode use-package-ensure use-package-core burly frameset thingatpt bookmark text-property-search pp winner ring repeat word-wrap-mode auctex-autoloads tex-site burly-autoloads cape-autoloads corfu-autoloads debbugs-autoloads elfeed-autoloads embark-consult-autoloads consult-autoloads embark-autoloads forge-autoloads closql-autoloads emacsql-autoloads fountain-mode-autoloads ghub-autoloads gnuplot-autoloads htmlize-autoloads jinx-autoloads ledger-mode-autoloads lin-autoloads magit-autoloads pcase git-commit-autoloads magit-section-autoloads dash-autoloads marginalia-autoloads markdown-mode-autoloads modus-themes-autoloads nov-autoloads ol-notmuch-autoloads notmuch-autoloads orderless-autoloads org-autoloads osm-autoloads parsebib-autoloads pdf-tools-autoloads pulsar-autoloads rainbow-mode-autoloads tablist-autoloads tempel-autoloads transient-autoloads trashed-autoloads treepy-autoloads vertico-autoloads visual-fill-column-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 emacs) Memory information: ((conses 16 3076867 314883) (symbols 48 48860 3) (strings 32 460986 132416) (string-bytes 1 13110413) (vectors 16 367812) (vector-slots 8 4143966 163480) (floats 8 8450 2122) (intervals 56 274559 7666) (buffers 992 25)) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-19 21:39 bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers Gautier Ponsinet @ 2024-08-20 0:46 ` Jim Porter 2024-08-20 11:53 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Jim Porter @ 2024-08-20 0:46 UTC (permalink / raw) To: Gautier Ponsinet, 72721; +Cc: eliz [-- Attachment #1: Type: text/plain, Size: 1271 bytes --] On 8/19/2024 2:39 PM, Gautier Ponsinet wrote: > Hello everyone, > > The new visual-wrap-prefix-mode breaks the rendering of the Magit Log > buffers. > > In emacs -Q: > * Install Magit and its dependencies and load Magit. > * Go to a local repository (via M-x dired or M-x cd). > * M-x global-visual-wrap-prefix-mode > * M-x magit-log-current > > Could someone please confirm/reproduce? I can confirm this. I'm not quite sure of all the details, but it seem that this is due to a bad interaction between overlays and the 'min-width' display spec. The end result was that we were calling 'get-text-property' with a (large-ish) buffer position when the OBJECT arg was a string of length 1. That can happen in magit-log on the mostly-blank line where it's making the ASCII art just below a merge commit. (The leading whitespace makes 'visual-wrap-prefix-mode' do its thing.) I'm not super familiar with how the display engine works, but I think we don't want to call 'display_min_width' when we're working with an overlay. See the attached patch. Eli, I'm sure you understand this code much better than me. Does the above make sense? I can also try to improve the commentary in the code, but I'm just making some educated guesses as to what's happening here. [-- Attachment #2: 0001-Fix-bad-interaction-between-min-width-display-spec-a.patch --] [-- Type: text/plain, Size: 1477 bytes --] From da02157ee69c6ae2a220a8f38a9cd8c0f7105641 Mon Sep 17 00:00:00 2001 From: Jim Porter <jporterbugs@gmail.com> Date: Mon, 19 Aug 2024 17:38:47 -0700 Subject: [PATCH] Fix bad interaction between 'min-width' display spec and overlays * src/xdisp.c (handle_display_prop): Don't handle 'min-width' when iterating over a string (bug#72721). --- src/xdisp.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 30771a1c83d..bd6657fe522 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5791,14 +5791,18 @@ handle_display_prop (struct it *it) propval = get_char_property_and_overlay (make_fixnum (position->charpos), Qdisplay, object, &overlay); - /* Rest of the code must have OBJECT be either a string or a buffer. */ + if (!STRINGP (it->string)) - object = it->w->contents; + { + /* Rest of the code must have OBJECT be either a string or a buffer. */ + object = it->w->contents; - /* Handle min-width ends. */ - if (!NILP (it->min_width_property) - && NILP (find_display_property (propval, Qmin_width))) - display_min_width (it, bufpos, object, Qnil); + /* Handle min-width ends. This doesn't apply while iterating over + a string. */ + if (!NILP (it->min_width_property) + && NILP (find_display_property (propval, Qmin_width))) + display_min_width (it, bufpos, object, Qnil); + } if (NILP (propval)) return HANDLED_NORMALLY; -- 2.25.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-20 0:46 ` Jim Porter @ 2024-08-20 11:53 ` Eli Zaretskii 2024-08-20 17:33 ` Jim Porter 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2024-08-20 11:53 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Mon, 19 Aug 2024 17:46:18 -0700 > Cc: eliz@gnu.org > From: Jim Porter <jporterbugs@gmail.com> > > On 8/19/2024 2:39 PM, Gautier Ponsinet wrote: > > Hello everyone, > > > > The new visual-wrap-prefix-mode breaks the rendering of the Magit Log > > buffers. > > > > In emacs -Q: > > * Install Magit and its dependencies and load Magit. > > * Go to a local repository (via M-x dired or M-x cd). > > * M-x global-visual-wrap-prefix-mode > > * M-x magit-log-current > > > > Could someone please confirm/reproduce? > > I can confirm this. I'm not quite sure of all the details, but it seem > that this is due to a bad interaction between overlays and the > 'min-width' display spec. The end result was that we were calling > 'get-text-property' with a (large-ish) buffer position when the OBJECT > arg was a string of length 1. That can happen in magit-log on the > mostly-blank line where it's making the ASCII art just below a merge > commit. (The leading whitespace makes 'visual-wrap-prefix-mode' do its > thing.) > > I'm not super familiar with how the display engine works, but I think we > don't want to call 'display_min_width' when we're working with an > overlay. See the attached patch. I'd appreciate a reproducer without Magit, as I don't have it installed and would prefer not to have to. > Eli, I'm sure you understand this code much better than me. Does the > above make sense? I can also try to improve the commentary in the code, > but I'm just making some educated guesses as to what's happening here. It looks like you are breaking min-width support for display strings? They are used on the mode line and also in other places, and in general, min-width should treat buffers and strings alike. Can you explain the motivation for the proposed changes, and describe what you saw with the current code in this case? Where's the call to get-text-property and why did it use a buffer position instead of a string position? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-20 11:53 ` Eli Zaretskii @ 2024-08-20 17:33 ` Jim Porter 2024-08-20 19:01 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Jim Porter @ 2024-08-20 17:33 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721, gautier [-- Attachment #1: Type: text/plain, Size: 3405 bytes --] On 8/20/2024 4:53 AM, Eli Zaretskii wrote: >> Date: Mon, 19 Aug 2024 17:46:18 -0700 >> Cc: eliz@gnu.org >> From: Jim Porter <jporterbugs@gmail.com> >> >> On 8/19/2024 2:39 PM, Gautier Ponsinet wrote: >>> Hello everyone, >>> >>> The new visual-wrap-prefix-mode breaks the rendering of the Magit Log >>> buffers. >>> >>> In emacs -Q: >>> * Install Magit and its dependencies and load Magit. >>> * Go to a local repository (via M-x dired or M-x cd). >>> * M-x global-visual-wrap-prefix-mode >>> * M-x magit-log-current >>> >>> Could someone please confirm/reproduce? >> >> I can confirm this. I'm not quite sure of all the details, but it seem >> that this is due to a bad interaction between overlays and the >> 'min-width' display spec. The end result was that we were calling >> 'get-text-property' with a (large-ish) buffer position when the OBJECT >> arg was a string of length 1. That can happen in magit-log on the >> mostly-blank line where it's making the ASCII art just below a merge >> commit. (The leading whitespace makes 'visual-wrap-prefix-mode' do its >> thing.) >> >> I'm not super familiar with how the display engine works, but I think we >> don't want to call 'display_min_width' when we're working with an >> overlay. See the attached patch. > > I'd appreciate a reproducer without Magit, as I don't have it > installed and would prefer not to have to. Me too... I haven't been able to get a reduced test case yet since Magit is pretty complex and I haven't figured out what it's doing exactly. It *seems* to be due to overlays, but I only know that from examining things in GDB. I haven't deciphered the relevant Magit code yet. >> Eli, I'm sure you understand this code much better than me. Does the >> above make sense? I can also try to improve the commentary in the code, >> but I'm just making some educated guesses as to what's happening here. > > It looks like you are breaking min-width support for display strings? > They are used on the mode line and also in other places, and in > general, min-width should treat buffers and strings alike. Can you > explain the motivation for the proposed changes, and describe what you > saw with the current code in this case? Where's the call to > get-text-property and why did it use a buffer position instead of a > string position? You're probably right. I think my patch was a little over-aggressive (see attached for a more-surgical one). This patch may still be wrong, but hopefully it gets a bit closer to what we want. I think this is what's happening, in a bit more detail: magit-log-current uses overlays (I think to set up the right margin text?). When visual-wrap-prefix-mode ("vwpm") is enabled, the display engine goes through the buffer, finds the 'min-width' display property from vwpm and holds onto it. Next, it starts processing an overlay. Eventually, that calls 'handle_display_prop' for the overlay which calls 'display_min_width'. At this point, we have an object stored in 'it->min_width_property' (thanks to vwpm), the local variable 'object' is the overlay string, and 'bufpos' is the actual buffer position. Finally we call 'get_display_property' with the bufpos and object (which calls 'Fget_text_property'), and kaboom: 'object' is a string of length 1, but bufpos is much larger (~400 in my test). I've also attached a backtrace, though I'm not sure how informative it is on its own. [-- Attachment #2: 0001-Fix-bad-interaction-between-min-width-display-spec-a.patch --] [-- Type: text/plain, Size: 3421 bytes --] From 13fe68ebc2eb2fe7ca0ee4ac4733b3abc3ed0cab Mon Sep 17 00:00:00 2001 From: Jim Porter <jporterbugs@gmail.com> Date: Mon, 19 Aug 2024 17:38:47 -0700 Subject: [PATCH] Fix bad interaction between 'min-width' display spec and overlays Previously, when iterating over overlays, we would pass the overlay string and the buffer position to 'display_min_width', which would use those values to try to get the display property. However, the buffer position is very likely out of bounds for the overlay string! * src/xdisp.c (get_display_property): Rename BUFPOS to CHARPOS. (display_min_width): Take CHARPOS instead of BUFPOS, and get BUFPOS on our own. This way, we can be sure that when calling 'get_display_property', we provide it with the correct kind of position. (handle_display_prop): Pass the character pos of OBJECT's position to 'display_min_width' (bug#72721). --- src/xdisp.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 30771a1c83d..af93a824bee 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5633,17 +5633,19 @@ find_display_property (Lisp_Object disp, Lisp_Object prop) } static Lisp_Object -get_display_property (ptrdiff_t bufpos, Lisp_Object prop, Lisp_Object object) +get_display_property (ptrdiff_t charpos, Lisp_Object prop, Lisp_Object object) { - return find_display_property (Fget_text_property (make_fixnum (bufpos), + return find_display_property (Fget_text_property (make_fixnum (charpos), Qdisplay, object), prop); } static void -display_min_width (struct it *it, ptrdiff_t bufpos, +display_min_width (struct it *it, ptrdiff_t charpos, Lisp_Object object, Lisp_Object width_spec) { + ptrdiff_t bufpos = CHARPOS (it->current.pos); + /* We're being called at the end of the `min-width' sequence, probably. */ if (!NILP (it->min_width_property) @@ -5658,9 +5660,9 @@ display_min_width (struct it *it, ptrdiff_t bufpos, get_display_property (0, Qmin_width, object))) /* In a buffer -- check that we're really right after the sequence of characters covered by this `min-width'. */ - || (bufpos > BEGV + || (bufpos > BEGV && charpos > 0 && EQ (it->min_width_property, - get_display_property (bufpos - 1, Qmin_width, object)))) + get_display_property (charpos - 1, Qmin_width, object)))) { Lisp_Object w = Qnil; double width; @@ -5713,9 +5715,9 @@ display_min_width (struct it *it, ptrdiff_t bufpos, && !EQ (it->min_width_property, get_display_property (0, Qmin_width, object))) /* Buffer. */ - || (bufpos > BEGV + || (bufpos > BEGV && charpos > 0 && !EQ (width_spec, - get_display_property (bufpos - 1, Qmin_width, object)))) + get_display_property (charpos - 1, Qmin_width, object)))) { it->min_width_property = width_spec; it->min_width_start = it->current_x; @@ -5795,10 +5797,10 @@ handle_display_prop (struct it *it) if (!STRINGP (it->string)) object = it->w->contents; - /* Handle min-width ends. */ + /* Handle min-width ends, except when processing an overlay. */ if (!NILP (it->min_width_property) && NILP (find_display_property (propval, Qmin_width))) - display_min_width (it, bufpos, object, Qnil); + display_min_width (it, CHARPOS (*position), object, Qnil); if (NILP (propval)) return HANDLED_NORMALLY; -- 2.25.1 [-- Attachment #3: backtrace.txt --] [-- Type: text/plain, Size: 2987 bytes --] #0 raise (sig=sig@entry=5) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00005555555e78aa in display_min_width (it=it@entry=0x7fffffff7500, bufpos=bufpos@entry=440, object=object@entry=0x5555572a2f14, width_spec=width_spec@entry=0x0) at ../../src/xdisp.c:5653 #2 0x00005555555e9fe0 in handle_display_prop (it=0x7fffffff7500) at ../../src/lisp.h:1178 #3 0x00005555555e2f85 in handle_stop (it=0x7fffffff7500) at ../../src/xdisp.c:4162 #4 0x00005555555f0998 in next_element_from_buffer (it=0x7fffffff7500) at ../../src/xdisp.c:9701 #5 0x00005555555ee675 in get_next_display_element (it=it@entry=0x7fffffff7500) at ../../src/xdisp.c:8267 #6 0x00005555555f4ea8 in display_line (it=0x7fffffff7500, cursor_vpos=<optimized out>) at ../../src/xdisp.c:25395 #7 0x00005555555f98f1 in try_window (window=window@entry=0x5555572e1ecd, pos=..., flags=flags@entry=1) at ../../src/xdisp.c:21214 #8 0x0000555555618790 in redisplay_window (window=0x5555572e1ecd, just_this_one_p=<optimized out>) at ../../src/xdisp.c:20594 #9 0x000055555561ade3 in redisplay_window_0 (window=window@entry=0x5555572e1ecd) at ../../src/xdisp.c:18077 #10 0x00005555557676fc in internal_condition_case_1 (bfun=bfun@entry=0x55555561adb0 <redisplay_window_0>, arg=arg@entry=0x5555572e1ecd, handlers=<optimized out>, hfun=hfun@entry=0x5555555d2380 <redisplay_window_error>) at ../../src/eval.c:1622 #11 0x00005555555ceff9 in redisplay_windows (window=0x5555572e1ecd) at ../../src/xdisp.c:18046 #12 0x00005555555cf01d in redisplay_windows (window=0x5555572e1cad) at ../../src/xdisp.c:18040 #13 0x00005555556019c6 in redisplay_internal () at ../../src/xdisp.c:17445 #14 0x00005555556eb5b6 in read_char (commandflag=1, map=0x7fffe74a7ad3, prev_event=0x0, used_mouse_menu=0x7fffffffdd8b, end_time=0x0) at ../../src/keyboard.c:2673 #15 0x00005555556eded5 in read_key_sequence (keybuf=0x7fffffffdee0, prompt=0x0, dont_downcase_last=<optimized out>, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=<optimized out>, disable_text_conversion_p=false) at ../../src/keyboard.c:10747 #16 0x00005555556efccf in command_loop_1 () at ../../src/lisp.h:1178 #17 0x0000555555767667 in internal_condition_case (bfun=bfun@entry=0x5555556efb00 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x5555556e2f90 <cmd_error>) at ../../src/eval.c:1598 #18 0x00005555556db6ea in command_loop_2 (handlers=handlers@entry=0x90) at ../../src/keyboard.c:1163 #19 0x0000555555767559 in internal_catch (tag=tag@entry=0x12450, func=func@entry=0x5555556db6c0 <command_loop_2>, arg=arg@entry=0x90) at ../../src/eval.c:1277 #20 0x00005555556db686 in command_loop () at ../../src/lisp.h:1178 #21 0x00005555556e2ae7 in recursive_edit_1 () at ../../src/keyboard.c:749 #22 0x00005555556e2ea4 in Frecursive_edit () at ../../src/keyboard.c:832 #23 0x00005555555b28c3 in main (argc=<optimized out>, argv=<optimized out>) at ../../src/emacs.c:2624 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-20 17:33 ` Jim Porter @ 2024-08-20 19:01 ` Eli Zaretskii 2024-08-21 3:15 ` Jim Porter 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2024-08-20 19:01 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Tue, 20 Aug 2024 10:33:06 -0700 > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > From: Jim Porter <jporterbugs@gmail.com> > > > I'd appreciate a reproducer without Magit, as I don't have it > > installed and would prefer not to have to. > > Me too... I haven't been able to get a reduced test case yet since Magit > is pretty complex and I haven't figured out what it's doing exactly. It > *seems* to be due to overlays, but I only know that from examining > things in GDB. I haven't deciphered the relevant Magit code yet. M-x describe-text-properties will show you the properties and overlays at point, and it should be possible to concoct some Lisp which just reproduces those properties. > > It looks like you are breaking min-width support for display strings? > > They are used on the mode line and also in other places, and in > > general, min-width should treat buffers and strings alike. Can you > > explain the motivation for the proposed changes, and describe what you > > saw with the current code in this case? Where's the call to > > get-text-property and why did it use a buffer position instead of a > > string position? > > You're probably right. I think my patch was a little over-aggressive > (see attached for a more-surgical one). This patch may still be wrong, > but hopefully it gets a bit closer to what we want. It still doesn't feel right. But min-width is weird, so I need to look into the problem deeper to understand what is going on, and if you will be able to come up with a reproducer without Magit, it will help. > > I think this is what's happening, in a bit more detail: > magit-log-current uses overlays (I think to set up the right margin > text?). When visual-wrap-prefix-mode ("vwpm") is enabled, the display > engine goes through the buffer, finds the 'min-width' display property > from vwpm and holds onto it. Next, it starts processing an overlay. > > Eventually, that calls 'handle_display_prop' for the overlay which calls > 'display_min_width'. At this point, we have an object stored in > 'it->min_width_property' (thanks to vwpm), the local variable 'object' > is the overlay string, and 'bufpos' is the actual buffer position. > > Finally we call 'get_display_property' with the bufpos and object (which > calls 'Fget_text_property'), and kaboom: 'object' is a string of length > 1, but bufpos is much larger (~400 in my test). This sounds like we shouldn't be calling get_display_property here, or use a different OBJECT when we call it. IOW, the object and the position must match, and since here they don't, there's a disconnect somewhere. We need to find that disconnect and understand why it happens. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-20 19:01 ` Eli Zaretskii @ 2024-08-21 3:15 ` Jim Porter 2024-08-21 5:18 ` Jim Porter 2024-08-22 9:53 ` Eli Zaretskii 0 siblings, 2 replies; 18+ messages in thread From: Jim Porter @ 2024-08-21 3:15 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721, gautier [-- Attachment #1: Type: text/plain, Size: 1717 bytes --] On 8/20/2024 12:01 PM, Eli Zaretskii wrote: >> Date: Tue, 20 Aug 2024 10:33:06 -0700 >> Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz >> From: Jim Porter <jporterbugs@gmail.com> >> >>> I'd appreciate a reproducer without Magit, as I don't have it >>> installed and would prefer not to have to. >> >> Me too... I haven't been able to get a reduced test case yet since Magit >> is pretty complex and I haven't figured out what it's doing exactly. It >> *seems* to be due to overlays, but I only know that from examining >> things in GDB. I haven't deciphered the relevant Magit code yet. > > M-x describe-text-properties will show you the properties and overlays > at point, and it should be possible to concoct some Lisp which just > reproduces those properties. I'd tried that but just wasn't looking at the right point. I've now figured it out and provided a few reduced test cases. (The "simple" and "consecutive" cases should already work.) While making these test cases, I noticed a similar issue with a nested 'display' property (see the "nested" case), and fixed that too (I hope!). > It still doesn't feel right. But min-width is weird, so I need to > look into the problem deeper to understand what is going on, and if > you will be able to come up with a reproducer without Magit, it will > help. Hopefully the attached reproducers help make sense of this. I've also updated my patch to handle 'min-width' in what I think is a simpler way. This implementation relies on the fact that you can't nest 'min-width' specs (the iterator struct can only hold one spec at a time). I'm guessing on some of these parts, so I may be totally off-base, but the test cases do what I expect anyway... [-- Attachment #2: 0001-Fix-bad-interaction-between-min-width-display-spec-a.patch --] [-- Type: text/plain, Size: 3421 bytes --] From 13fe68ebc2eb2fe7ca0ee4ac4733b3abc3ed0cab Mon Sep 17 00:00:00 2001 From: Jim Porter <jporterbugs@gmail.com> Date: Mon, 19 Aug 2024 17:38:47 -0700 Subject: [PATCH] Fix bad interaction between 'min-width' display spec and overlays Previously, when iterating over overlays, we would pass the overlay string and the buffer position to 'display_min_width', which would use those values to try to get the display property. However, the buffer position is very likely out of bounds for the overlay string! * src/xdisp.c (get_display_property): Rename BUFPOS to CHARPOS. (display_min_width): Take CHARPOS instead of BUFPOS, and get BUFPOS on our own. This way, we can be sure that when calling 'get_display_property', we provide it with the correct kind of position. (handle_display_prop): Pass the character pos of OBJECT's position to 'display_min_width' (bug#72721). --- src/xdisp.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 30771a1c83d..af93a824bee 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5633,17 +5633,19 @@ find_display_property (Lisp_Object disp, Lisp_Object prop) } static Lisp_Object -get_display_property (ptrdiff_t bufpos, Lisp_Object prop, Lisp_Object object) +get_display_property (ptrdiff_t charpos, Lisp_Object prop, Lisp_Object object) { - return find_display_property (Fget_text_property (make_fixnum (bufpos), + return find_display_property (Fget_text_property (make_fixnum (charpos), Qdisplay, object), prop); } static void -display_min_width (struct it *it, ptrdiff_t bufpos, +display_min_width (struct it *it, ptrdiff_t charpos, Lisp_Object object, Lisp_Object width_spec) { + ptrdiff_t bufpos = CHARPOS (it->current.pos); + /* We're being called at the end of the `min-width' sequence, probably. */ if (!NILP (it->min_width_property) @@ -5658,9 +5660,9 @@ display_min_width (struct it *it, ptrdiff_t bufpos, get_display_property (0, Qmin_width, object))) /* In a buffer -- check that we're really right after the sequence of characters covered by this `min-width'. */ - || (bufpos > BEGV + || (bufpos > BEGV && charpos > 0 && EQ (it->min_width_property, - get_display_property (bufpos - 1, Qmin_width, object)))) + get_display_property (charpos - 1, Qmin_width, object)))) { Lisp_Object w = Qnil; double width; @@ -5713,9 +5715,9 @@ display_min_width (struct it *it, ptrdiff_t bufpos, && !EQ (it->min_width_property, get_display_property (0, Qmin_width, object))) /* Buffer. */ - || (bufpos > BEGV + || (bufpos > BEGV && charpos > 0 && !EQ (width_spec, - get_display_property (bufpos - 1, Qmin_width, object)))) + get_display_property (charpos - 1, Qmin_width, object)))) { it->min_width_property = width_spec; it->min_width_start = it->current_x; @@ -5795,10 +5797,10 @@ handle_display_prop (struct it *it) if (!STRINGP (it->string)) object = it->w->contents; - /* Handle min-width ends. */ + /* Handle min-width ends, except when processing an overlay. */ if (!NILP (it->min_width_property) && NILP (find_display_property (propval, Qmin_width))) - display_min_width (it, bufpos, object, Qnil); + display_min_width (it, CHARPOS (*position), object, Qnil); if (NILP (propval)) return HANDLED_NORMALLY; -- 2.25.1 [-- Attachment #3: test-cases.el --] [-- Type: text/plain, Size: 1100 bytes --] (progn ;; Should look like: ;; 12345 ;; 678 90 (switch-to-buffer "simple") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 10 'display '((min-width (8))))) (progn ;; Should look like: ;; 12345 ;; 67 89 0 (switch-to-buffer "consecutive") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 9 'display '((min-width (4)))) (put-text-property 9 11 'display '((min-width (4))))) (progn ;; Should look like: ;; 12345 ;; hi 890 (switch-to-buffer "nested") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 9 'display (propertize "hi" 'display '((min-width (4)))))) (progn ;; Should look like: ;; 12345 | ;; 678 90 |X (switch-to-buffer "overlay") (erase-buffer) (insert "12345\n67890") (set-window-margins (selected-window) 0 1) (redisplay) (setq o (make-overlay 8 9)) (overlay-put o 'before-string (propertize "o" 'display '((margin right-margin) "X"))) (put-text-property 7 10 'display '((min-width (8))))) ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-21 3:15 ` Jim Porter @ 2024-08-21 5:18 ` Jim Porter 2024-08-21 19:12 ` Jim Porter 2024-08-22 9:59 ` Eli Zaretskii 2024-08-22 9:53 ` Eli Zaretskii 1 sibling, 2 replies; 18+ messages in thread From: Jim Porter @ 2024-08-21 5:18 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721, gautier [-- Attachment #1: Type: text/plain, Size: 508 bytes --] On 8/20/2024 8:15 PM, Jim Porter wrote: > Hopefully the attached reproducers help make sense of this. I've also > updated my patch to handle 'min-width' in what I think is a simpler way. > This implementation relies on the fact that you can't nest 'min-width' > specs (the iterator struct can only hold one spec at a time). I'm > guessing on some of these parts, so I may be totally off-base, but the > test cases do what I expect anyway... Whoops, I'd uploaded the wrong patch. Here's the correct one. [-- Attachment #2: 0001-Fix-bad-interactions-with-min-width-display-spec-and.patch --] [-- Type: text/plain, Size: 4647 bytes --] From f149cf2d6fbd9f864696620f94187e373812c919 Mon Sep 17 00:00:00 2001 From: Jim Porter <jporterbugs@gmail.com> Date: Mon, 19 Aug 2024 17:38:47 -0700 Subject: [PATCH] Fix bad interactions with 'min-width' display spec and replacement strings Previously, when iterating over overlays or replacement strings from a display spec, we would pass the string and the buffer position to 'display_min_width', which would use those values to try to get the display property. However, the buffer position is very likely out of bounds for the replacement string! (bug#72721) * src/xdisp.c (get_display_property): Rename BUFPOS to CHARPOS; OBJECT might not be a buffer. (display_min_width): Add CHARPOS argument and update callers. This helps us distinguish when we're still examining a replacement string. Simplify implementation to use a non-nil 'min_width_property' to determine what to do; since we can't nest 'min-width', this should be safe. It also lets us insert space into the buffer at the right time. --- src/xdisp.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 30771a1c83d..1fb9a436b8c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5633,15 +5633,15 @@ find_display_property (Lisp_Object disp, Lisp_Object prop) } static Lisp_Object -get_display_property (ptrdiff_t bufpos, Lisp_Object prop, Lisp_Object object) +get_display_property (ptrdiff_t charpos, Lisp_Object prop, Lisp_Object object) { - return find_display_property (Fget_text_property (make_fixnum (bufpos), + return find_display_property (Fget_text_property (make_fixnum (charpos), Qdisplay, object), prop); } static void -display_min_width (struct it *it, ptrdiff_t bufpos, +display_min_width (struct it *it, ptrdiff_t bufpos, ptrdiff_t charpos, Lisp_Object object, Lisp_Object width_spec) { /* We're being called at the end of the `min-width' sequence, @@ -5656,11 +5656,8 @@ display_min_width (struct it *it, ptrdiff_t bufpos, if ((bufpos == 0 && !EQ (it->min_width_property, get_display_property (0, Qmin_width, object))) - /* In a buffer -- check that we're really right after the - sequence of characters covered by this `min-width'. */ - || (bufpos > BEGV - && EQ (it->min_width_property, - get_display_property (bufpos - 1, Qmin_width, object)))) + /* In a buffer, and not working with a replacement string. */ + || (bufpos > BEGV && charpos > 0)) { Lisp_Object w = Qnil; double width; @@ -5705,21 +5702,13 @@ display_min_width (struct it *it, ptrdiff_t bufpos, /* We're at the start of a `min-width' sequence -- record the position and the property, so that we can later see if we're at the end. */ - if (CONSP (width_spec)) + if (CONSP (width_spec) + /* Make sure we're not actively processing a `min-width' sequence. + We can't currently nest them. */ + && NILP (it->min_width_property)) { - if (bufpos == BEGV - /* Mode line (see above). */ - || (bufpos == 0 - && !EQ (it->min_width_property, - get_display_property (0, Qmin_width, object))) - /* Buffer. */ - || (bufpos > BEGV - && !EQ (width_spec, - get_display_property (bufpos - 1, Qmin_width, object)))) - { - it->min_width_property = width_spec; - it->min_width_start = it->current_x; - } + it->min_width_property = width_spec; + it->min_width_start = it->current_x; } } @@ -5795,10 +5784,10 @@ handle_display_prop (struct it *it) if (!STRINGP (it->string)) object = it->w->contents; - /* Handle min-width ends. */ + /* Handle min-width ends. */ if (!NILP (it->min_width_property) && NILP (find_display_property (propval, Qmin_width))) - display_min_width (it, bufpos, object, Qnil); + display_min_width (it, bufpos, CHARPOS (*position), object, Qnil); if (NILP (propval)) return HANDLED_NORMALLY; @@ -6099,7 +6088,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, && CONSP (XCAR (XCDR (spec)))) { if (it) - display_min_width (it, bufpos, object, XCAR (XCDR (spec))); + display_min_width (it, bufpos, CHARPOS (*position), object, XCAR (XCDR (spec))); return 0; } @@ -29235,7 +29224,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st { Lisp_Object min_width = plist_get (display, Qmin_width); if (!NILP (min_width)) - display_min_width (it, 0, face_string, min_width); + display_min_width (it, 0, 0, face_string, min_width); } } } -- 2.25.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-21 5:18 ` Jim Porter @ 2024-08-21 19:12 ` Jim Porter 2024-08-22 12:54 ` Eli Zaretskii 2024-08-22 9:59 ` Eli Zaretskii 1 sibling, 1 reply; 18+ messages in thread From: Jim Porter @ 2024-08-21 19:12 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721, gautier [-- Attachment #1: Type: text/plain, Size: 1097 bytes --] On 8/20/2024 10:18 PM, Jim Porter wrote: > On 8/20/2024 8:15 PM, Jim Porter wrote: >> Hopefully the attached reproducers help make sense of this. I've also >> updated my patch to handle 'min-width' in what I think is a simpler >> way. This implementation relies on the fact that you can't nest >> 'min-width' specs (the iterator struct can only hold one spec at a >> time). I'm guessing on some of these parts, so I may be totally >> off-base, but the test cases do what I expect anyway... > > Whoops, I'd uploaded the wrong patch. Here's the correct one. ... and here's a new test case (overlay-min-width). This shows that now you can apply 'min-width' as an overlay property, which would be great for 'visual-wrap-prefix-mode'. I could then convert that code to use overlays (at least for 'min-width', maybe for 'wrap-prefix' too), which would make it easier to clean up when deactivating the mode. Of course, if there's a way to write regression tests for this, I'm happy to do so, but I've never looked into how (or if) one can write regression tests for display engine features. [-- Attachment #2: test-cases.el --] [-- Type: text/plain, Size: 1380 bytes --] (progn ;; Should look like: ;; 12345 ;; 678 90 (switch-to-buffer "simple") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 10 'display '((min-width (8))))) (progn ;; Should look like: ;; 12345 ;; 67 89 0 (switch-to-buffer "consecutive") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 9 'display '((min-width (4)))) (put-text-property 9 11 'display '((min-width (4))))) (progn ;; Should look like: ;; 12345 ;; hi 890 (switch-to-buffer "nested") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 9 'display (propertize "hi" 'display '((min-width (4)))))) (progn ;; Should look like: ;; 12345 | ;; 678 90 |X (switch-to-buffer "overlay") (erase-buffer) (insert "12345\n67890") (set-window-margins (selected-window) 0 1) (redisplay) (setq o (make-overlay 8 9)) (overlay-put o 'before-string (propertize "o" 'display '((margin right-margin) "X"))) (put-text-property 7 10 'display '((min-width (8))))) (progn ;; Should look like: ;; 12345 ;; 678 90 (switch-to-buffer "overlay-min-width") (erase-buffer) (insert "12345\n67890") (set-window-margins (selected-window) 0 1) (redisplay) (setq o (make-overlay 7 10)) (overlay-put o 'display '((min-width (8))))) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-21 19:12 ` Jim Porter @ 2024-08-22 12:54 ` Eli Zaretskii 0 siblings, 0 replies; 18+ messages in thread From: Eli Zaretskii @ 2024-08-22 12:54 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Wed, 21 Aug 2024 12:12:00 -0700 > From: Jim Porter <jporterbugs@gmail.com> > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > > ... and here's a new test case (overlay-min-width). This shows that now > you can apply 'min-width' as an overlay property, which would be great > for 'visual-wrap-prefix-mode'. I could then convert that code to use > overlays (at least for 'min-width', maybe for 'wrap-prefix' too), which > would make it easier to clean up when deactivating the mode. Doesn't adding support for overlays boils down to replacing Fget_text_property in get_display_property with Fget_char_property, and otherwise keeping the code intact? display_min_width is the only caller of get_display_property, so we can change that at will. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-21 5:18 ` Jim Porter 2024-08-21 19:12 ` Jim Porter @ 2024-08-22 9:59 ` Eli Zaretskii 1 sibling, 0 replies; 18+ messages in thread From: Eli Zaretskii @ 2024-08-22 9:59 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Tue, 20 Aug 2024 22:18:11 -0700 > From: Jim Porter <jporterbugs@gmail.com> > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > > Whoops, I'd uploaded the wrong patch. Here's the correct one. Thanks. I eventually decided to make the logic in display_min_width more robust wrt buffer vs string case, and also tried to handle the case of min-width property on Lisp strings, see the patch I sent. The case of min-width display spec on an overlay string that covers buffer text which itself has min-width spec is not handled yet, I think. Not sure this is needed, but if it is, we could add it in the future as an enhancement. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-21 3:15 ` Jim Porter 2024-08-21 5:18 ` Jim Porter @ 2024-08-22 9:53 ` Eli Zaretskii 2024-08-22 16:19 ` Jim Porter 1 sibling, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2024-08-22 9:53 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Tue, 20 Aug 2024 20:15:48 -0700 > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > From: Jim Porter <jporterbugs@gmail.com> > > > M-x describe-text-properties will show you the properties and overlays > > at point, and it should be possible to concoct some Lisp which just > > reproduces those properties. > > I'd tried that but just wasn't looking at the right point. I've now > figured it out and provided a few reduced test cases. (The "simple" and > "consecutive" cases should already work.) > > While making these test cases, I noticed a similar issue with a nested > 'display' property (see the "nested" case), and fixed that too (I hope!). Thanks for the test cases, they helped a lot. Can you please try the patch below, including in the original use case with Magit? I hope I've figured out all of the quirks of min-width and its possible uses, and the few extensions you demonstrated. It should be possible now to have min-width on overlay strings as well, I think (but I didn't test that). If the patch below gives good results, I will install it. diff --git a/src/xdisp.c b/src/xdisp.c index 30771a1..1e92ed4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5632,16 +5632,24 @@ find_display_property (Lisp_Object disp, Lisp_Object prop) return XCDR (elem); } +/* Return the value of 'display' property PROP of character at CHARPOS + in OBJECT. Return nil if character at CHARPOS has no 'display' + property or if the 'display' property of that character does not + include PROP. OBJECT can be a buffer or a string. */ static Lisp_Object -get_display_property (ptrdiff_t bufpos, Lisp_Object prop, Lisp_Object object) +get_display_property (ptrdiff_t charpos, Lisp_Object prop, Lisp_Object object) { - return find_display_property (Fget_text_property (make_fixnum (bufpos), + return find_display_property (Fget_text_property (make_fixnum (charpos), Qdisplay, object), prop); } +/* Handle 'display' property '(min-width (WIDTH))' at CHARPOS in OBJECT. + OBJECT can be a buffer (or nil, which means the current buffer) or a + string. MIN_WIDTH is the value of min-width spec that we expect to + process. */ static void -display_min_width (struct it *it, ptrdiff_t bufpos, +display_min_width (struct it *it, ptrdiff_t charpos, Lisp_Object object, Lisp_Object width_spec) { /* We're being called at the end of the `min-width' sequence, @@ -5652,15 +5660,21 @@ display_min_width (struct it *it, ptrdiff_t bufpos, /* When called from display_string (i.e., the mode line), we're being called with a string as the object, and we may be called with many sub-strings belonging to the same - :propertize run. */ - if ((bufpos == 0 - && !EQ (it->min_width_property, - get_display_property (0, Qmin_width, object))) + :propertize run. */ + if ((STRINGP (object) + && ((charpos == 0 + && !EQ (it->min_width_property, + get_display_property (0, Qmin_width, object))) + || (charpos > 0 + && EQ (it->min_width_property, + get_display_property (charpos - 1, Qmin_width, + object))))) /* In a buffer -- check that we're really right after the sequence of characters covered by this `min-width'. */ - || (bufpos > BEGV + || (!STRINGP (object) + && charpos > BEGV && EQ (it->min_width_property, - get_display_property (bufpos - 1, Qmin_width, object)))) + get_display_property (charpos - 1, Qmin_width, object)))) { Lisp_Object w = Qnil; double width; @@ -5707,15 +5721,18 @@ display_min_width (struct it *it, ptrdiff_t bufpos, the end. */ if (CONSP (width_spec)) { - if (bufpos == BEGV + if ((!STRINGP (object) + && charpos == BEGV) /* Mode line (see above). */ - || (bufpos == 0 + || (STRINGP (object) + && charpos == 0 && !EQ (it->min_width_property, get_display_property (0, Qmin_width, object))) /* Buffer. */ - || (bufpos > BEGV + || (!STRINGP (object) + && charpos > BEGV && !EQ (width_spec, - get_display_property (bufpos - 1, Qmin_width, object)))) + get_display_property (charpos - 1, Qmin_width, object)))) { it->min_width_property = width_spec; it->min_width_start = it->current_x; @@ -5798,7 +5815,17 @@ handle_display_prop (struct it *it) /* Handle min-width ends. */ if (!NILP (it->min_width_property) && NILP (find_display_property (propval, Qmin_width))) - display_min_width (it, bufpos, object, Qnil); + { + ptrdiff_t pos = bufpos, start = BEGV; + + if (STRINGP (object)) + { + pos = IT_STRING_CHARPOS (*it); + start = 0; + } + if (pos > start) + display_min_width (it, pos, object, Qnil); + } if (NILP (propval)) return HANDLED_NORMALLY; @@ -6099,7 +6126,13 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, && CONSP (XCAR (XCDR (spec)))) { if (it) - display_min_width (it, bufpos, object, XCAR (XCDR (spec))); + { + ptrdiff_t pos = bufpos; + + if (STRINGP (object)) + pos = IT_STRING_CHARPOS (*it); + display_min_width (it, pos, object, XCAR (XCDR (spec))); + } return 0; } @@ -9004,6 +9037,10 @@ set_iterator_to_next (struct it *it, bool reseat_p) next, if there is one. */ if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string)) { + /* Maybe add a stretch glyph if the string had 'min-width' + display spec. */ + display_min_width (it, IT_STRING_CHARPOS (*it), it->string, + Qnil); it->ellipsis_p = false; next_overlay_string (it); if (it->ellipsis_p) @@ -9019,6 +9056,12 @@ set_iterator_to_next (struct it *it, bool reseat_p) if (IT_STRING_CHARPOS (*it) == SCHARS (it->string) && it->sp > 0) { + /* Maybe add a stretch glyph if the string had 'min-width' + display spec. We only do this if it->sp > 0 because + mode-line strings are handled differently, see + display_min_width. */ + display_min_width (it, IT_STRING_CHARPOS (*it), it->string, + Qnil); pop_it (it); if (it->method == GET_FROM_STRING) goto consider_string_end; ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-22 9:53 ` Eli Zaretskii @ 2024-08-22 16:19 ` Jim Porter 2024-08-25 7:29 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Jim Porter @ 2024-08-22 16:19 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721, gautier On 8/22/2024 2:53 AM, Eli Zaretskii wrote: > Thanks for the test cases, they helped a lot. > > Can you please try the patch below, including in the original use case > with Magit? I hope I've figured out all of the quirks of min-width > and its possible uses, and the few extensions you demonstrated. It > should be possible now to have min-width on overlay strings as well, I > think (but I didn't test that). This works for me in all my test cases (except "overlay-min-width"), including the original report with Magit. I also replaced 'Fget_text_property' with 'Fget_char_property' in 'get_display_property' and tested that: it works with all my test cases, including "overlay-min-width". If you're not too worried about using 'Fget_char_property', I think that would be the preferable patch, since it would (probably?) make it easier for me to fix a small bug I noticed in 'visual-wrap-prefix-mode': I neglected to remove the 'min-width' properties when deactivating the mode. Using overlays for that might make it easier to wipe them out at the right time. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-22 16:19 ` Jim Porter @ 2024-08-25 7:29 ` Eli Zaretskii 2024-08-25 16:26 ` Jim Porter 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2024-08-25 7:29 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Thu, 22 Aug 2024 09:19:47 -0700 > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > From: Jim Porter <jporterbugs@gmail.com> > > On 8/22/2024 2:53 AM, Eli Zaretskii wrote: > > Thanks for the test cases, they helped a lot. > > > > Can you please try the patch below, including in the original use case > > with Magit? I hope I've figured out all of the quirks of min-width > > and its possible uses, and the few extensions you demonstrated. It > > should be possible now to have min-width on overlay strings as well, I > > think (but I didn't test that). > > This works for me in all my test cases (except "overlay-min-width"), > including the original report with Magit. I also replaced > 'Fget_text_property' with 'Fget_char_property' in 'get_display_property' > and tested that: it works with all my test cases, including > "overlay-min-width". > > If you're not too worried about using 'Fget_char_property', I think that > would be the preferable patch, since it would (probably?) make it easier > for me to fix a small bug I noticed in 'visual-wrap-prefix-mode': I > neglected to remove the 'min-width' properties when deactivating the > mode. Using overlays for that might make it easier to wipe them out at > the right time. I made the change to use Fget_char_property and installed the changeset on the master branch. Please note that overlays can be window-specific, and the changes I installed are supposed to handle that, but I didn't test that too much. Please test with window-specific overlays and see if it works correctly; if not, I'd appreciate a test case for looking into the failure. Thanks. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-25 7:29 ` Eli Zaretskii @ 2024-08-25 16:26 ` Jim Porter 2024-08-25 17:39 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Jim Porter @ 2024-08-25 16:26 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721, gautier [-- Attachment #1: Type: text/plain, Size: 606 bytes --] On 8/25/2024 12:29 AM, Eli Zaretskii wrote: > I made the change to use Fget_char_property and installed the > changeset on the master branch. Please note that overlays can be > window-specific, and the changes I installed are supposed to handle > that, but I didn't test that too much. Please test with > window-specific overlays and see if it works correctly; if not, I'd > appreciate a test case for looking into the failure. Thanks for merging. Everything looks correct to me. I've added a few more test cases to exercise window-specific overlays and they all work the way I'd expect. See attached. [-- Attachment #2: test-cases.el --] [-- Type: text/plain, Size: 2647 bytes --] (progn ;; Should look like: ;; 12345 ;; 678 90 (switch-to-buffer "simple") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 10 'display '((min-width (8))))) (progn ;; Should look like: ;; 12345 ;; 67 89 0 (switch-to-buffer "consecutive") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 9 'display '((min-width (4)))) (put-text-property 9 11 'display '((min-width (4))))) (progn ;; Should look like: ;; 12345 ;; hi 890 (switch-to-buffer "nested") (erase-buffer) (insert "12345\n67890") (redisplay) (put-text-property 7 9 'display (propertize "hi" 'display '((min-width (4)))))) (progn ;; Should look like: ;; 12345 | ;; 678 90 |X (switch-to-buffer "overlay") (erase-buffer) (insert "12345\n67890") (set-window-margins (selected-window) 0 1) (redisplay) (setq o (make-overlay 8 9)) (overlay-put o 'before-string (propertize "o" 'display '((margin right-margin) "X"))) (put-text-property 7 10 'display '((min-width (8))))) (progn ;; Should look like: ;; 12345 ;; 678 90 (switch-to-buffer "overlay-min-width") (erase-buffer) (insert "12345\n67890") (set-window-margins (selected-window) 0 1) (redisplay) (setq o (make-overlay 7 10)) (overlay-put o 'display '((min-width (8))))) (progn ;; Should look like: ;; 12345 | ;; 678 90 |X (switch-to-buffer "overlay-multi") (erase-buffer) (insert "12345\n67890") (set-window-margins (selected-window) 0 1) (redisplay) (setq o1 (make-overlay 7 10)) (overlay-put o1 'display '((min-width (8)))) (setq o2 (make-overlay 8 9)) (overlay-put o2 'before-string (propertize "o" 'display '((margin right-margin) "X")))) (progn ;; Should look like: ;; 12345 ;; 678 90 ;; ==================== ;; 12345 ;; 67890 (switch-to-buffer "overlay-window") (split-window-below) (erase-buffer) (insert "12345\n67890") (redisplay) (setq o (make-overlay 7 10)) (overlay-put o 'display '((min-width (8)))) (overlay-put o 'window (selected-window))) (progn ;; Should look like: ;; 12345 ;; 678 90 ;; ==================== ;; 12345 ;; 67 890 (switch-to-buffer "overlay-window-multi") (split-window-below) (erase-buffer) (insert "12345\n67890") (redisplay) (setq o1 (make-overlay 7 10)) (overlay-put o1 'display '((min-width (8)))) (overlay-put o1 'window (selected-window)) (setq o2 (make-overlay 7 9)) (overlay-put o2 'display '((min-width (5)))) (overlay-put o2 'window (car (last (window-list))))) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-25 16:26 ` Jim Porter @ 2024-08-25 17:39 ` Eli Zaretskii 2024-08-25 18:41 ` Jim Porter 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2024-08-25 17:39 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Sun, 25 Aug 2024 09:26:12 -0700 > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > From: Jim Porter <jporterbugs@gmail.com> > > Thanks for merging. Everything looks correct to me. I've added a few > more test cases to exercise window-specific overlays and they all work > the way I'd expect. See attached. Thanks. How about adding these to test/manual/redisplay-testsuite.el? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-25 17:39 ` Eli Zaretskii @ 2024-08-25 18:41 ` Jim Porter 2024-08-29 11:47 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Jim Porter @ 2024-08-25 18:41 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721, gautier [-- Attachment #1: Type: text/plain, Size: 663 bytes --] On 8/25/2024 10:39 AM, Eli Zaretskii wrote: >> Date: Sun, 25 Aug 2024 09:26:12 -0700 >> Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz >> From: Jim Porter <jporterbugs@gmail.com> >> >> Thanks for merging. Everything looks correct to me. I've added a few >> more test cases to exercise window-specific overlays and they all work >> the way I'd expect. See attached. > > Thanks. How about adding these to test/manual/redisplay-testsuite.el? Do these look ok? It tests everything except window-specific overlays. (I could probably add that too, but I'd have to think of a simple way to explain to the reader how they should verify the expected results.) [-- Attachment #2: 0001-Add-manual-tests-for-the-min-width-display-property.patch --] [-- Type: text/plain, Size: 3276 bytes --] From e36fe56d1e9783e72d4aa70324984dc210159324 Mon Sep 17 00:00:00 2001 From: Jim Porter <jporterbugs@gmail.com> Date: Sun, 25 Aug 2024 11:37:44 -0700 Subject: [PATCH] Add manual tests for the 'min-width' display property * test/manual/redisplay-testsuite.el (test-redisplay-5): Add some newlines. (test-redisplay-6): New function... (test-redisplay): ... call it (bug#72721). --- test/manual/redisplay-testsuite.el | 56 +++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/test/manual/redisplay-testsuite.el b/test/manual/redisplay-testsuite.el index 6d1232999ca..0f13c3da417 100644 --- a/test/manual/redisplay-testsuite.el +++ b/test/manual/redisplay-testsuite.el @@ -331,7 +331,60 @@ test-redisplay-5 (test-insert-overlay " " 'display (char-to-string #x3fffc))) (insert "\n\n") (insert-button "Toggle between octal and hex display" - 'action 'test-redisplay-5-toggle)) + 'action 'test-redisplay-5-toggle) + (insert "\n\n")) + +(defun test-redisplay-6 () + (insert "Test 6: min-width display property:\n\n") + (insert " Expected: 123 45\n") + (insert " Results: " + (propertize "123" 'display '((min-width (5)))) + "45") + (insert "\n\n") + (insert " Expected: 12 34 5\n") + (insert " Results: " + (propertize "12" 'display '((min-width (4)))) + (propertize "34" 'display '((min-width (4)))) + "5") + (insert "\n\n") + (insert " Expected: 1gnu 45\n") + (insert " Results: " + "1" + (propertize "23" 'display + (propertize "gnu" 'display '((min-width (5))))) + "45") + (insert "\n\n") + (insert " Expected: 123 45\n") + (insert " Results: ") + (test-insert-overlay "123" 'display '((min-width (5)))) + (insert "45") + (insert "\n\n") + (insert " Expected: 1_23 45\n") + (insert " Results: ") + (insert (propertize "123" 'display '((min-width (5))))) + (let ((overlay (make-overlay (- (point) 1) (- (point) 2)))) + (overlay-put overlay 'before-string "_")) + (insert "45") + (insert "\n\n") + (insert (propertize "_" 'display '(left-fringe large-circle)) + " Expected: 123 45\n") + (insert " Results: ") + (insert (propertize "123" 'display '((min-width (5))))) + (let ((overlay (make-overlay (- (point) 2) (- (point) 1)))) + (overlay-put overlay 'before-string + (propertize "_" 'display '(left-fringe large-circle)))) + (insert "45") + (insert "\n\n") + (insert (propertize "_" 'display '(left-fringe large-circle)) + " Expected: 123 45\n") + (insert " Results: ") + (insert (propertize "123" 'display '((min-width (5))))) + (let ((overlay1 (make-overlay (- (point) 3) (point))) + (overlay2 (make-overlay (- (point) 2) (- (point) 1)))) + (overlay-put overlay1 'display '((min-width (5)))) + (overlay-put overlay2 'before-string + (propertize "_" 'display '(left-fringe large-circle)))) + (insert "45")) (defun test-redisplay () (interactive) @@ -349,6 +402,7 @@ test-redisplay (test-redisplay-3) (test-redisplay-4) (test-redisplay-5) + (test-redisplay-6) (goto-char (point-min)))) ;;; redisplay-testsuite.el ends here -- 2.25.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-25 18:41 ` Jim Porter @ 2024-08-29 11:47 ` Eli Zaretskii 2024-08-30 5:01 ` Jim Porter 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2024-08-29 11:47 UTC (permalink / raw) To: Jim Porter; +Cc: 72721, gautier > Date: Sun, 25 Aug 2024 11:41:40 -0700 > Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz > From: Jim Porter <jporterbugs@gmail.com> > > > Thanks. How about adding these to test/manual/redisplay-testsuite.el? > > Do these look ok? It tests everything except window-specific overlays. LGTM, please install. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers 2024-08-29 11:47 ` Eli Zaretskii @ 2024-08-30 5:01 ` Jim Porter 0 siblings, 0 replies; 18+ messages in thread From: Jim Porter @ 2024-08-30 5:01 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 72721-done, gautier On 8/29/2024 4:47 AM, Eli Zaretskii wrote: >> Date: Sun, 25 Aug 2024 11:41:40 -0700 >> Cc: 72721@debbugs.gnu.org, gautier@gautierponsinet.xyz >> From: Jim Porter <jporterbugs@gmail.com> >> >>> Thanks. How about adding these to test/manual/redisplay-testsuite.el? >> >> Do these look ok? It tests everything except window-specific overlays. > > LGTM, please install. Done in 91851fbbf53. I think everything's done now for this bug, so closing this. (If I missed something, just let me know.) ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2024-08-30 5:01 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-08-19 21:39 bug#72721: 31.0.50; Visual-wrap-prefix-mode breaks Magit log buffers Gautier Ponsinet 2024-08-20 0:46 ` Jim Porter 2024-08-20 11:53 ` Eli Zaretskii 2024-08-20 17:33 ` Jim Porter 2024-08-20 19:01 ` Eli Zaretskii 2024-08-21 3:15 ` Jim Porter 2024-08-21 5:18 ` Jim Porter 2024-08-21 19:12 ` Jim Porter 2024-08-22 12:54 ` Eli Zaretskii 2024-08-22 9:59 ` Eli Zaretskii 2024-08-22 9:53 ` Eli Zaretskii 2024-08-22 16:19 ` Jim Porter 2024-08-25 7:29 ` Eli Zaretskii 2024-08-25 16:26 ` Jim Porter 2024-08-25 17:39 ` Eli Zaretskii 2024-08-25 18:41 ` Jim Porter 2024-08-29 11:47 ` Eli Zaretskii 2024-08-30 5:01 ` Jim Porter
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).