branch: master
commit 97e92055f74cedf077548abb8cd895ff4080d794
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    ivy.el (ivy-avy): Fix when scrolled
    
    `line-number-at-pos' logic works only if the candidate list isn't
    scrolled, i.e. candidate 0 is at window start.
    
    Fixes #1004
---
 ivy.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index 8735b66..3f793b2 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1253,10 +1253,10 @@ On error (read-only), call `ivy-on-del-error-function'."
             (avy--process
              (nreverse candidates)
              (avy--style-fn avy-style)))))
-    (when (numberp candidate)
-      (ivy-set-index (- (line-number-at-pos candidate) 2))
-      (ivy--exhibit)
-      (ivy-done))))
+    (goto-char candidate)
+    (ivy--done
+     (buffer-substring-no-properties
+      (point) (line-end-position)))))
 
 (defun ivy-sort-file-function-default (x y)
   "Compare two files X and Y.

Reply via email to