emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/bash-completion a79137cc86 004/313: escaped quotes


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion a79137cc86 004/313: escaped quotes
Date: Sat, 3 Dec 2022 10:58:59 -0500 (EST)

branch: elpa/bash-completion
commit a79137cc8690c9ce1379e2690ade76556bbf489b
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>

    escaped quotes
---
 bash-complete.el      |  7 +++----
 bash-complete_test.el | 12 ++++++++++++
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/bash-complete.el b/bash-complete.el
index 1b78c8c8eb..06df1d4b3a 100644
--- a/bash-complete.el
+++ b/bash-complete.el
@@ -57,19 +57,18 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
    ((and (char-before) (= ?\\ (char-before)))
     (forward-char)
     (bash-complete-split-1
-     start end pos
-     (if (and quote (= quote (char-before))) nil quote)
+     start end pos quote
      accum
      (concat (substring straccum 0 (- (length straccum) 1))  (char-to-string 
(char-before)))))
    ;; opening quote
    ((and (not quote) (char-after) (or (= ?' (char-after)) (= ?\" 
(char-after))))
     (bash-complete-split-0 start end pos accum straccum))
    ;; closing quote
-   ((and quote (= quote (char-after)))
+   ((and quote (char-after) (= quote (char-after)))
     (forward-char)
     (bash-complete-split-0 start end pos accum straccum))
    ;; space inside a quote
-   ((and quote (not (= quote (char-after))))
+   ((and quote (char-after) (not (= quote (char-after))))
     (forward-char)
     (bash-complete-split-1
      start end pos quote accum
diff --git a/bash-complete_test.el b/bash-complete_test.el
index 5d6a276124..3c6f9447b6 100644
--- a/bash-complete_test.el
+++ b/bash-complete_test.el
@@ -46,12 +46,24 @@
        (bash-complete-split 1 (line-end-position) 0))
       '("a" "hello world" "b" "c"))
 
+     ("bash-complete-split double quotes escaped"
+      (sz-testutils-with-buffer
+       '("a \"-\\\"hello world\\\"-\" b c")
+       (bash-complete-split 1 (line-end-position) 0))
+      '("a" "-\"hello world\"-" "b" "c"))
+
      ("bash-complete-split single quotes"
       (sz-testutils-with-buffer
        '("a 'hello world' b c")
        (bash-complete-split 1 (line-end-position) 0))
       '("a" "hello world" "b" "c"))
 
+     ("bash-complete-split single quotes escaped"
+      (sz-testutils-with-buffer
+       '("a '-\\'hello world\\'-' b c")
+       (bash-complete-split 1 (line-end-position) 0))
+      '("a" "-'hello world'-" "b" "c"))
+
      ("bash-complete-split complex quote mix"
       (sz-testutils-with-buffer
        '("a hel\"lo w\"o'rld b'c d")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]