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

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

[elpa] externals/ivy-hydra b83d271 171/395: ivy.el (ivy-backward-kill-wo


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra b83d271 171/395: ivy.el (ivy-backward-kill-word): Actually kill-word
Date: Thu, 25 Feb 2021 08:31:56 -0500 (EST)

branch: externals/ivy-hydra
commit b83d2717690e0215d5b6738f85b651eafdf56aca
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ivy.el (ivy-backward-kill-word): Actually kill-word
    
    * ivy-test.el (ivy-backward-kill-word): Add test.
    
    Fixes #2422
---
 ivy-test.el | 16 ++++++++++++++--
 ivy.el      |  7 +++++--
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index 1497fcd..ef89e61 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -454,6 +454,18 @@ will bring the behavior in line with the newer Emacsen."
      (insert ,text)
      ,@body))
 
+(ert-deftest ivy-backward-kill-word ()
+  (should (string= (ivy-with
+                    '(ivy-read "test: " nil
+                      :initial-input "one two three")
+                    "M-DEL M-DEL C-M-j")
+                   "one "))
+  (should (string= (ivy-with
+                    '(ivy-read "test: " nil
+                      :initial-input "one two three")
+                    "M-DEL M-DEL M-DEL C-y C-M-j")
+                   "one two three")))
+
 (ert-deftest counsel-url-expand ()
   "Test ffap expansion using `counsel-url-expansions-alist'."
   ;; no expansions defined
@@ -462,8 +474,8 @@ will bring the behavior in line with the newer Emacsen."
   (let ((counsel-url-expansions-alist
          '(("^foo$" . "https://foo.com/%s";)
            ("^issue\\([0-9]+\\)" . (lambda (word)
-                                     (concat "https://foo.com/issues/";
-                                             (match-string 1 word)))))))
+                                 (concat "https://foo.com/issues/";
+                                         (match-string 1 word)))))))
     ;; no match
     (should (equal (ivy--string-buffer
                     "foobar"
diff --git a/ivy.el b/ivy.el
index 789f152..9a2c911 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1740,9 +1740,12 @@ minibuffer."
         (ivy--cd (ivy--parent-dir (expand-file-name ivy--directory)))
         (ivy--exhibit))
     (ignore-errors
-      (let ((pt (point)))
+      (let ((pt (point))
+            (last-command (if (eq last-command 'ivy-backward-kill-word)
+                              'kill-region
+                            last-command)))
         (forward-word -1)
-        (delete-region (point) pt)))))
+        (kill-region pt (point))))))
 
 (defvar ivy--regexp-quote #'regexp-quote
   "Store the regexp quoting state.")



reply via email to

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