]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid infinite loop with images under 'display-line-numbers-mode'
authorEli Zaretskii <eliz@gnu.org>
Fri, 21 Mar 2025 16:20:21 +0000 (18:20 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Mar 2025 18:15:52 +0000 (19:15 +0100)
* src/xdisp.c (move_it_in_display_line_to, display_line): When
considering the first glyph on a glyph row, take into
consideration the glyphs produced for line-number display.
(Bug#77065)

(cherry picked from commit df6669578001e49f44714301df71870654a2de33)

src/xdisp.c

index 00a7c5037864f5b0fe5ae1a872ce4c23faf261ef..5845f941a8fb95196d75fc1b2b677f7ff1f3772b 100644 (file)
@@ -10295,10 +10295,10 @@ move_it_in_display_line_to (struct it *it,
                {
                  bool moved_forward = false;
 
-                 if (/* IT->hpos == 0 means the very first glyph
-                        doesn't fit on the line, e.g. a wide
-                        image.  */
-                     it->hpos == 0
+                 if (/* IT->hpos == 0 (modulo line-number width) means
+                        the very first glyph doesn't fit on the line,
+                        e.g., a wide image.  */
+                     it->hpos == 0 + (it->lnum_width ? it->lnum_width + 2 : 0)
                      || (new_x == it->last_visible_x
                          && FRAME_WINDOW_P (it->f)))
                    {
@@ -25842,7 +25842,7 @@ display_line (struct it *it, int cursor_vpos)
                {
                  /* End of a continued line.  */
 
-                 if (it->hpos == 0
+                 if (it->hpos == 0 + (it->lnum_width ? it->lnum_width + 2 : 0)
                      || (new_x == it->last_visible_x
                          && FRAME_WINDOW_P (it->f)
                          && (row->reversed_p