emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/topspace be86d5ba9b 180/181: Prevent line `1` indicator


From: ELPA Syncer
Subject: [elpa] externals/topspace be86d5ba9b 180/181: Prevent line `1` indicator sometimes displaying too high in `linum-mode` (#22)
Date: Tue, 23 Aug 2022 12:58:49 -0400 (EDT)

branch: externals/topspace
commit be86d5ba9b020ae62322bec2a006f4d0ef749773
Author: Trevor Pogue <trevorpogue@gmail.com>
Commit: GitHub <noreply@github.com>

    Prevent line `1` indicator sometimes displaying too high in `linum-mode` 
(#22)
    
    With linum-mode enabled, the line 1 indicator in the left margin would 
sometimes
    show too high up, above the actual line 1.
    The issue would occur when scrolling and topspace-height was zero before 
scrolling
    but greater than zero after scrolling. This prevents the issue.
---
 Cask                  | 3 ++-
 test/test-helper.el   | 1 +
 test/topspace-test.el | 9 ++++++++-
 topspace.el           | 4 +++-
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Cask b/Cask
index 841656189c..d0748fb1bf 100644
--- a/Cask
+++ b/Cask
@@ -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")
diff --git a/test/test-helper.el b/test/test-helper.el
index e59761bf66..1651426629 100644
--- a/test/test-helper.el
+++ b/test/test-helper.el
@@ -15,6 +15,7 @@
               ))
 
 (require 'smooth-scrolling)
+(require 'linum)
 (require 'topspace)
 
 ;;; test-helper.el ends here
diff --git a/test/topspace-test.el b/test/topspace-test.el
index 3670a198ca..850b95ff9a 100644
--- a/test/topspace-test.el
+++ b/test/topspace-test.el
@@ -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"
diff --git a/topspace.el b/topspace.el
index ec2fa02f73..9fac1d3057 100644
--- a/topspace.el
+++ b/topspace.el
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]