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

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

[elpa] master 74095a2 395/399: ivy-test.el (swiper-isearch-backward): Te


From: Oleh Krehel
Subject: [elpa] master 74095a2 395/399: ivy-test.el (swiper-isearch-backward): Test match at point
Date: Sat, 20 Jul 2019 14:58:07 -0400 (EDT)

branch: master
commit 74095a2b9264dd5d1bc1765868ef5af0f6fc2dc2
Author: Andrew Schwartzmeyer <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy-test.el (swiper-isearch-backward): Test match at point
    
    * swiper.el (swiper-isearch): Move the point history by 1 so that we
      don't select the match that's right at point.
    
    `isearch-backward` never selects a match at the point, it always goes to
    the first match before the point. This test demonstrates the expected
    behavior.
    
    Fixes #2150
---
 ivy-test.el | 16 +++++++++++++++-
 swiper.el   |  2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index c58d1a6..386fe9c 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -1147,7 +1147,21 @@ a buffer visiting a file."
      "(defun foo)\nasdf\n(defvar bar)|"
      (global-set-key (kbd "C-r") #'swiper-isearch-backward)
      ("C-r" "defun\\|defvar" "C-n RET"))
-    "(defun foo)\nasdf\n(|defvar bar)")))
+    "(defun foo)\nasdf\n(|defvar bar)"))
+  (should
+   (string=
+    (ivy-with-text
+     "(defun foo)\nasdf\n(|defun bar)"
+     (global-set-key (kbd "C-r") #'isearch-backward)
+     ("C-r" "defun" "RET"))
+    "(|defun foo)\nasdf\n(defun bar)"))
+  (should
+   (string=
+    (ivy-with-text
+     "(defun foo)\nasdf\n(|defun bar)"
+     (global-set-key (kbd "C-r") #'swiper-isearch-backward)
+     ("C-r" "defun" "RET"))
+    "(|defun foo)\nasdf\n(defun bar)")))
 
 (ert-deftest swiper-isearch-backward-backspace ()
   (should
diff --git a/swiper.el b/swiper.el
index cfaf796..9d4fdba 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1520,7 +1520,7 @@ When not running `swiper-isearch' already, start it."
   (swiper-font-lock-ensure)
   (setq swiper--isearch-point-history
         (list
-         (cons "" (point))))
+         (cons "" (- (point) (if swiper--isearch-backward 1 0)))))
   (let ((ivy-fixed-height-minibuffer t)
         (cursor-in-non-selected-windows nil)
         (swiper-min-highlight 1)



reply via email to

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