Subject: bug#14881: 24.3.50; Odd cursor movement with images (or lines with different heights?)

From: Eli Zaretskii <[email-masked]>
Date: Tue, 16 Jul 2013 21:29:26 +0300

> From: Lars Magne Ingebrigtsen <[email-masked]>
> Date: Tue, 16 Jul 2013 19:57:24 +0200
> 
> I've seen some increasingly odd cursor movements the last few weeks if I
> have images in a buffer.  To reproduce, have a frame that's 800 pixels
> high.  Eval the following:
> 
> (url-retrieve "http://quimby.gnus.org/circus/jukebox.php?image=micro.png&group=Phill%20Niblock&album=Touch%20Food%20%281%29"
> 	      (lambda (&rest args)
> 		(search-forward "\n\n")
> 		(let ((image (create-image
> 			      (buffer-substring (point) (point-max))
> 			      nil t)))
> 		  (pop-to-buffer "*test*")
> 		  (erase-buffer)
> 		  (dotimes (i 100)
> 		    (insert-image image "*")
> 		    (insert (format " foo %d\n" i))))))
> 
> Go to the first line in the buffer and hit `C-n'.  Instead of moving the
> cursor to the next line, the buffer is shifted one line up instead.

It is not supposed to move to the next line, it is supposed to vscroll
by the number of pixels that is the height of the default face's font
(16 pixels on my system, YMMV).  That is what line-move-visual option
does when auto-window-vscroll is non-nil, and both are on by default.

IOW, this is by design, except that Emacs was supposed to "shift" the
buffer by 1`6 pixels, not by the entire size of the image.

I will take a look to see why the vscroll scrolls by too much, but if
you don't want that at all, just customize auto-window-vscroll to nil.

> `C-u 2 C-n' will move point two lines down, however.  So the weird
> movement action apparently only happens when moving down a single line.

That's because auto-window-vscroll is only in effect when moving by
single lines.