branch: master
commit a94ca830f844342293ae5b819b7c489fa5fa6a1f
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
swiper.el: Add a work-around for window-start not being current
* 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 | 1 +
swiper.el | 13 +++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index a33f886..957f824 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -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'.")
diff --git a/swiper.el b/swiper.el
index d69e4ae..fbe99a3 100644
--- 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."