branch: elpa/bash-completion
commit 5931a2ba43cefd037df250be1e7c8bd08ba90c5a
Author: Stephane Zermatten <[email protected]>
Commit: Stephane Zermatten <[email protected]>
completion-fix
---
bash-completion.el | 4 ++--
bash-completion_test.el | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index bae4f7f446..d32a74c1a4 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -188,7 +188,7 @@ The result is a list of candidates, which might be empty."
(defun bash-completion-fix (str &optional prefix)
(let ((prefix (or prefix bash-completion-prefix))
(suffix ""))
- (bash-completion-addsuffix
+ (bash-completion-addsuffix
(let* ((rebuilt)
(rest (cond
((bash-completion-starts-with str prefix)
@@ -202,7 +202,7 @@ The result is a list of candidates, which might be empty."
;; bash sometimes just prints whatever needs to be expanded,
;; for example: "export PATH=<complete>". Prepend the old
;; prefix to avoid confusing comint-dynamic-simple-complete
- ((bash-completion-starts-with
+ ((bash-completion-starts-with
(setq rebuilt (concat
(bash-completion-before-last-wordbreak prefix) str))
prefix)
(substring rebuilt (length prefix)))
diff --git a/bash-completion_test.el b/bash-completion_test.el
index d526ed5797..93acddee21 100644
--- a/bash-completion_test.el
+++ b/bash-completion_test.el
@@ -380,6 +380,26 @@ garbage
(bash-completion-after-last-wordbreak "hello"))
'("e" "world" "world" "hello"))
+ ("bash-completion-fix escape rest"
+ (bash-completion-fix "a\\ bc d e" "a\\ b")
+ "a\\ bc\\ d\\ e")
+
+ ("bash-completion-fix do not escape final space"
+ (bash-completion-fix "ab " "a")
+ "ab ")
+
+ ("bash-completion-fix unexpand home and escape"
+ (bash-completion-fix (expand-file-name "~/a/hello world") "~/a/he")
+ "~/a/hello\\ world")
+
+ ("bash-completion-fix match after wordbreak and escape"
+ (bash-completion-fix "hello world" "a:b:c:he")
+ "a:b:c:hello\\ world")
+
+ ("bash-completion-fix just append"
+ (bash-completion-fix " world" "hello")
+ "hello\\ world")
+
))
;; ---------- integration tests