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

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

[nongnu] elpa/evil-surround a4a04c6f01 075/175: Merge pull request #74 f


From: ELPA Syncer
Subject: [nongnu] elpa/evil-surround a4a04c6f01 075/175: Merge pull request #74 from lislon/surround-repeat
Date: Mon, 9 Oct 2023 13:01:04 -0400 (EDT)

branch: elpa/evil-surround
commit a4a04c6f016528502f0d7d05ea7a8c6c0912e3ed
Merge: 8c03039e0e 277759d894
Author: Tim Harper <timcharper@gmail.com>
Commit: Tim Harper <timcharper@gmail.com>

    Merge pull request #74 from lislon/surround-repeat
    
    Fix repeat action (.) for ys and yS operators.
---
 evil-surround.el | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/evil-surround.el b/evil-surround.el
index 0841bcf3c4..d18af37645 100755
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -235,6 +235,16 @@ column."
          (evil-surround-region ibeg iend t char)))
      beg end nil)))
 
+(defun evil-surround-call-with-repeat (callback)
+  "Record keystrokes to repeat surround-region operator and it's motion.
+This is necessary because `evil-yank' operator is not repeatable (:repeat nil)"
+  (evil-repeat-start)
+  (evil-repeat-record "y")
+  (evil-repeat-record (this-command-keys))
+  (call-interactively callback)
+  (evil-repeat-keystrokes 'post)
+  (evil-repeat-stop))
+
 ;; Dispatcher function in Operator-Pending state.
 ;; "cs" calls `evil-surround-change', "ds" calls `evil-surround-delete',
 ;; and "ys" calls `evil-surround-region'.
@@ -252,7 +262,7 @@ Otherwise call `evil-surround-region'."
     (call-interactively 'evil-surround-delete))
    (t
     (evil-surround-setup-surround-line-operators)
-    (call-interactively 'evil-surround-region))))
+    (evil-surround-call-with-repeat 'evil-surround-region))))
 
 (evil-define-command evil-Surround-edit (operation)
   "Like evil-surround-edit, but for surrounding with additional new-lines.
@@ -265,7 +275,7 @@ It does nothing for change / delete."
    ((eq operation 'delete) nil)
    (t
     (evil-surround-setup-surround-line-operators)
-    (call-interactively 'evil-Surround-region))))
+    (evil-surround-call-with-repeat 'evil-Surround-region))))
 
 (evil-define-operator evil-surround-region (beg end type char &optional 
force-new-line)
   "Surround BEG and END with CHAR.



reply via email to

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