]> code.delx.au - gnu-emacs-elpa/commitdiff
swiper.el: Add a work-around for window-start not being current
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 18 Apr 2015 18:12:45 +0000 (20:12 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 18 Apr 2015 18:12:45 +0000 (20:12 +0200)
* swiper.el (swiper--update-input-ivy): Update.

This results in double the window-height amount of lines being
heightlighted, instead of just window-height. But at least it doesn't
happen that some candidates within the current window aren't highlighted
since they're beyond the outdated window-start and window-end.

An alternative would be to use `redisplay' to update `window-start' and
`window-end', but that causes excessive blinking.

* ivy-test.el: Add a require.

ivy-test.el
swiper.el

index a33f886d35c644f366cddff8df918f9b1d14b3f7..957f82406d654eb169f14ba6848c3404033c4db6 100644 (file)
@@ -20,6 +20,7 @@
 ;; see <http://www.gnu.org/licenses/>.
 
 (require 'ert)
+(require 'ivy)
 
 (defvar ivy-expr nil
   "Holds a test expression to evaluate with `ivy-eval'.")
index d69e4aee62790bec0f78b13dceb262ae8e6ccf28..fbe99a364754efd699048a08c72e2eeaeec73026 100644 (file)
--- a/swiper.el
+++ b/swiper.el
@@ -240,10 +240,15 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
         (overlay-put ov 'face 'swiper-line-face)
         (overlay-put ov 'window swiper--window)
         (push ov swiper--overlays))
-      (swiper--add-overlays
-       re
-       (window-start swiper--window)
-       (window-end swiper--window t)))))
+      (let ((wh (window-height)))
+        (swiper--add-overlays
+         re
+         (save-excursion
+           (forward-line (- wh))
+           (point))
+         (save-excursion
+           (forward-line wh)
+           (point)))))))
 
 (defun swiper--add-overlays (re beg end)
   "Add overlays for RE regexp in current buffer between BEG and END."