Skip to content

Commit

Permalink
Merge 9a0a547 into 0399f73
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorpogue committed Aug 3, 2022
2 parents 0399f73 + 9a0a547 commit 876cc76
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Cask
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(development
(depends-on "undercover")
(depends-on "buttercup")
(depends-on "smooth-scrolling"))
(depends-on "smooth-scrolling")
(depends-on "linum"))

(package-file "topspace.el")
1 change: 1 addition & 0 deletions test/test-helper.el
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
))

(require 'smooth-scrolling)
(require 'linum)
(require 'topspace)

;;; test-helper.el ends here
9 changes: 8 additions & 1 deletion test/topspace-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,18 @@
(describe
"topspace--after-scroll"
(it "is needed when first scrolling above the top line"
(linum-mode 1)
(goto-char 1)
(topspace-set-height 0)
(scroll-up-line)
(scroll-down 2)
(expect (round (topspace-height)) :to-equal 1)))
(linum-mode -1)
(goto-char 1)
(topspace-set-height 0)
(scroll-up-line)
(scroll-down 2)
(expect (round (topspace-height)) :to-equal 1)
))

(describe
"topspace--window-configuration-change"
Expand Down
4 changes: 3 additions & 1 deletion topspace.el
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ command is run in the described case above."
1 topspace--window-start-before-scroll)))
(setq total-lines (abs total-lines))
(set-window-start (selected-window) 1)
(topspace-set-height (- total-lines lines-already-scrolled)))))))
(topspace-set-height (- total-lines lines-already-scrolled)))
(when (and (bound-and-true-p linum-mode) (fboundp 'linum-update-window))
(linum-update-window (selected-window)))))))

(defun topspace--after-recenter (&optional line-offset redisplay)
"Recenter near the top of buffers by adding top space appropriately.
Expand Down

0 comments on commit 876cc76

Please sign in to comment.