]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid scrolling display when point moves into invisible text
authorEli Zaretskii <eliz@gnu.org>
Thu, 13 Jan 2022 13:40:30 +0000 (15:40 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 13 Jan 2022 13:40:30 +0000 (15:40 +0200)
* src/xdisp.c (try_cursor_movement): Handle point moving into
invisible text.  (Bug#53215)

src/xdisp.c

index 2326df4300d4b67643fa4f50d7eabbed723c65c1..977d31703fb00d2d8840a6f1ec4af45f15b728ff 100644 (file)
@@ -18557,6 +18557,20 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp,
                            || (NILP (g->object)
                                && (g->charpos == PT
                                    || (g->charpos == 0 && endpos - 1 == PT)));
+                         /* Perhaps the point position is inside
+                            invisible text?  In that case, we trust
+                            'set_cursor_from_row' to do its job and
+                            find the best position for the cursor.  */
+                         if (!exact_match_p)
+                           {
+                             Lisp_Object val =
+                               get_char_property_and_overlay (make_fixnum (PT),
+                                                              Qinvisible,
+                                                              Qnil, NULL);
+
+                             if (TEXT_PROP_MEANS_INVISIBLE (val) != 0)
+                               exact_match_p = true;
+                           }
                        }
                      if (at_zv_p || exact_match_p)
                        {