[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion cc1a462415 050/313: tested complex line, d
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion cc1a462415 050/313: tested complex line, detect escaped separators |
Date: |
Sat, 3 Dec 2022 10:59:15 -0500 (EST) |
branch: elpa/bash-completion
commit cc1a462415423d46d65e0c42554a8145712ef63b
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
tested complex line, detect escaped separators
---
bash-completion.el | 6 +++++-
bash-completion_test.el | 33 +++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/bash-completion.el b/bash-completion.el
index 3a08e0e11a..fa2f0d03b7 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -125,7 +125,11 @@ Call bash to do the completion."
(dolist (current accum)
(let* ((position (bash-completion-tokenize-range-check current pos))
(string (bash-completion-tokenize-get-str current))
- (is-terminal (member string '(";" "&" "|" "&&" "||"))))
+ (is-terminal
+ (and (member string '(";" "&" "|" "&&" "||"))
+ (let ((range (bash-completion-tokenize-get-range current)))
+ (= (- (cdr range) (car range))
+ (length string))))))
(cond
((and is-terminal
(eq position 'after))
diff --git a/bash-completion_test.el b/bash-completion_test.el
index a96fcd6219..688005598a 100644
--- a/bash-completion_test.el
+++ b/bash-completion_test.el
@@ -172,6 +172,39 @@ cases. That's why they need to be enabled manually.")
(cword . 4)
(words . ("a" "hello" "world" "b" "c"))))
+ ("bash-completion-parse-line complex multi-command line"
+ (sz-testutils-with-buffer
+ '("cd /var/tmp ; ZORG=t make -" cursor " -f Makefile && ./zorg")
+ (bash-completion-parse-line 1 (line-end-position) (point)))
+ '((line . "make - -f Makefile")
+ (cword . 1)
+ (words . ("make" "-" "-f" "Makefile"))))
+
+
+ ("bash-completion-parse-line pipe"
+ (sz-testutils-with-buffer
+ '("ls /var/tmp | sort -" cursor)
+ (bash-completion-parse-line 1 (line-end-position) (point)))
+ '((line . "sort -")
+ (cword . 1)
+ (words . ("sort" "-"))))
+
+ ("bash-completion-parse-line escaped semicolon"
+ (sz-testutils-with-buffer
+ '("find -name '*.txt' -" cursor " -exec echo {} ';' | head")
+ (bash-completion-parse-line 1 (line-end-position) (point)))
+ '((line . "find -name '*.txt' - -exec echo {} ';'")
+ (cword . 3)
+ (words . ("find" "-name" "*.txt" "-" "-exec" "echo" "{}" ";"))))
+
+ ("bash-completion-parse-line at var assignment"
+ (sz-testutils-with-buffer
+ '("cd /var/tmp ; A=f ZORG=t" cursor " make -f Makefile && ./zorg")
+ (bash-completion-parse-line 1 (line-end-position) (point)))
+ '((line . "ZORG=t")
+ (cword . 0)
+ (words . ("ZORG=t"))))
+
("bash-completion-split cursor after end"
(sz-testutils-with-buffer
'("a hello world b c " cursor)
- [nongnu] elpa/bash-completion 21eabde7f9 045/313: Reimplemented split, (continued)
- [nongnu] elpa/bash-completion 21eabde7f9 045/313: Reimplemented split, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3c58afdb0d 033/313: expand file names in colon-separated paths, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5501cb63cf 042/313: Turn off mail warning, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0dcf43f91e 041/313: don't run integration tests by default, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5b76fc4a33 032/313: remove wrong a=b variable prefix handling, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7697f1a87c 063/313: comments about tried systems, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3efe7cb03c 067/313: escape #, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 42441e36b0 055/313: more documentation, a little refactoring, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5661a34c4a 098/313: updated test case for cd 2>/dev/null, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c64ca7a992 071/313: simplified parse-current-command, all tests pass, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion cc1a462415 050/313: tested complex line, detect escaped separators,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 9ac7f58758 059/313: Gone through compgen, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion e515453141 047/313: from an alist to (string start stop), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 582b489fb3 091/313: Added message about mailcheck, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7f0160d271 065/313: Trim strange results that are a subset of the current value: test case, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 583ecc7707 103/313: Merge pull request #1 from kemmason/master, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 52af1ff8f7 090/313: Really disable mail check this time ? Set MAILCHECK to -1, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3859be798a 108/313: Add support for complete -D., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 711ccc2df1 096/313: format example properly, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7615b1bda5 083/313: changed e-mail address, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion aadb2e20b2 070/313: simplified bash-completion-parse-line, ELPA Syncer, 2022/12/03