Subject: bug#22098: 25.0.50; visual-line-mode and invisible text causes cursor to jump

From: Eli Zaretskii <[email-masked]>
Date: Sun, 06 Dec 2015 19:34:09 +0200

> From: Ian Dunn <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 06 Dec 2015 00:28:57 -0500
> 
> M-g M-g 19
> C-p
> C-M-: (add-text-properties (point) (1+ (point)) '(invisible t))
> C-n
> C-l C-l
> C-p

Thanks.  With this recipe, I do see some unusual behavior of the
cursor, but not the one you described.  On my system, the cursor stays
at its position before the final C-p, then, a fraction of second
later, jumps to its correct position.  It doesn't stay at the top line
of the window.

> > Also, is it really necessary to invoke the commands via M-x, or do you
> > see the same problem when you use C-n, C-l, and C-p instead?
> 
> I try not to assume that everyone has the same key-bindings as me, so I
> thought it might help to use the actual command names.

Yes, but you should be aware that this might make a difference for
redisplay problems: typing M-x causes a mildly thorough redisplay, so
it might obscure some problems and cause some others.  That's why I
asked.

> I forgot to mention in my original report that this seems similar to
> bug #17047
> (https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-03/msg00804.html).
> It looks like the old bug addressed the problem with forward-char
> and backward-char.  I've checked with next-line, but I've never seen
> it happen before.  I only ever see this problem with previous-line.

No, that's a different problem.  The problem discussed here happens
because point moves outside the window to the place that's invisible.
By contrast, bug #17047 was about a situation where the goal position
was visible in the window at all times.

Anyway, I fixed the problem I see here in commit cca5629 on the
emacs-25 branch.  Please see if your problem is solved by that change.

Thanks.