Subject: bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay

From: Eli Zaretskii <[email-masked]>
Date: Fri, 30 Mar 2012 19:12:10 +0300

> From: Ivan Andrus <[email-masked]>
> Date: Fri, 30 Mar 2012 16:47:05 +0200
> 
> Put the following (including comments) in a buffer and evaluate.
> 
> #+begin_src emacs-lisp
> ;; Note that the next line is indented
>  ;; This buffer is for notes you don't want to save, and for Lisp evaluation.;; If you want to create a file, visit that file with C-x C-f,;; then enter the text in that file's own buffer.
> 
> ;; evaluate this
> (let ((ov (make-overlay
> 	   (progn (goto-char (point-min))
> 		  (forward-line)
> 		  (back-to-indentation)
> 		  (point))
> 	   (progn (end-of-line)
> 		  (point))
> 	   nil t nil)))
>  (overlay-put ov 'display
> 	       (make-string 500 ?b)))
> 
> #+end_src
> 
> Now run `previous-line' several times and it will get stuck at the
> indentation of the bbbbb line.  If you have an extremely wide screen you
> may need to shrink the emacs window so that the bbbb line wraps.  Also
> note that running `previous-line' with a large prefix-argument will
> move past the line

More accurately, "large enough" is the number of screen lines taken by
the overlay string.  In my case, it was 7.

> This does not seem to be a problem in Emacs 22.1.1 in a terminal which
> is the only other emacs I have easy access to.

This is a bug in visual line movement.  Visual line movement was
introduced in Emacs 23, that's why you don't see this in Emacs 22.  In
Emacs 23, the cursor gets stuck similarly, so this is not a regression
wrt Emacs 23.  Disable line-move-visual with the current 24 trunk, and
the problem will go away in Emacs 24 as well.

I will take a look when I have time.