Subject: bug#13108: 24.3.50; previous-line sometimes moves up two lines instead of just one

From: Eli Zaretskii <[email-masked]>
Date: Fri, 07 Dec 2012 17:31:47 +0200

> Date: Fri, 7 Dec 2012 02:32:24 -0500
> From: Alp Aker <[email-masked]>
> Cc: [email-masked], Eli Zaretskii <[email-masked]>
> 
> > Repro recipe:
> >
> > gmacs -Q
> > M-x linum-mode RET  (in the *Scratch* buffer)
> > ctrl-p (moves up one line; yay)
> > ctrl-p (moves up two lines; boo!)
> 
> It seems to be due to the below commit.
> 
> revno: 110764.1.170
> fixes bug: http://debbugs.gnu.org/12930
> committer: Eli Zaretskii <[email-masked]>
> branch nick: emacs-24
> timestamp: Wed 2012-11-21 21:28:14 +0200
> message:
>   Fix bug #12930 with vertical-motion through a display string.
> 
>    src/indent.c (Fvertical_motion): If the starting position is covered
>    by a display string, return to one position before that, to avoid
>    overshooting it inside move_it_to.

Yes, sorry about that.  Fixed in revision 111007 on the emacs-24
branch.  Patch below, if you cannot wait for the next merge to the
trunk.

=== modified file 'src/indent.c'
--- src/indent.c	2012-11-21 19:28:14 +0000
+++ src/indent.c	2012-12-07 15:28:20 +0000
@@ -2034,7 +2034,11 @@ whether or not it is currently displayed
 	  const char *s = SSDATA (it.string);
 	  const char *e = s + SBYTES (it.string);
 
-	  disp_string_at_start_p = it.string_from_display_prop_p;
+	  /* If it.area is anything but TEXT_AREA, we need not bother
+	     about the display string, as it doesn't affect cursor
+	     positioning.  */
+	  disp_string_at_start_p =
+	    it.string_from_display_prop_p && it.area == TEXT_AREA;
 	  while (s < e)
 	    {
 	      if (*s++ == '\n')