[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 9f02a62609 049/313: re-enabled parse-line
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 9f02a62609 049/313: re-enabled parse-line cursor at the beginning/in the middle tests |
Date: |
Sat, 3 Dec 2022 10:59:15 -0500 (EST) |
branch: elpa/bash-completion
commit 9f02a62609c3647c33af720984312f8257da9626
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
re-enabled parse-line cursor at the beginning/in the middle tests
---
bash-completion.el | 14 +++--------
bash-completion_test.el | 63 ++++++++++++-------------------------------------
2 files changed, 18 insertions(+), 59 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index 7466c859bd..3a08e0e11a 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -46,7 +46,7 @@ Call bash to do the completion."
(when (not (window-minibuffer-p))
(message "Bash completion..."))
(let* ( (pos (point))
- (start (bash-completion-line-beginning-position))
+ (start (comint-line-beginning-position))
(end (line-end-position))
(parsed (bash-completion-parse-line start end pos))
(line (cdr (assq 'line parsed)))
@@ -65,15 +65,6 @@ Call bash to do the completion."
(bash-completion-send (concat (bash-completion-cd-command-prefix)
"compgen -o default -- " after-wordbreak))
(comint-dynamic-simple-complete after-wordbreak
(bash-completion-extract after-wordbreak))))))))
-(defun bash-completion-line-beginning-position (&optional start)
- (save-excursion
- (let ((start (or start (comint-line-beginning-position)))
- (end (line-end-position)))
- (goto-char end)
- (if (search-backward-regexp "\\(;\\|\\(&&\\)\\|\\(||\\)\\)[ \t\n]" start
t)
- (match-end 0)
- start))))
-
(defun bash-completion-join (words)
"Join WORDS into a shell line, escaped all words with single quotes"
(if words
@@ -104,7 +95,8 @@ Call bash to do the completion."
(defun bash-completion-parse-line-postprocess (accum pos)
(let ((index 0) (strings nil) (current nil) (accum-rest accum) (cword nil)
- (start (car (bash-completion-tokenize-get-range (car accum)))))
+ (start (min pos
+ (car (bash-completion-tokenize-get-range (car accum))))))
(while accum-rest
(setq current (car accum-rest))
(setq accum-rest (cdr accum-rest))
diff --git a/bash-completion_test.el b/bash-completion_test.el
index edc28eff1c..a96fcd6219 100644
--- a/bash-completion_test.el
+++ b/bash-completion_test.el
@@ -148,17 +148,21 @@ cases. That's why they need to be enabled manually.")
(cword . 2)
(words . ("a" "hello" "world" "b" "c"))))
-;; ("bash-completion-split cursor at the beginning"
-;; (sz-testutils-with-buffer
-;; '(" " cursor " a hello world b c")
-;; (bash-completion-split 1 (line-end-position) (point)))
-;; '(0 . ("" "a" "hello" "world" "b" "c")))
-
-;; ("bash-completion-split cursor in the middle"
-;; (sz-testutils-with-buffer
-;; '("a hello " cursor " world b c")
-;; (bash-completion-split 1 (line-end-position) (point)))
-;; '(2 . ("a" "hello" "" "world" "b" "c")))
+ ("bash-completion-parse-line cursor at the beginning"
+ (sz-testutils-with-buffer
+ '(" " cursor " a hello world b c")
+ (bash-completion-parse-line 1 (line-end-position) (point)))
+ '((line . " a hello world b c")
+ (cword . 0)
+ (words . ("" "a" "hello" "world" "b" "c"))))
+
+ ("bash-completion-parse-line cursor in the middle"
+ (sz-testutils-with-buffer
+ '("a hello " cursor " world b c")
+ (bash-completion-parse-line 1 (line-end-position) (point)))
+ '((line . "a hello world b c")
+ (cword . 2)
+ (words . ("a" "hello" "" "world" "b" "c"))))
("bash-completion-parse-line cursor at end"
(sz-testutils-with-buffer
@@ -263,43 +267,6 @@ garbage
(bash-completion-generate-line "zorg worl" 7 '("zorg" "worl") 1))
"cd 2>/dev/null /test ; __BASH_COMPLETE_WRAPPER='COMP_LINE='\\''zorg
worl'\\''; COMP_POINT=7; COMP_CWORD=1; COMP_WORDS=( zorg worl ); __zorg
\"${COMP_WORDS[@]}\"' compgen -F __bash_complete_wrapper -- worl")
- ("bash-completion-line-beginning-position start"
- (sz-testutils-with-buffer
- "cd /home/x"
- (bash-completion-line-beginning-position 1))
- 1)
-
- ("bash-completion-line-beginning-position semicolon"
- (sz-testutils-with-buffer
- '("cd /home/x ; " cursor "echo hello")
- (list
- (point)
- (bash-completion-line-beginning-position 1)))
- '(14 14))
-
- ("bash-completion-line-beginning-position 2 semicolon"
- (sz-testutils-with-buffer
- '("cd /home/x ; blah; " cursor "echo hello")
- (list
- (point)
- (bash-completion-line-beginning-position 1)))
- '(20 20))
-
- ("bash-completion-line-beginning-position &&"
- (sz-testutils-with-buffer
- '("cd /home/x && " cursor "echo hello")
- (list
- (point)
- (bash-completion-line-beginning-position 1)))
- '(15 15))
-
- ("bash-completion-line-beginning-position ||"
- (sz-testutils-with-buffer
- '("cd /home/x || " cursor "echo hello")
- (list
- (point)
- (bash-completion-line-beginning-position 1)))
- '(15 15))
("bash-completion-starts-with empty str"
(bash-completion-starts-with "" "prefix")
- [nongnu] elpa/bash-completion a79137cc86 004/313: escaped quotes, (continued)
- [nongnu] elpa/bash-completion a79137cc86 004/313: escaped quotes, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 581864111e 039/313: integration test harness, process buffer cleanup, hidden buffer, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3e1481741c 031/313: remove messages, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0d360a45cd 017/313: fixed test case, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c28492a749 036/313: wordbreak before and after, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8b02aafc67 046/313: separators, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2390d5cdf3 061/313: more commends and documentation; still need a commentary section, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c0f7c20a6b 094/313: added license and missing test dependency, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a2d322fb79 054/313: Added customization group, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 983f5c28e9 106/313: Merge pull request #2 from frankpzh/patch-1, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9f02a62609 049/313: re-enabled parse-line cursor at the beginning/in the middle tests,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 3ec615a4ef 077/313: added id, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f1d8d73b42 072/313: changed comment, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2d6ad3980a 062/313: fixes for emacs 22, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9583153e0b 068/313: Fixed issue with wordbreak character being the first character, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7dec35f302 087/313: Set MAIL to the empty string in case shopt -u mailwarn is not, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8a246f40da 088/313: bash-completion-generate-line: add missing compgen option to, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 6fb6bf5588 081/313: Mention ghardy bash version, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 33ed66e567 099/313: bash-completion-nospace option, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion cf42ed1057 101/313: add compatibility information for emacs 24.1.1 with OSX 10.7 / 10.8, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f9903d4bd4 079/313: ran checkdoc again, re-ran integration tests, ELPA Syncer, 2022/12/03