[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-surround 822a0f61c3 111/175: Make `ysw` work like `cw
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-surround 822a0f61c3 111/175: Make `ysw` work like `cw`, not `ce` |
Date: |
Mon, 9 Oct 2023 13:01:07 -0400 (EDT) |
branch: elpa/evil-surround
commit 822a0f61c3fd7c55cda4e04c8590ae5144401c26
Author: Evgeni Kolev <evgenysw@gmail.com>
Commit: Filipe Silva <ninrod@users.noreply.github.com>
Make `ysw` work like `cw`, not `ce`
---
evil-surround.el | 14 ++++++++++++--
test/evil-surround-test.el | 31 ++++++++++++++++++++++++++++++-
test/make-test.el | 1 +
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/evil-surround.el b/evil-surround.el
index bfe6056c34..5a6db9a650 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -44,6 +44,10 @@
:prefix "surround-"
:group 'evil)
+;; make surround's `ysw' work like `cw', not `ce'
+(when (boundp 'evil-change-commands)
+ (add-to-list 'evil-change-commands 'evil-surround-region))
+
(defcustom evil-surround-pairs-alist
'((?\( . ("( " . " )"))
(?\[ . ("[ " . " ]"))
@@ -245,6 +249,12 @@ 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))
+
+ ;; set `this-command-keys' to the command that will be executed
+ ;; interactively; as a result, `evil-this-operator' will be
+ ;; correctly set to, for example, `evil-surround-region' instead of
+ ;; `evil-yank' when surround has been invoked by `ys'
+ (setq this-command callback)
(call-interactively callback)
(evil-repeat-keystrokes 'post)
(evil-repeat-stop))
@@ -309,8 +319,8 @@ Becomes this:
((eq type 'line)
(setq force-new-line
(or force-new-line
- ;; Force newline if not invoked from an operator,
e.g. VS)
- (eq evil-this-operator 'evil-surround-region)
+ ;; Force newline if not invoked from an operator,
e.g. visual line mode with VS)
+ (evil-visual-state-p)
;; Or on multi-line operator surrounds (like
'ysj]')
(/= (line-number-at-pos) (line-number-at-pos (1-
end)))))
diff --git a/test/evil-surround-test.el b/test/evil-surround-test.el
index b0c363f8eb..c2028dee9b 100644
--- a/test/evil-surround-test.el
+++ b/test/evil-surround-test.el
@@ -96,4 +96,33 @@
"111 222 333\n[1]11 222 333\n111 222 333\n111 222 333\n"
(turn-on-evil-surround-mode)
("ysjb")
- "111 222 333\n(\n111 222 333\n111 222 333\n)\n111 222 333\n")))
+ "111 222 333\n(\n111 222 333\n111 222 333\n)\n111 222 333\n"))
+ (ert-info ("test with evil-want-change-word-to-end")
+ (evil-test-buffer
+ "[o]ne two three"
+ (setq evil-want-change-word-to-end nil)
+ (turn-on-evil-surround-mode)
+ ("yswb")
+ "[(]one )two three"
+ ("dsb")
+ "[o]ne two three"
+ ("ys2wb")
+ "[(]one two )three"
+ ("dsb")
+ "[o]ne two three"
+ ("ys3wb")
+ "[(]one two three)")
+ (evil-test-buffer
+ "[o]ne two three"
+ (setq evil-want-change-word-to-end t)
+ (turn-on-evil-surround-mode)
+ ("yswb")
+ "[(]one) two three"
+ ("dsb")
+ "[o]ne two three"
+ ("ys2wb")
+ "[(]one two) three"
+ ("dsb")
+ "[o]ne two three"
+ ("ys3wb")
+ "[(]one two three)")))
diff --git a/test/make-test.el b/test/make-test.el
index fb487b1c12..1964641d82 100644
--- a/test/make-test.el
+++ b/test/make-test.el
@@ -1,3 +1,4 @@
+(setq load-prefer-newer t)
(let ((current-directory (file-name-directory load-file-name)))
(setq evil-surround-test-path (expand-file-name "." current-directory))
- [nongnu] elpa/evil-surround 641498131a 059/175: Refactor evil-surround-block, (continued)
- [nongnu] elpa/evil-surround 641498131a 059/175: Refactor evil-surround-block, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 0eeef7a3a9 070/175: Merge pull request #68 from hlissner/master, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 8b2ca83b7c 068/175: Fix #52, #39, and #5 (linewise surrounding), ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 78eddc8077 063/175: Merge pull request #50 from yangguang760/master, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 06071c3425 060/175: let* => let, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround a70e34164e 069/175: Don't indent first line on inline linewise surround, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 5c07befaf7 090/175: Merge pull request #89 from LemmingAvalanche/execute-permissions, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 7a0358ce3e 095/175: update readme, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround a4fc4483df 103/175: add credits to Tim C. Harper, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround cb4f0be9b4 119/175: add backquote delimiter test, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 822a0f61c3 111/175: Make `ysw` work like `cw`, not `ce`,
ELPA Syncer <=
- [nongnu] elpa/evil-surround 68f7033322 138/175: optionally keep xml attributes, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 31b895f1e1 128/175: fix #143: add readme entry on how to add new pairs through evil, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 5ad01dfa86 139/175: optionally keep xml attrs: add more tests, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround b670e5f338 143/175: Checking minibuffer window doesn't seem to make a difference either, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround f6162a7b5a 117/175: closes #112, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 4fbe6bf9ca 161/175: Limit global activation to text-, prog- and comint-mode, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 0d860be741 174/175: Fix get-delims to allow functions as values, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 648da3c544 159/175: Merge pull request #190 from MintSoup/master, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 0f629b8f9c 133/175: tweak implementation file header, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround c96499e91e 030/175: Extract surround-operator-alist to a customizeable variable, ELPA Syncer, 2023/10/09