[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 7ce100b7eb 006/313: cursor position
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 7ce100b7eb 006/313: cursor position |
Date: |
Sat, 3 Dec 2022 10:58:59 -0500 (EST) |
branch: elpa/bash-completion
commit 7ce100b7eb9df4317b075f045fafa5ceb2ab439d
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
cursor position
---
bash-complete.el | 6 ++++--
bash-complete_test.el | 30 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/bash-complete.el b/bash-complete.el
index 8af7b5619b..d12720c2b0 100644
--- a/bash-complete.el
+++ b/bash-complete.el
@@ -77,9 +77,11 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
(concat straccum (char-to-string (char-before)))))
;; word end
(t
- (when straccum
- (setcdr accum (cons straccum (cdr accum))))
(skip-chars-forward " \t\n\r" end)
+ (when (> (length straccum) 0)
+ (setcdr accum (cons straccum (cdr accum)))
+ (when (and (not (car accum)) (> pos 0) (<= pos (point)))
+ (setcar accum (- (length (cdr accum)) 1))))
(if (< (point) end)
(bash-complete-split-0 (point) end pos accum "")
accum))))
diff --git a/bash-complete_test.el b/bash-complete_test.el
index d3403a7343..ed832ec4b4 100644
--- a/bash-complete_test.el
+++ b/bash-complete_test.el
@@ -34,6 +34,12 @@
(bash-complete-split 1 (line-end-position) 0))
'(nil . ("a" "hello" "world" "b" "c")))
+ ("bash-complete-split simple extra spaces"
+ (sz-testutils-with-buffer
+ '(" a hello \n world \t b \r c ")
+ (bash-complete-split 1 (line-end-position 2) 0))
+ '(nil . ("a" "hello" "world" "b" "c")))
+
("bash-complete-split escaped space"
(sz-testutils-with-buffer
'("a hello\\ world b c")
@@ -70,6 +76,30 @@
(bash-complete-split 1 (line-end-position) 0))
'(nil . ("a" "hello world bc" "d")))
+ ("bash-complete-split cursor at end of word"
+ (sz-testutils-with-buffer
+ '("a hello world" cursor " b c")
+ (bash-complete-split 1 (line-end-position) (point)))
+ '(2 . ("a" "hello" "world" "b" "c")))
+
+ ("bash-complete-split cursor in the middle of a word"
+ (sz-testutils-with-buffer
+ '("a hello wo" cursor "rld b c")
+ (bash-complete-split 1 (line-end-position) (point)))
+ '(2 . ("a" "hello" "world" "b" "c")))
+
+ ("bash-complete-split cursor at the beginnig"
+ (sz-testutils-with-buffer
+ '(" " cursor " a hello world b c")
+ (bash-complete-split 1 (line-end-position) (point)))
+ '(0 . ("a" "hello" "world" "b" "c")))
+
+ ("bash-complete-split cursor in the middle"
+ (sz-testutils-with-buffer
+ '("a hello " cursor " world b c")
+ (bash-complete-split 1 (line-end-position) (point)))
+ '(1 . ("a" "hello" "world" "b" "c")))
+
)))
- [nongnu] elpa/bash-completion 3dbbd1beff 293/313: Fix tests to run under Emacs 24.3., (continued)
- [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, 2022/12/03
- [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 <=
- [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