summaryrefslogtreecommitdiff
path: root/src/xdisp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index b5f013ea6a1..5dcf21dc4ce 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -34576,8 +34576,11 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
}
#endif /* HAVE_WINDOW_SYSTEM */
+ /* CHARPOS can be beyond the last position of STRING due, e.g., to
+ min-width 'display' property. Fix that, to let all the calls to
+ get-text-property below do their thing. */
if (STRINGP (string))
- pos = make_fixnum (charpos);
+ pos = make_fixnum (min (charpos, SCHARS (string) - 1));
/* Set the help text and mouse pointer. If the mouse is on a part
of the mode line without any text (e.g. past the right edge of