Subject: bug#52163: 28.0.60; visual-line-mode breaks C-a and C-e in extreme case

From: Eli Zaretskii <[email-masked]>
Date: Sun, 16 Jan 2022 09:22:05 +0200

On January 16, 2022 12:53:21 AM GMT+02:00, Phil Sainty <[email-masked]> wrote:
> > Eli Zaretskii <[email-masked]> writes:
> > 
> >>> * Reproducing
> >>> - Case 1:
> >>>    emacs -Q
> >>>    C-u 999 a
> >>>    visual-line-mode
> >>>    C-p C-a
> >>>    C-e C-a
> >> 
> >> What are the problems you see in this recipe?  Please be specific,
> >> because it could be that what you see on your system we cannot see
> >> on ours.
> 
> I just tried that recipe, and with visual-line-mode (and
> line-move-visual) enabled C-e certainly doesn't behave how I'd expect.
> 
> Rather than C-e moving to the end of the current visual line, if the
> current visual line wraps then it moves to the beginning of the next
> visual line.  If I repeatedly press C-e, the cursor moves vertically
> down the first column of all those visual lines.  Only the final
> visual line of the logical line will it move to the end.
> 
> I'm seeing this in both 27.2 and GNU Emacs 28.0.90.
> 
> Further testing indicates that the lack of any spaces in the wrapped
> visual lines is a factor.  In a visual line with a space, the visual
> line will *end* with a space, and C-a will move to that.
> 
> In this recipe there are no such spaces, and the problem arises.

Where do you want Emacs to place the cursor when there's no whitespace at end of visual line?

IOW, before declaring that there is a problem, please be sure to consider any reasonable solutions.