From 67e7870a621aacd8fd5d096fe673d86cc1f3a0f5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 14 Apr 2022 20:40:24 +0300 Subject: [PATCH] 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 . --- src/xdisp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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. */ -- 2.39.5