Subject: bug#78474: 31.0.50; Wrong char insertion in rxvt

From: Samuel Thibault <[email-masked]>
Date: Sun, 18 May 2025 11:33:00 +0200

Eli Zaretskii, le dim. 18 mai 2025 12:18:32 +0300, a ecrit:
> > Date: Sun, 18 May 2025 10:30:01 +0200
> > From: Samuel Thibault <[email-masked]>
> > Cc: [email-masked], [email-masked], [email-masked]
> > 
> > Eli Zaretskii, le dim. 18 mai 2025 11:05:49 +0300, a ecrit:
> > > > Eli Zaretskii, le dim. 18 mai 2025 08:13:58 +0300, a ecrit:
> > > > > > Quoting Samuel: "Emacs, instead of sending a rightward cursor movement
> > > > > > (\e[C), sends \009\008 (a tabulation and a leftward cursor movement)"
> > > > > 
> > > > > If Sébastien or Samuel (or someone else) can help us understand how to
> > > > > modify the cost calculations and/or what optimizations of cursor
> > > > > motion to avoid when these technologies for the visually impaired are
> > > > > used, we could see how to fix this.
> > > > 
> > > > That is exactly what is written above.
> > > 
> > > Sorry, I don't understand: what is written above?
> > 
> > ?
> > 
> > "Emacs, instead of sending a rightward cursor movement
> > (\e[C), sends \009\008 (a tabulation and a leftward cursor movement)"
> > 
> > that is the optimization that disturbs some terminals such as rxvt or
> > vte.
> 
> Yes, but what does that mean in general?  Should Emacs refrain from
> sending TAB in all the cases?

At least, having an option to avoid this optimization would be useful.

> Are there other characters that should not be sent for similar
> reasons?

I'm not aware of any other character movement sequence that would be
confused with text addition.

> Also, I'm a bit confused: you say that sending \009\008 disturbs rxvt
> or vte, but the original report seemed to be not about what the
> terminals do, but about what that causes to the various software
> solutions for the visually impaired.  Can you please tell more about
> this to resolve the confusion?

The eventual issue is that what when typing "coucou " in emacs, what
ends up sent by emacs to vte is "coucou\x09\x08", and what vte exposes
to accessibility technologies is "coucou\t", and it is then unable to
expose to them that the cursor position is in the middle of that "\t".

And it happens that rxvt gets a similar confusion, leading to that wide
cursor appearance
https://dept-info.labri.fr/~thibault/tmp/coucou.png

Samuel