[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 50ead7e 013/184: ivy-test.el (swiper-thing-at-point): Add
From: |
Oleh Krehel |
Subject: |
[elpa] master 50ead7e 013/184: ivy-test.el (swiper-thing-at-point): Add and fix test |
Date: |
Wed, 16 Oct 2019 13:14:40 -0400 (EDT) |
branch: master
commit 50ead7e09be86e2731635c81efb48962a2305c7e
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy-test.el (swiper-thing-at-point): Add and fix test
Fixes #2157
---
ivy-test.el | 16 ++++++++++++++++
swiper.el | 10 +++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/ivy-test.el b/ivy-test.el
index f8c9727..1d5d9d6 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -1076,6 +1076,22 @@ a buffer visiting a file."
(and (buffer-name temp-buffer)
(kill-buffer temp-buffer)))))))
+(ert-deftest swiper-thing-at-point ()
+ (should
+ (string=
+ (ivy-with-text
+ "let\n|let\nlet"
+ (global-set-key (kbd "C-s") #'swiper-thing-at-point)
+ ("C-s" "RET"))
+ "let\nlet|\nlet"))
+ (should
+ (string=
+ (ivy-with-text
+ "foo\nlet\nbar\n|let\nlet"
+ (global-set-key (kbd "C-s") #'swiper-thing-at-point)
+ ("C-s" "RET"))
+ "foo\nlet\nbar\nlet|\nlet")))
+
(ert-deftest swiper-isearch ()
(should
(string=
diff --git a/swiper.el b/swiper.el
index b103abc..5071cec 100644
--- a/swiper.el
+++ b/swiper.el
@@ -772,7 +772,15 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
candidates
:initial-input initial-input
:keymap swiper-map
- :preselect preselect
+ :preselect
+ (if initial-input
+ (cl-position-if
+ (lambda (x)
+ (= (1+ preselect) (read (get-text-property 0
'swiper-line-number x))))
+ (progn
+ (setq ivy--old-re nil)
+ (ivy--filter initial-input candidates)))
+ preselect)
:require-match t
:update-fn #'swiper--update-input-ivy
:unwind #'swiper--cleanup
- [elpa] master updated (22e3e88 -> c2d3a4c), Oleh Krehel, 2019/10/16
- [elpa] master 196b4ea 001/184: doc/Makefile: Add target to install the info pages, Oleh Krehel, 2019/10/16
- [elpa] master 0a9fb0c 009/184: swiper.el (swiper--isearch-function): Refactor, Oleh Krehel, 2019/10/16
- [elpa] master f0ec850 005/184: swiper.el (swiper-isearch): Fix for ivy-resume, Oleh Krehel, 2019/10/16
- [elpa] master 2a036b8 002/184: swiper.el (swiper--isearch-function): Change., Oleh Krehel, 2019/10/16
- [elpa] master ad0f605 008/184: swiper.el (swiper--isearch-function-1): Extract, Oleh Krehel, 2019/10/16
- [elpa] master dc7f5e0 012/184: swiper.el (swiper--isearch-function): Works for ivy--regex-ignore-order, Oleh Krehel, 2019/10/16
- [elpa] master 50ead7e 013/184: ivy-test.el (swiper-thing-at-point): Add and fix test,
Oleh Krehel <=
- [elpa] master ec3e062 034/184: counsel (counsel-file-jump): Use temp buffer instead of split-string, Oleh Krehel, 2019/10/16
- [elpa] master 13be8ab 004/184: ivy.el (ivy--reset-state): Fix ivy-resume, Oleh Krehel, 2019/10/16
- [elpa] master 039353d 007/184: ivy.el (ivy--preselect-index): Fix ivy-resume for swiper-isearch, Oleh Krehel, 2019/10/16
- [elpa] master c7ffd06 016/184: swiper.el (swiper-isearch-action): Make ivy-previous-line-or-history work, Oleh Krehel, 2019/10/16
- [elpa] master b4c4a7f 011/184: swiper.el (swiper--isearch-next-item): Extract, Oleh Krehel, 2019/10/16
- [elpa] master b9f3e3b 017/184: swiper.el (swiper-isearch-action): Simplify, Oleh Krehel, 2019/10/16
- [elpa] master 38b5d83 015/184: swiper.el (swiper--isearch-filter-ignore-order): Extract, Oleh Krehel, 2019/10/16
- [elpa] master 5f99723 019/184: counsel.el (counsel--async-last-command): Add for ease of debugging, Oleh Krehel, 2019/10/16
- [elpa] master fb486d8 024/184: ivy.el (ivy-immediate-done): Add copy-sequence to fix read-directory-name, Oleh Krehel, 2019/10/16
- [elpa] master f71f89a 029/184: ivy-test.el (ivy-swiper-wgrep): Expect fail on <=24.3, Oleh Krehel, 2019/10/16