emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5568ac2db0: Fix error signaled by mouse-highlight on mode line


From: Eli Zaretskii
Subject: master 5568ac2db0: Fix error signaled by mouse-highlight on mode line
Date: Wed, 23 Nov 2022 09:19:05 -0500 (EST)

branch: master
commit 5568ac2db0fe2707676d9e4d1cfe027fba83767d
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix error signaled by mouse-highlight on mode line
    
    * src/xdisp.c (note_mode_line_or_margin_highlight): Avoid
    signaling args-out-of-range errors when mode-line format uses
    min-width 'display' property.  (Bug#59452)
---
 src/xdisp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index b5f013ea6a..5dcf21dc4c 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]