Subject: bug#43948: 28.0.50; [PATHC][NS] Make s-<left/right> to move to beginning/end of line

From: Andrii Kolomoiets <[email-masked]>
Date: Fri, 13 Nov 2020 01:20:36 +0200

Eli Zaretskii <[email-masked]> writes:

>> 2. M-: (set-frame-width nil 50)
>> 3. M-<
>> 4. M-x end-of-visual-line
>> The point moved to the beginning of the next visual line
>
> What else did you expect, in a continued line?  There's no place to
> show the cursor except at the beginning of the next screen line.

Well, sometimes the cursor is on the fringe.  With "bar" cursor type
this leads to interesting behavior:
emacs -Q
M-: (set-frame-width nil 70)
M-: (setq cursor-type 'bar)

Now it's easy to place the cursor after the "." on the first line:
M-< C-e
But it is not possible to place the cursor after last "e" on the second
line.

IIRC it's because the cursor is actually "on" some character and not
"before" or "after" it.  And at the end of the first line the cursor is
on the "new line" character.

>> 5. M-<
>> 6. M-x toggle-truncate-lines
>> 7. M-x end-of-visual-line
>> The point is not moved to the end of the line.
>
> It is, but you need to disable auto-hscroll-mode to see that.

Yes, the point is correctly moved to the end of visual line.

I didn't mean to say the behavior of the 'end-of-visual-line' function
is wrong.  I tried to say that behavior of the 'end-of-visual-line'
function outside the 'visual-line-mode' can be surprising for the users
who press Command-<Right Arrow> to go to the end of the line.