branch: master
commit f628569fa3600aa0e7ccbf38662d8636a570eb77
Author: Mitchell Plamann <mplam...@janestreet.com>
Commit: Oleh Krehel <ohwoeo...@gmail.com>

    Make ivy--magic-file-slash less aggressive
    
    In counsel-find-file, when the user types "foo", selects the prompt, and
    presses "/", the result should be "foo/".
    
    If the directory "foobar" exists, but "foo" does not, typing "foo",
    selecting the prompt, and pressing "/" results in "cd"ing to "foobar"
    (assuming ivy-magic-slash-non-match-action is
    'ivy-magic-slash-non-match-cd-selected). This commit changes
    ivy--magic-file-slash to check that the prompt is not selected before
    performing the ivy-magic-slash-non-match-cd-selected action.
    
    Fixes #2240
---
 ivy.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ivy.el b/ivy.el
index 05d8803..fc1df4c 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3016,6 +3016,7 @@ Possible choices are 
'ivy-magic-slash-non-match-cd-selected,
                (and (or (> ivy--index 0)
                         (= ivy--length 1)
                         magic)
+                    (not (ivy--prompt-selected-p))
                     (not (equal (ivy-state-current ivy-last) ""))
                     (file-directory-p (ivy-state-current ivy-last))
                     (or (eq ivy-magic-slash-non-match-action

Reply via email to