Subject: Re: bug#75333: 31.0.50; Feature-Request: Always keep cursor's position when pixel scrolling

From: Eli Zaretskii <[email-masked]>
Date: Sat, 04 Jan 2025 09:45:24 +0200

> From: Eason Huang <[email-masked]>
> Date: Sat, 04 Jan 2025 08:50:04 +0800
> 
> 
> Recently, when the cursor is inside the screen, it's positon will not
> move when pixel scrolling. But when the cursor touching the bording of
> window, it's position begin to change.
> 
> expected:
> 
> 1. when the cursor(line) is closed to the border of window, partially-visible
> the cursor
> 2. when the cursor(line) is outside the window, hide the cursor
> 3. wehn the cursor(line) is inside the window, show the cursor again
> 
> Or there already an option to enable this feature?
> 
> As I known, Apple Xcode and Microsoft Word have the same behavior as
> describe above.

Unlike other editors, Emacs' display engine was designed with the
explicit requirement that the position of point (what you call
"cursor") is always visible in the window.  So when the window is
scrolled for some reason, Emacs moves point to bring it back into the
visible portion of the window.  This behavior is coded and assumed all
over the place, and is hard to change.  There's therefore no option
for the behavior you expect.

There was an effort in the past to provide such behavior as an option,
but AFAIR it wasn't completed.  We did discuss some of the
consequences of such behavior and identified some problematic
decisions which will need to be made in various situations (e.g., what
should happen when point is outside of the window and the user runs
some command which modifies the buffer?), and I personally consider
those issues we considered to be the tip of a very large iceberg.  See
this discussion:

  https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00328.html