Skip to content

slow scrolling back from hydra #426

@Zoybean

Description

@Zoybean

Scrolling backwards from a hydra scrolls significantly less than expected (about half a page less). Calling the same commands from bare keybinds is unaffected.

minimal init.el

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        (or (bound-and-true-p straight-base-dir)
            user-emacs-directory)))
      (bootstrap-version 7))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'hydra)
(require 'view)

(defhydra hydra-view ()
  ("u" View-scroll-half-page-backward "View back")
  ("U" View-scroll-page-backward "View back"))

(keymap-set global-map "C-c v" 'hydra-view/body)
(keymap-set global-map "C-c u" 'View-scroll-page-backward)

What I tried:

  1. fill a buffer with a few screens of text, and scroll to the end.
  2. call View-scroll-half-page-backward from a hydra (C-c u u u)
  3. call View-scroll-page-backward from a hydra (C-c v U U U)
  4. call View-scroll-page-backward directly (C-c U)

What I expected to happen:

  1. at the end of a large buffer
  2. view scrolls back half a screenful at a time
  3. view scrolls back 1 screenful at a time
  4. view scrolls back 1 screenful at a time

What actually happened:

  1. at the end of a large buffer
  2. view scrolls back a few lines at a time, or not at all
  3. view scrolls back half a screenful at a time
  4. view scrolls back 1 screenful at a time

Other notes:
It's not just view that's affected. I tried my own versions based on scroll-down and they also exhibit the same behaviour when called from a hydra.

(defun scroll-half-page-down-command ()
  "scroll down half the page"
  (interactive)
  (scroll-down-command (/ (window-body-height) 2)))

(defun scroll-half-page-down ()
  "scroll down half the page"
  (interactive)
  (scroll-down (/ (window-body-height) 2)))

Scrolling forward appears unaffected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions