[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 3ffc296e0b 149/313: Close opened quote for
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 3ffc296e0b 149/313: Close opened quote for all completion candidate that don't end with a |
Date: |
Sat, 3 Dec 2022 10:59:25 -0500 (EST) |
branch: elpa/bash-completion
commit 3ffc296e0be0e9a762e935d5dc46528cb4c72217
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Close opened quote for all completion candidate that don't end with a
special character. Add a space afterwards, if it is a single candidate
or a command completion.
fixes #20
---
bash-completion-test.el | 29 +++++++++++++++++++++++++++--
bash-completion.el | 16 +++++++++-------
2 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/bash-completion-test.el b/bash-completion-test.el
index 4c4902c457..1fcd7cba49 100644
--- a/bash-completion-test.el
+++ b/bash-completion-test.el
@@ -745,6 +745,31 @@ before calling `bash-completion-dynamic-complete-nocomint'.
'("hello ")
(nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))))
+
+(ert-deftest bash-completion-single-completion-double-quotes ()
+ (--with-fake-bash-completion-send
+ (push "hello\n" --send-results)
+ (insert "$ cat \"he")
+ (should (equal
+ '("hello\" ")
+ (nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))))
+
+(ert-deftest bash-completion-single-completion-single-quotes ()
+ (--with-fake-bash-completion-send
+ (push "hello\n" --send-results)
+ (insert "$ cat 'he")
+ (should (equal
+ '("hello' ")
+ (nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))))
+
+(ert-deftest bash-completion-completion-with-double-quotes ()
+ (--with-fake-bash-completion-send
+ (push "hell\nhello\n" --send-results)
+ (insert "$ cat \"he")
+ (should (equal
+ '("hell\"" "hello\"")
+ (nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))))
+
(ert-deftest bash-completion-trailing-default-completion ()
(--with-fake-bash-completion-send
(push "without space\nwith space \nwith slash/\n" --send-results)
@@ -840,8 +865,8 @@ before calling `bash-completion-dynamic-complete-nocomint'.
(push "Documents/Modes d'emplois/KAR 1.pdf\nDocuments/Modes d'emplois/KAR
2.pdf\n"
--send-results)
(should (equal
- '("Documents/Modes d'\\''emplois/KAR 1.pdf"
- "Documents/Modes d'\\''emplois/KAR 2.pdf")
+ '("Documents/Modes d'\\''emplois/KAR 1.pdf'"
+ "Documents/Modes d'\\''emplois/KAR 2.pdf'")
(nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))))
(ert-deftest bash-completion-complete-command-with-dir ()
diff --git a/bash-completion.el b/bash-completion.el
index 141dfdc22e..89d953e631 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -815,11 +815,13 @@ for directory name detection to work."
(t (setq rest str)))
;; build suffix
- (let ((last-char (bash-completion-last-char rest)))
+ (let ((last-char (bash-completion-last-char rest))
+ (close-quote-str (if open-quote (char-to-string open-quote) ""))
+ (final-space-str (if bash-completion-nospace "" " ")))
(cond
((eq ?\ last-char)
(setq rest (substring rest 0 -1))
- (setq suffix (if bash-completion-nospace "" " ")))
+ (setq suffix (concat close-quote-str final-space-str)))
((or (memq last-char bash-completion-wordbreaks)
(eq ?/ last-char))
(setq suffix ""))
@@ -830,11 +832,11 @@ for directory name detection to work."
open-quote (concat parsed-prefix rest))
default-directory)))
(setq suffix "/"))
- ((and (not open-quote)
- (or (eq completion-type 'command)
- (and (memq completion-type '(default wordbreak custom))
- single)))
- (setq suffix (if bash-completion-nospace "" " ")))))
+ ((or (eq completion-type 'command)
+ (and (memq completion-type '(default wordbreak custom))
+ single))
+ (setq suffix (concat close-quote-str final-space-str)))
+ (t (setq suffix close-quote-str))))
;; put everything back together
(concat unparsed-prefix
- [nongnu] elpa/bash-completion 0210d346f1 279/313: Make bash-completion-use-separate-processes default to nil., (continued)
- [nongnu] elpa/bash-completion 0210d346f1 279/313: Make bash-completion-use-separate-processes default to nil., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7a1f127851 292/313: Test and fix the dynamic table function that's returned., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3dbbd1beff 293/313: Fix tests to run under Emacs 24.3., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion d47edb9d41 294/313: Bump version to 3.1, a bugfix release., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion faefaf6950 298/313: Add command M-x bash-completion-debug, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fa5557709e 300/313: GitHub Actions now runs tests on Emacs 27.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fd853663ee 304/313: Detect non-responsive processes more quickly., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 65e54c6f9c 307/313: Temporarily revert fixes for issue #44., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion d9c97b741d 309/313: Attempt to fix automated tests., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 29b5fc860a 312/313: Shorten overly long docstring (#53), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3ffc296e0b 149/313: Close opened quote for all completion candidate that don't end with a,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 6bf1536325 150/313: Fix occasional escaping issue with candidates containing quotes., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7ce100b7eb 006/313: cursor position, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 21149fdc27 152/313: Introduce the variable bash-completion-start-files, that allow, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 31bc1c1c21 161/313: Compile bash-completion.el before running tests., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 054ecdfce3 290/313: ignore file ert-profile created by ert-runner, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c444230670 154/313: Add run_tests.sh, to run tests from the command-line, with specific, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0709a9803d 303/313: Support newlines in the output of complete -p., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c5eaeed156 311/313: Always ensure that a copy of the candidate list is returned (#48), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f6e1c44057 013/313: put everything together, ELPA Syncer, 2022/12/03