GNU bug report logs - #77065
31.0.50; Infinite loop in move_it_to

Previous Next

Package: emacs;

Reported by: Yifan Zhu <fanzhuyifan <at> gmail.com>

Date: Mon, 17 Mar 2025 07:54:03 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #44 received at 77065 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yifan Zhu <fanzhuyifan <at> gmail.com>
Cc: 77065 <at> debbugs.gnu.org
Subject: Re: bug#77065: 31.0.50; Infinite loop in move_it_to
Date: Thu, 20 Mar 2025 12:39:50 +0200
> Date: Mon, 17 Mar 2025 19:36:15 -0700
> Cc: 77065 <at> debbugs.gnu.org
> From: Yifan Zhu <fanzhuyifan <at> gmail.com>
> 
> On 3/17/25 7:27 AM, Eli Zaretskii wrote:
> > Thanks, but I don't have access to a system where these prerequisites
> > can be met.  So either someone can reproduce this, debug the problem,
> > and describe the reason for the loop, or I'd need to ask you to do it,
> > if possible.  Or, if you can show a recipe for reproducing the problem
> > without installing LaTeX and xenops, I could try reproducing this on
> > the systems to which I have access.
> 
> Right now I have a conjecture about what might be causing the infinite 
> loop -- when line number are produced, we can no longer use it->hpos == 
> 0 to test if the glyph is the first glyph. Perhaps this is best 
> explained by the following diff:

Thanks for pointing out this issue.

The diff as posted is not entirely correct, since
move_it_in_display_line_to can be called in the middle of a line, and
then it is wrong to assume that the initial hpos is zero.  But the
patch below should fix this particular problem, I think; please try
it and tell if it avoids the infloop.

diff --git a/src/xdisp.c b/src/xdisp.c
index c396b213..90ec187 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10295,10 +10295,10 @@ #define IT_RESET_X_ASCENT_DESCENT(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)))
 		    {




This bug report was last modified 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.