Subject: bug#63807: bug in compose-gstring-for-terminal?

From: Eli Zaretskii <[email-masked]>
Date: Wed, 31 May 2023 17:30:25 +0300

> From: Mattias Engdegård <[email-masked]>
> Date: Wed, 31 May 2023 15:49:23 +0200
> Cc: [email-masked]
> 
> 31 maj 2023 kl. 15.02 skrev Eli Zaretskii <[email-masked]>:
> 
> > Setting i to 2 is correct there
> 
> Would you explain why to someone who doesn't know how this is supposed to work?

We basically concoct a glyph-string "by hand":

> 	      ;; Compose by prepending a space.
> 	      (setq gstring (lgstring-insert-glyph gstring i
> 						   (lglyph-copy glyph))
> 		    nglyphs (lgstring-glyph-len gstring))
> 	      (setq glyph (lgstring-glyph gstring i))
> 	      (lglyph-set-char glyph 32)
> 	      (lglyph-set-width glyph 1)

> The main question is whether changing the last assignment to (setq i (+ i 2)) would have unintended consequences. As far as I've been able to determine, testing and inspection say no, it should be completely safe.

If we agree that replacing (+ 2) with (+ i 2) is "completely safe",
then we basically agree that this code runs only when i == zero,
right?  Or did I misunderstand what you were saying?