branch: master
commit 51e765e17a3b91aa3605307a4e247d7efb06f61e
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-partial): Return nil when comletion was not updated
* ivy-test.el (counsel-find-file-with-spaces): Add tests.
Fixes #2103
---
ivy-test.el | 21 ++++++++++++++++++++-
ivy.el | 1 +
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/ivy-test.el b/ivy-test.el
index 1c11c1d..f40f63d 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -1162,7 +1162,7 @@ a buffer visiting a file."
(shell-command
"git clone -b test --single-branch https://github.com/abo-abo/swiper/
tests"))
(let ((default-directory (expand-file-name "tests/"))
- (version "b1a2bbf"))
+ (version "935fde0"))
(shell-command
(format "git checkout %s || git fetch && git checkout %s" version
version))))
@@ -1192,6 +1192,25 @@ a buffer visiting a file."
:dir "tests/find-file/dotfiles/"))
"tests/find-file/dotfiles/.foobar1")))
+(ert-deftest counsel-find-file-with-spaces ()
+ (counsel--setup-test-files)
+ (let ((ivy-extra-directories nil))
+ (should (string=
+ (file-relative-name
+ (ivy-with '(counsel-find-file) "TAB TAB TAB TAB"
+ :dir "tests/find-file/directories-with-spaces/"))
+ "tests/find-file/directories-with-spaces/bar baz i/file1"))
+ (should (string=
+ (file-relative-name
+ (ivy-with '(counsel-find-file) "C-n TAB TAB TAB TAB"
+ :dir "tests/find-file/directories-with-spaces/"))
+ "tests/find-file/directories-with-spaces/bar baz ii/file2"))
+ (should (string=
+ (file-relative-name
+ (ivy-with '(counsel-find-file) "TAB C-n TAB TAB TAB TAB"
+ :dir "tests/find-file/directories-with-spaces/"))
+ "tests/find-file/directories-with-spaces/bar baz ii/file2"))))
+
(provide 'ivy-test)
;;; ivy-test.el ends here
diff --git a/ivy.el b/ivy.el
index ad31147..8b9aecf 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1041,6 +1041,7 @@ If the text hasn't changed as a result, forward to
`ivy-alt-done'."
ivy--old-cands)))))
(cond ((eq new t) nil)
((string= new ivy-text) nil)
+ ((string= (car tail) new) nil)
(new
(delete-region (minibuffer-prompt-end) (point-max))
(setcar tail