summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-01-13 15:40:30 +0200
committerEli Zaretskii <eliz@gnu.org>2022-01-13 15:40:30 +0200
commit1ee9275c1bb3fe7754188931d38c5b4404d5419f (patch)
tree620da8b73721a6c9deb02fd738d209dd7eeb5fc2
parent2dc4b1008db39d2ee7bc0b4b3e2ddb0bbd192ce9 (diff)
downloademacs-1ee9275c1bb3fe7754188931d38c5b4404d5419f.tar.gz
Avoid scrolling display when point moves into invisible text
* src/xdisp.c (try_cursor_movement): Handle point moving into invisible text. (Bug#53215)
-rw-r--r--src/xdisp.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 2326df4300d..977d31703fb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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)
{