Skip to content

Commit

Permalink
Revert "Scroll half of the visible screen respecting zoom level (#1490)"
Browse files Browse the repository at this point in the history
This reverts commit 070abb1.

As noted in #1497 this introduced bugs which imo are worse than the
bug this commit aims to solve. More work needed.
  • Loading branch information
tomdl89 committed Jul 23, 2021
1 parent 5201f5c commit 3205851
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
4 changes: 2 additions & 2 deletions evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ If the scroll count is zero the command scrolls half the screen."
(when (= (point-min) (line-beginning-position))
(signal 'beginning-of-buffer nil))
(when (zerop count)
(setq count (/ (evil-window-visible-height) 2)))
(setq count (/ (window-body-height) 2)))
(let ((xy (evil-posn-x-y (posn-at-point))))
(condition-case nil
(progn
Expand All @@ -1067,7 +1067,7 @@ If the scroll count is zero the command scrolls half the screen."
(setq evil-scroll-count count)
(when (eobp) (signal 'end-of-buffer nil))
(when (zerop count)
(setq count (/ (evil-window-visible-height) 2)))
(setq count (/ (window-body-height) 2)))
;; BUG #660: First check whether the eob is visible.
;; In that case we do not scroll but merely move point.
(if (<= (point-max) (window-end))
Expand Down
15 changes: 0 additions & 15 deletions evil-common.el
Original file line number Diff line number Diff line change
Expand Up @@ -3980,21 +3980,6 @@ PROPERTIES is a property-list which supports the following properties:
(evil-motion-state))
(switch-to-buffer-other-window buf))))

;;; Window

(defun evil-window-visible-height (&optional window)
"The visible height of WINDOW in lines.

If no WINDOW is specified, use the selected one."
(let ((window (or window (selected-window))))
(save-window-excursion
(select-window window)
(let ((window-top (save-excursion (move-to-window-line 0)
(line-number-at-pos)))
(window-bottom (save-excursion (move-to-window-line -1)
(line-number-at-pos))))
(- window-bottom window-top)))))

(provide 'evil-common)

;;; evil-common.el ends here

0 comments on commit 3205851

Please sign in to comment.