branch: elpa/bash-completion
commit 38c82e5d5943f409f55d3f1b7a7f55d3fa2e6aae
Author: Stephane Zermatten <[email protected]>
Commit: Stephane Zermatten <[email protected]>
Conserve quotes even when expanding case-insensitively.
---
bash-completion.el | 9 +++++----
test/bash-completion-integration-test.el | 7 +++++++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index 4c2f59b7e4..9836051d3f 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -1005,10 +1005,11 @@ for directory name detection to work."
;; Bypass the whole prefix/suffix logic and replace the string
;; being completed with the string provided by the completion
;; logic.
- (t (setq unparsed-prefix ""
- parsed-prefix ""
- rest str)))
-
+ (t
+ (setq parsed-prefix ""
+ unparsed-prefix (if open-quote (char-to-string open-quote) "")
+ rest str)))
+
;; build suffix
(let ((last-char (bash-completion-last-char rest))
(close-quote-str (if open-quote (char-to-string open-quote) ""))
diff --git a/test/bash-completion-integration-test.el
b/test/bash-completion-integration-test.el
index 09b190b166..53435cc268 100644
--- a/test/bash-completion-integration-test.el
+++ b/test/bash-completion-integration-test.el
@@ -395,6 +395,7 @@ for testing completion."
(with-temp-file "test-inputrc"
(insert "set completion-ignore-case on\n"))
(make-directory "Uppercase")
+ (make-directory "Another Uppercase")
(bash-completion_test-with-shell
(when (>= (bash-completion_test-bash-major-version) 4)
;; Case insensitive completion is done by compgen which, under
@@ -404,6 +405,12 @@ for testing completion."
(should (equal "ls some/" (bash-completion_test-complete "ls So")))
(should (equal "ls Uppercase/" (bash-completion_test-complete "ls Up")))
(should (equal "ls Uppercase/" (bash-completion_test-complete "ls up")))
+ (should (equal "ls Another\\ Uppercase/" (bash-completion_test-complete
"ls Ano")))
+ (should (equal "ls Another\\ Uppercase/" (bash-completion_test-complete
"ls ano")))
+ (should (equal "ls \"Another Uppercase/" (bash-completion_test-complete
"ls \"Ano")))
+ (should (equal "ls \"Another Uppercase/" (bash-completion_test-complete
"ls \"ano")))
+ (should (equal "ls 'Another Uppercase/" (bash-completion_test-complete
"ls 'Ano")))
+ (should (equal "ls 'Another Uppercase/" (bash-completion_test-complete
"ls 'ano")))
(should completion-ignore-case)))))
(ert-deftest bash-completion-integration-case-sensitive-test ()