From: Eli Zaretskii Date: Thu, 14 Apr 2022 17:40:24 +0000 (+0300) Subject: Fix mouse clicks in hscrolled window with variable-height fonts X-Git-Tag: emacs-29.0.90~1931^2~567 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=67e7870a621aacd8fd5d096fe673d86cc1f3a0f5;p=emacs.git Fix mouse clicks in hscrolled window with variable-height fonts * src/xdisp.c (move_it_in_display_line_to): Fix calculation of height of a screen-line that is completely hscrolled out of view. Reported by Yasushi SHOJI . --- diff --git a/src/xdisp.c b/src/xdisp.c index 6a0d0ea879a..2dbc68f657c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9910,6 +9910,18 @@ move_it_in_display_line_to (struct it *it, } else result = MOVE_NEWLINE_OR_CR; + /* If lines are truncated, and the line we moved across is + completely hscrolled out of view, reset the line metrics + to those of the newline we've just processed, so that + glyphs not on display don't affect the line's height. */ + if (it->line_wrap == TRUNCATE + && it->current_x <= it->first_visible_x + && result == MOVE_NEWLINE_OR_CR + && it->char_to_display == '\n') + { + it->max_ascent = it->ascent; + it->max_descent = it->descent; + } /* If we've processed the newline, make sure this flag is reset, as it must only be set when the newline itself is processed. */