File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -1043,7 +1043,7 @@ If the scroll count is zero the command scrolls half the screen."
10431043 (when (= (point-min ) (line-beginning-position ))
10441044 (signal 'beginning-of-buffer nil ))
10451045 (when (zerop count)
1046- (setq count (/ (window-body -height ) 2 )))
1046+ (setq count (/ (evil- window-visible -height) 2 )))
10471047 (let ((xy (evil-posn-x-y (posn-at-point ))))
10481048 (condition-case nil
10491049 (progn
@@ -1067,7 +1067,7 @@ If the scroll count is zero the command scrolls half the screen."
10671067 (setq evil-scroll-count count)
10681068 (when (eobp ) (signal 'end-of-buffer nil ))
10691069 (when (zerop count)
1070- (setq count (/ (window-body -height ) 2 )))
1070+ (setq count (/ (evil- window-visible -height) 2 )))
10711071 ; ; BUG #660: First check whether the eob is visible.
10721072 ; ; In that case we do not scroll but merely move point.
10731073 (if (<= (point-max ) (window-end ))
Original file line number Diff line number Diff line change @@ -3980,6 +3980,21 @@ PROPERTIES is a property-list which supports the following properties:
39803980 (evil-motion-state))
39813981 (switch-to-buffer-other-window buf))))
39823982
3983+ ; ;; Window
3984+
3985+ (defun evil-window-visible-height (&optional window )
3986+ " The visible height of WINDOW in lines.
3987+
3988+ If no WINDOW is specified, use the selected one."
3989+ (let ((window (or window (selected-window ))))
3990+ (save-window-excursion
3991+ (select-window window)
3992+ (let ((window-top (save-excursion (move-to-window-line 0 )
3993+ (line-number-at-pos )))
3994+ (window-bottom (save-excursion (move-to-window-line -1 )
3995+ (line-number-at-pos ))))
3996+ (- window-bottom window-top)))))
3997+
39833998(provide 'evil-common )
39843999
39854000; ;; evil-common.el ends here
You can’t perform that action at this time.
0 commit comments