]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix mouse clicks in hscrolled window with variable-height fonts
authorEli Zaretskii <eliz@gnu.org>
Thu, 14 Apr 2022 17:40:24 +0000 (20:40 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 14 Apr 2022 17:40:24 +0000 (20:40 +0300)
* 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 <yasushi.shoji@gmail.com>.

src/xdisp.c

index 6a0d0ea879ad1c77599d8bab91be773310f58103..2dbc68f657c2c64763c164d7ac994f3c995b880a 100644 (file)
@@ -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.  */