bug#81626: 32.0.50; string-pixel-width can return an incorrect value after commit 165152e

David Ponce via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Hello,

After commit  165152e
   Fix an infloop during cursor movement
   * src/xdisp.c (move_it_vertically_backward): Prevent infloop due
   to overlays with embedded newlines at BOB.  (Bug#81567)

`string-pixel-width' no more return a correct value if the
passed string is wider than the window body.  Here is a simple recipe to
test in the *scratch* buffer, running emacs -Q:

(window-body-width)
80
(window-body-width nil t)
960
(string-pixel-width (make-string 80 ?x))
960 <=== CORRECT
(string-pixel-width (make-string 81 ?x))
12  <=== INCORRECT

Before this commit the result is correct:

(window-body-width)
80
(window-body-width nil t)
960
(string-pixel-width (make-string 80 ?x))
960 <=== CORRECT
(string-pixel-width (make-string 81 ?x))
972 <=== CORRECT

Thanks


In GNU Emacs 32.0.50 (build 9, x86_64-pc-linux-gnu, GTK+ Version
  3.24.52, cairo version 1.18.4) of 2026-08-15
Repository revision: ef448d2ca996410f1f87b19740c1d4c2c6f37f7f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101024
System Description: Fedora Linux 44 (KDE Plasma Desktop Edition)

Configured using:
  'configure --with-native-compilation=no --with-tree-sitter=no --with-x
  --with-x-toolkit=gtk3 --with-cairo
  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINERAMA XINPUT2 XPM XRANDR GTK3 ZLIB

Important settings:
   value of $LC_TIME: fr_FR.utf8
   value of $LANG: fr_FR.UTF-8
   locale-coding-system: utf-8-unix
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.