From: Eli Zaretskii Date: Thu, 13 Jan 2022 13:40:30 +0000 (+0200) Subject: Avoid scrolling display when point moves into invisible text X-Git-Tag: emacs-29.0.90~3091 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1ee9275c1bb3fe7754188931d38c5b4404d5419f;p=emacs.git Avoid scrolling display when point moves into invisible text * src/xdisp.c (try_cursor_movement): Handle point moving into invisible text. (Bug#53215) --- 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) {