branch: master
commit 5e79f162562dfbc559e2f7005feff8cf8264f2df
Author: Oleh Krehel <ohwoeo...@gmail.com>
Commit: Oleh Krehel <ohwoeo...@gmail.com>

    ivy.el (ivy--input): Fix point moving in TRAMP sessions
    
    If the key-by-key input from user is fast, sometimes the output from
    TRAMP comes in and moves the point, which made `ivy-text' longer than
    one line. This change should fix it.
    
    Fixes #2160
---
 ivy.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index 2bf0b2d..b25c0b4 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2758,9 +2758,11 @@ tries to ensure that it does not change depending on the 
number of candidates."
 (defun ivy--input ()
   "Return the current minibuffer input."
   ;; assume one-line minibuffer input
-  (buffer-substring-no-properties
-   (minibuffer-prompt-end)
-   (line-end-position)))
+  (save-excursion
+    (goto-char (minibuffer-prompt-end))
+    (buffer-substring-no-properties
+     (point)
+     (line-end-position))))
 
 (defun ivy--minibuffer-cleanup ()
   "Delete the displayed completion candidates."

Reply via email to