GNU bug report logs - #50234
28.0.50; Horizontal scrolling doesn't keep the point in view

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Sat, 28 Aug 2021 07:41:01 UTC

Severity: wishlist

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Dima Kogan <dima <at> secretsauce.net>
To: 50234 <at> debbugs.gnu.org
Subject: bug#50234: 28.0.50; Horizontal scrolling doesn't keep the point in view
Date: Sat, 28 Aug 2021 00:40:57 -0700
Hi. This is an old bug; I've been observing it for years. I have
C-M-arrowkeys bound to scrolling commands:

  (global-set-key [C-M-down]  (lambda () (interactive) (let ((scroll-preserve-screen-position nil)) (scroll-up    3))))
  (global-set-key [C-M-up]    (lambda () (interactive) (let ((scroll-preserve-screen-position nil)) (scroll-up   -3))))
  (global-set-key [C-M-left]  (lambda () (interactive) (let ((scroll-preserve-screen-position nil)) (scroll-left -3))))
  (global-set-key [C-M-right] (lambda () (interactive) (let ((scroll-preserve-screen-position nil)) (scroll-left  3))))

The vertical scrolling works as expected: if the point is scrolled off
screen, the point moves to stay in-bounds.

I expect the same from horizontal scrolling, but it doesn't work.
Recipe:

1. emacs -Q --eval '(global-set-key [C-M-right]  (lambda () (interactive) (let ((scroll-preserve-screen-position t)) (scroll-left 3))))'

   Emacs comes up with the default text in the *scratch* buffer

2. (goto-char (point-min))

   Move the point to the beginning of the buffer. (point) evaluates to 1

3. C-M-right

   We scroll to the right. The point was on the left edge of the screen
   at position 1, which is now out of view. Emacs still draws the point
   at the left edge of the screen, implying that the point was moved to
   stay in-bounds. But this is not where the point actually is: (point)
   still evaluates to 1. I expect (point) to be updated with the new
   position

4. C-a

   Now, some commands behave strangely. For instance C-a should move to
   the start of the line. This is now off-screen, so I would expect
   emacs to scroll back so that we can see the beginning of the line.
   But emacs does nothing: the point was at position 1, and it was moved
   to position 1, so it doesn't see the need to scroll anything.

Thanks!




This bug report was last modified 3 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.