diff options
| author | Tom Dalziel <tom_dl@hotmail.com> | 2024-06-16 16:13:28 +0200 |
|---|---|---|
| committer | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2024-06-16 16:23:03 +0200 |
| commit | e72562f0fa0256eb0868eaba271db31d602b91ee (patch) | |
| tree | d16bff55dcd44c66e2bb6a77dab8a750b7811f94 | |
| parent | f29ad3c91e06ca1910f326b3b0a41ae59ba2c8b6 (diff) | |
Record search offset for repeat
Fixes #1907
| -rw-r--r-- | evil-commands.el | 7 | ||||
| -rw-r--r-- | evil-tests.el | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/evil-commands.el b/evil-commands.el index 43030c2..e4fe002 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -3800,12 +3800,15 @@ after executing the command." (evil-repeat-record (this-command-keys)) (evil-clear-command-keys)) ((and (evil-operator-state-p) (eq flag 'post)) - (evil-repeat-record (evil-ex-pattern-regex evil-ex-search-pattern)) + (let ((search-separator (car (last evil-repeat-info)))) + (evil-repeat-record (evil-ex-pattern-regex evil-ex-search-pattern)) + (when evil-ex-search-offset + (evil-repeat-record (concat search-separator evil-ex-search-offset)))) ;; If it weren't for the fact that `exit-minibuffer' throws an `exit' ;; tag, which bypasses the source of `this-command-keys', we'd be able ;; to capture the key(s) in the post-command of the operator as usual. ;; Fortunately however, `last-input-event' can see the key (by default, `return') - (when (= (length (this-command-keys)) 0) + (when (zerop (length (this-command-keys))) (evil-repeat-record (vector last-input-event)))) (t (evil-repeat-motion flag)))) diff --git a/evil-tests.el b/evil-tests.el index 4699108..ab49676 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -931,7 +931,15 @@ If nil, KEYS is used." ("i(\M-f)" [escape]) ";; (This[)] buffer is for notes you don't want to save" ("w.") - ";; (This) (buffer[)] is for notes you don't want to save"))) + ";; (This) (buffer[)] is for notes you don't want to save")) + (ert-info ("Repeat search motion with offset") + (evil-select-search-module 'evil-search-module 'evil-search) + (evil-test-buffer + "[f]irst, second, third, fourth" + ("d/, /e" [return]) + "[s]econd, third, fourth" + ("2.") + "[f]ourth"))) (ert-deftest evil-test-repeat-register () "Test repeating a register command." |
