[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil dba2fa9907: Store digraph character directly for repe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil dba2fa9907: Store digraph character directly for repetition |
Date: |
Mon, 26 Sep 2022 13:59:08 -0400 (EDT) |
branch: elpa/evil
commit dba2fa9907cf096f5e615df2e8b0381b643d47ee
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Store digraph character directly for repetition
Fixes #1675
---
evil-common.el | 13 ++++++++-----
evil-repeat.el | 5 ++++-
evil-tests.el | 9 ++++++++-
evil-vars.el | 3 +++
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/evil-common.el b/evil-common.el
index 7f0bad4e7d..7ae8feb3f7 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -604,6 +604,7 @@ Translates it according to the input method."
((eq cmd 'self-insert-command)
char)
(cmd
+ (setq evil-last-read-digraph-char nil)
(call-interactively cmd))
(t
(user-error "No replacement character typed"))))
@@ -649,11 +650,13 @@ Return the digraph from `evil-digraph', else return
second char."
This function creates an overlay at (point), hiding the next
HIDE-CHARS characters. HIDE-CHARS defaults to 1."
(interactive)
- (let ((overlay (make-overlay (point)
- (min (point-max)
- (+ (or hide-chars 1)
- (point))))))
- (evil-read-digraph-char-with-overlay overlay)))
+ (let* ((overlay (make-overlay (point)
+ (min (point-max)
+ (+ (or hide-chars 1)
+ (point)))))
+ (char (evil-read-digraph-char-with-overlay overlay)))
+ (setq evil-last-read-digraph-char char)
+ char))
(defun evil-read-motion (&optional motion count type modifier)
"Read a MOTION, motion COUNT and motion TYPE from the keyboard.
diff --git a/evil-repeat.el b/evil-repeat.el
index f305704abd..1234c1ca6d 100644
--- a/evil-repeat.el
+++ b/evil-repeat.el
@@ -329,7 +329,9 @@ invoked the current command"
;; Only add prefix if no repeat info recorded yet
(null evil-repeat-info))
(string-to-vector (number-to-string arg)))
- (this-single-command-keys))))
+ (or (when evil-last-read-digraph-char
+ (vector evil-last-read-digraph-char))
+ (this-single-command-keys)))))
(defun evil-repeat-keystrokes (flag)
"Repeation recording function for commands that are repeated by keystrokes."
@@ -343,6 +345,7 @@ invoked the current command"
(evil-repeat-record (if (zerop (length (evil-this-command-keys t)))
evil-repeat-keys
(evil-this-command-keys t)))
+ (setq evil-last-read-digraph-char nil)
;; erase commands keys to prevent double recording
(evil-clear-command-keys))))
diff --git a/evil-tests.el b/evil-tests.el
index 91492f049c..34926c0c3b 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -938,7 +938,14 @@ If nil, KEYS is used."
("re'")
"[é]; This buffer is for notes you don't want to save"
("3rc*")
- "ξξ[ξ]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 replace digraph")
+ (evil-test-buffer
+ "ab[c]defghijkl"
+ ("rW*")
+ "ab[Ω]defghijkl"
+ ("fg" "2.")
+ "abΩdefΩ[Ω]ijkl")))
(ert-info ("Replacing \\n should insert only one newline")
(evil-test-buffer
"(setq var xxx [y]yy zzz)\n"
diff --git a/evil-vars.el b/evil-vars.el
index c99bf856ff..6dbb1bc068 100644
--- a/evil-vars.el
+++ b/evil-vars.el
@@ -1538,6 +1538,9 @@ This keymap can be used to bind some commands during the
execution of `evil-read-key' which is usually used to read a
character argument for some commands, e.g. `evil-replace'.")
+(defvar evil-last-read-digraph-char nil
+ "The last digraph character read. Used for repeats.")
+
;; TODO: customize size of ring
(defvar evil-repeat-ring (make-ring 10)
"A ring of repeat-informations to repeat the last command.")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil dba2fa9907: Store digraph character directly for repetition,
ELPA Syncer <=