From cd2168cd131852279a7d9257c7dff45224c9d6a9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 19 Sep 2022 16:24:44 +0300 Subject: [PATCH] Fix 'posn-at-point' around several 'display' properties * src/xdisp.c (pos_visible_p): Fix the case when CHARPOS is hidden by a display property, and its neighbors are also hidden. (Bug#45915) --- src/xdisp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 80a07636951..ee074c018e5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1960,15 +1960,18 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, int top_x_before_string = it3.current_x; /* Finally, advance the iterator until we hit the first display element whose character position is - CHARPOS, or until the first newline from the - display string, which signals the end of the - display line. */ + at or beyond CHARPOS, or until the first newline + from the display string, which signals the end of + the display line. */ while (get_next_display_element (&it3)) { if (!EQ (it3.object, string)) top_x_before_string = it3.current_x; PRODUCE_GLYPHS (&it3); - if (IT_CHARPOS (it3) == charpos + if ((it3.bidi_it.scan_dir == 1 + && IT_CHARPOS (it3) >= charpos) + || (it3.bidi_it.scan_dir == -1 + && IT_CHARPOS (it3) <= charpos) || ITERATOR_AT_END_OF_LINE_P (&it3)) break; it3_moved = true; -- 2.39.2