GNU bug report logs - #53952
27.1; insert-image sometimes unexpectedly truncates images

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Sat, 12 Feb 2022 10:13:01 UTC

Severity: normal

Found in version 27.1

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Markus Triska <triska <at> metalevel.at>
Cc: 53952 <at> debbugs.gnu.org
Subject: bug#53952: 27.1; insert-image sometimes unexpectedly truncates images
Date: Sat, 12 Feb 2022 14:31:19 +0200
> From: Markus Triska <triska <at> metalevel.at>
> Date: Sat, 12 Feb 2022 11:12:37 +0100
> 
>     (defun insert-bar (width)
>       (let* ((height 5)
>              (data (with-temp-buffer
>                      (insert (format "P1\n%s %s\n" width height))
>                      (dotimes (_ height)
>                        (insert (make-string width ?1) "\n"))
>                      (buffer-string))))
>         (insert-image `(image :type pbm :data ,data)) "t"))
> 
>     (progn
>       (insert "\n")
>       (dotimes (_ 3)
>         (insert-bar (/ (window-pixel-width) 3))
>         (insert "         ")))
> 
> Then evaluate the forms with M-x eval-buffer RET.
> 
> The code is meant to insert 3 bars of equal length, each 1/3 of the
> window size in pixels.
> 
> Unexpectedly, the rightmost bar is much shorter than the other two bars.

Emacs doesn't support wrapping of images, it never did.  The display
engine chops images at the right edge of the window.

> I say "unexpectedly", because the documentation of insert-image (which
> is used to insert the image by the forms above) states:
> 
>     "If SLICE is ‘nil’ or omitted the whole image is inserted."

I added a note there about the forced truncation of images.

> If possible, I would like to insert the entire image no matter where it
> appears in the buffer, even if scrolling is necessary to reveal
> remaining parts. Is there a way to do this?

No, not with how we display images at this time.




This bug report was last modified 3 years and 124 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.