]> git.eshelyaron.com Git - emacs.git/commit
Fix mouse highlighting for compact mode lines (bug#77336)
authorPengji Zhang <me@pengjiz.com>
Wed, 2 Apr 2025 12:52:30 +0000 (20:52 +0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 8 Apr 2025 05:43:10 +0000 (07:43 +0200)
commit5d55021145ad3687f548add4ad31aecdccf83c82
treebab2eda93073c0b1c71642431167c843362a15d0
parent85ae30e7b973c23c9ca06d04d6aca21b1632404f
Fix mouse highlighting for compact mode lines (bug#77336)

When 'mode-line-compact' is non-nil, the mode line string is
displayed as a whole.  That confuses the computation of ranges
of mouse highlighting on the mode line because all the glyphs
have the same Lisp object source.  As such, in this commit we
instead split the mode line string by sources, and display those
elements one by one, so the boundaries of each element could be
correctly detected for the purpose of mouse highlighting.

* src/xdisp.c (display_mode_line): Display mode line elements
one by one when 'mode-line-compact' is non-nil.
(display_mode_element): Record source element number of the
stored string via a text property.
(Fformat_mode_line): Initialize 'mode_line_elt_no' to 0.
(syms_of_xdisp): New symbol for the text property.

(cherry picked from commit c94f0d3dc82a72baa0ba8d69beda220aaf0b2d91)
src/xdisp.c